summaryrefslogtreecommitdiffstats
path: root/c/src/librtems++/include/rtems++/rtemsStatusCode.h
blob: c911272b338e0bd067b0faedeb45f1393c8c7450 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
  ------------------------------------------------------------------------

  COPYRIGHT (c) 1997
  Objective Design Systems Ltd Pty (ODS)
  All rights reserved (R) Objective Design Systems Ltd Pty

  The license and distribution terms for this file may be found in the
  file LICENSE in this distribution or at
  http://www.rtems.com/license/LICENSE.

  ------------------------------------------------------------------------

  rtemsStatusCode controls and manages status codes from the RTEMS kernel.

  ------------------------------------------------------------------------
*/

#if !defined(_rtemsStatusCode_h_)
#define _rtemsStatusCode_h_

#include <rtems.h>

/* ----
    rtemsStatusCode
*/

class rtemsStatusCode
{
public:

  rtemsStatusCode() { last_status = RTEMS_NOT_CONFIGURED; }

  const bool successful() { return last_status == RTEMS_SUCCESSFUL; }
  const bool unsuccessful() { return last_status != RTEMS_SUCCESSFUL; }

  // return the last status code
  const rtems_status_code last_status_code() { return last_status; }

  // return the last status as a string
  const char *last_status_string();

  const char *status_string(rtems_status_code status_code);

protected:
  const rtems_status_code set_status_code(const rtems_status_code status)
  { return (last_status = status); }

private:

  // public at the moment, this might change
  rtems_status_code last_status;
};

#endif  // _rtemsStatusCode_h_