RmsStatus.h
Go to the documentation of this file.
1 #ifndef _RMS_RMSSTATUS_H
2 #define _RMS_RMSSTATUS_H
3 
4 #include <string>
5 
6 namespace gov {
7 
8 namespace fnal {
9 
10 namespace cd {
11 
12 namespace rms {
13 
14 namespace base {
15 
16 /**
17  * Class to hold information about errors that occur
18  * in the process of receiving and decoding RmsMessages.
19  *
20  * @author Kurt Biery
21  * @author Steve Foulkes
22  * @version $Revision: 1.1.1.1.18.1 $ $Date: 2019/09/27 00:07:31 $
23  */
24 
25 class RmsStatus {
26  public:
27  /**
28  * Codes for the three classes of problems that we handle:
29  * success, exception and error.
30  */
31  static const int SUCCESS_CODE = 0;
32  static const int EXCEPTION_CODE = 1;
33  static const int ERROR_CODE = 2;
34 
35  /**
36  * Human readable strings for the three classes of
37  * problems that we handle: success, exception and error.
38  */
41  static const std::string ERROR_MESSAGE;
42 
43  /**
44  * Default constructor. Sets up everything to be success.
45  */
49  }
50 
51  /**
52  * Constructs an RmsStatus object with the specified status code
53  * and message.
54  *
55  * @param code integer value that indicates success or failure
56  * @param message text string that describes the status
57  */
59  _code = code;
60  _message = message;
61  }
62 
63  /**
64  * Constructs an RmsStatus object from the specified exception.
65  *
66  * @param excp the exception object that was generated by some
67  * exceptional condition
68  */
69  RmsStatus(int excp) {
70  _excp = excp;
71  }
72 
73  /**
74  * Returns the status code.
75  *
76  * @return The status code
77  */
78  int getCode() const {
79  return _code;
80  }
81 
82  /**
83  * Returns the status message.
84  *
85  * @return The status message
86  */
88  return _message;
89  }
90 
91  /**
92  * Returns the exception that was encountered when the status code is
93  * EXCEPTION and null otherwise.
94  *
95  * @return The status exception, or null if the problem code
96  * is not EXCPETION.
97  */
98  int getException() const {
99  return _excp;
100  }
101 
102  private:
103  /**
104  * This indicates whether we're reporting success, an error,
105  * or on exception.
106  */
107  int _code;
108 
109  /**
110  * If we're reporting an exception, this will indicate
111  * what the exception was.
112  */
113  int _excp;
114 
115  /**
116  * The human readable text for of the error code.
117  */
119 };
120 
121 } // end of namespace base
122 
123 } // end of namespace rms
124 
125 } // end of namespace cd
126 
127 } // end of namespace fnal
128 
129 } // end of namespace gov
130 
131 #endif
132 
static const std::string ERROR_MESSAGE
Definition: RmsStatus.h:41
const XML_Char int const XML_Char int const XML_Char * base
Definition: expat.h:331
static const std::string EXCPETION_MESSAGE
Definition: RmsStatus.h:40
RmsStatus(int code, std::string message)
Definition: RmsStatus.h:58
Definition: fnal.py:1
Definition: inftrees.h:24
static const std::string SUCCESS_MESSAGE
Definition: RmsStatus.h:39
std::string getMessage() const
Definition: RmsStatus.h:87
c cd(1)
enum BeamMode string