NCBI C++ ToolKit
CDD_Error_.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id$
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  */
27 
28 /// @file CDD_Error_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/data_loaders/cdd/cdd_access/cdd_access.asn">cdd_access.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/data_loaders/cdd/cdd_access/cdd_access.def">cdd_access.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef OBJTOOLS_DATA_LOADERS_CDD_CDD_ACCESS_CDD_ERROR_BASE_HPP
42 #define OBJTOOLS_DATA_LOADERS_CDD_CDD_ACCESS_CDD_ERROR_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_CDDAccess
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// Error reply
69 ///
70 /// CCDD_Error_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CCDD_Error_Base(void);
79  // destructor
80  virtual ~CCDD_Error_Base(void);
81 
82  // type info
84 
85  enum ESeverity {
86  eSeverity_trace = 0,
87  eSeverity_info = 1,
88  eSeverity_warning = 2,
89  eSeverity_error = 3,
90  eSeverity_critical = 4,
91  eSeverity_fatal = 5
92  };
93 
94  /// Access to ESeverity's attributes (values, names) as defined in spec
95  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ESeverity)(void);
96 
97  // types
99  typedef int TCode;
100  typedef int TSeverity;
101 
102  // member index
103  enum class E_memberIndex {
104  e__allMandatory = 0,
105  e_message,
106  e_code,
107  e_severity
108  };
110 
111  // getters
112  // setters
113 
114  /// Check if a value has been assigned to Message data member.
115  ///
116  /// Data member Message is mandatory;
117  /// its type is defined as 'typedef CStringUTF8 TMessage'
118  /// @return
119  /// - true, if a value has been assigned.
120  /// - false, otherwise.
121  bool IsSetMessage(void) const;
122 
123  /// Check if it is safe to call GetMessage method.
124  ///
125  /// @return
126  /// - true, if the data member is getatable.
127  /// - false, otherwise.
128  bool CanGetMessage(void) const;
129 
130  /// Reset Message data member.
131  void ResetMessage(void);
132 
133  /// Get the Message member data.
134  ///
135  /// @return
136  /// Reference to the member data.
137  const TMessage& GetMessage(void) const;
138 
139  /// Assign a value to Message data member.
140  ///
141  /// @param value
142  /// Value to assign
143  void SetMessage(const TMessage& value);
144  void SetMessage(TMessage&& value);
145 
146  /// Assign a value to Message data member.
147  ///
148  /// @return
149  /// Reference to the data value.
150  TMessage& SetMessage(void);
151 
152  /// Check if a value has been assigned to Code data member.
153  ///
154  /// Data member Code is mandatory;
155  /// its type is defined as 'typedef int TCode'
156  /// @return
157  /// - true, if a value has been assigned.
158  /// - false, otherwise.
159  bool IsSetCode(void) const;
160 
161  /// Check if it is safe to call GetCode method.
162  ///
163  /// @return
164  /// - true, if the data member is getatable.
165  /// - false, otherwise.
166  bool CanGetCode(void) const;
167 
168  /// Reset Code data member.
169  void ResetCode(void);
170 
171  /// Get the Code member data.
172  ///
173  /// @return
174  /// Copy of the member data.
175  TCode GetCode(void) const;
176 
177  /// Assign a value to Code data member.
178  ///
179  /// @param value
180  /// Value to assign
181  void SetCode(TCode value);
182 
183  /// Assign a value to Code data member.
184  ///
185  /// @return
186  /// Reference to the data value.
187  TCode& SetCode(void);
188 
189  /// Check if a value has been assigned to Severity data member.
190  ///
191  /// Data member Severity is mandatory;
192  /// its type is defined as 'typedef int TSeverity'
193  /// @return
194  /// - true, if a value has been assigned.
195  /// - false, otherwise.
196  bool IsSetSeverity(void) const;
197 
198  /// Check if it is safe to call GetSeverity method.
199  ///
200  /// @return
201  /// - true, if the data member is getatable.
202  /// - false, otherwise.
203  bool CanGetSeverity(void) const;
204 
205  /// Reset Severity data member.
206  void ResetSeverity(void);
207 
208  /// Get the Severity member data.
209  ///
210  /// @return
211  /// Copy of the member data.
212  TSeverity GetSeverity(void) const;
213 
214  /// Assign a value to Severity data member.
215  ///
216  /// @param value
217  /// Value to assign
218  void SetSeverity(TSeverity value);
219 
220  /// Assign a value to Severity data member.
221  ///
222  /// @return
223  /// Reference to the data value.
224  TSeverity& SetSeverity(void);
225 
226  /// Reset the whole object
227  virtual void Reset(void);
228 
229 
230 private:
231  // Prohibit copy constructor and assignment operator
234 
235  // data
236  Uint4 m_set_State[1];
238  int m_Code;
240 };
241 
242 /* @} */
243 
244 
245 
246 
247 
248 ///////////////////////////////////////////////////////////
249 ///////////////////// inline methods //////////////////////
250 ///////////////////////////////////////////////////////////
251 inline
253 {
254  return ((m_set_State[0] & 0x3) != 0);
255 }
256 
257 inline
259 {
260  return IsSetMessage();
261 }
262 
263 inline
265 {
266  if (!CanGetMessage()) {
267  ThrowUnassigned(0);
268  }
269  return m_Message;
270 }
271 
272 inline
274 {
275  m_Message = value;
276  m_set_State[0] |= 0x3;
277 }
278 
279 inline
281 {
282  m_Message = std::forward<CCDD_Error_Base::TMessage>(value);
283  m_set_State[0] |= 0x3;
284 }
285 
286 inline
288 {
289 #ifdef _DEBUG
290  if (!IsSetMessage()) {
292  }
293 #endif
294  m_set_State[0] |= 0x1;
295  return m_Message;
296 }
297 
298 inline
300 {
301  return ((m_set_State[0] & 0xc) != 0);
302 }
303 
304 inline
306 {
307  return IsSetCode();
308 }
309 
310 inline
312 {
313  m_Code = 0;
314  m_set_State[0] &= ~0xc;
315 }
316 
317 inline
319 {
320  if (!CanGetCode()) {
321  ThrowUnassigned(1);
322  }
323  return m_Code;
324 }
325 
326 inline
328 {
329  m_Code = value;
330  m_set_State[0] |= 0xc;
331 }
332 
333 inline
335 {
336 #ifdef _DEBUG
337  if (!IsSetCode()) {
338  memset(&m_Code,UnassignedByte(),sizeof(m_Code));
339  }
340 #endif
341  m_set_State[0] |= 0x4;
342  return m_Code;
343 }
344 
345 inline
347 {
348  return ((m_set_State[0] & 0x30) != 0);
349 }
350 
351 inline
353 {
354  return IsSetSeverity();
355 }
356 
357 inline
359 {
360  m_Severity = (ESeverity)(0);
361  m_set_State[0] &= ~0x30;
362 }
363 
364 inline
366 {
367  if (!CanGetSeverity()) {
368  ThrowUnassigned(2);
369  }
370  return m_Severity;
371 }
372 
373 inline
375 {
376  m_Severity = value;
377  m_set_State[0] |= 0x30;
378 }
379 
380 inline
382 {
383 #ifdef _DEBUG
384  if (!IsSetSeverity()) {
385  memset(&m_Severity,UnassignedByte(),sizeof(m_Severity));
386  }
387 #endif
388  m_set_State[0] |= 0x10;
389  return m_Severity;
390 }
391 
392 ///////////////////////////////////////////////////////////
393 ////////////////// end of inline methods //////////////////
394 ///////////////////////////////////////////////////////////
395 
396 
397 
398 
399 
400 END_objects_SCOPE // namespace ncbi::objects::
401 
403 
404 
405 #endif // OBJTOOLS_DATA_LOADERS_CDD_CDD_ACCESS_CDD_ERROR_BASE_HPP
Error reply.
Definition: CDD_Error_.hpp:74
Base class for all serializable objects.
Definition: serialbase.hpp:150
static CStringUTF8 UnassignedStringUTF8(void)
Definition: serialbase.hpp:178
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
std::string CStringUTF8
Definition: ncbistl.hpp:254
#define NCBI_CDD_ACCESS_EXPORT
Definition: ncbi_export.h:1505
TMessage & SetMessage(void)
Assign a value to Message data member.
Definition: CDD_Error_.hpp:287
TSeverity & SetSeverity(void)
Assign a value to Severity data member.
Definition: CDD_Error_.hpp:381
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: CDD_Error_.hpp:109
CStringUTF8 TMessage
Definition: CDD_Error_.hpp:98
bool CanGetCode(void) const
Check if it is safe to call GetCode method.
Definition: CDD_Error_.hpp:305
CSerialObject Tparent
Definition: CDD_Error_.hpp:75
Uint4 m_set_State[1]
Definition: CDD_Error_.hpp:236
CCDD_Error_Base(const CCDD_Error_Base &)
const TMessage & GetMessage(void) const
Get the Message member data.
Definition: CDD_Error_.hpp:264
bool IsSetCode(void) const
Check if a value has been assigned to Code data member.
Definition: CDD_Error_.hpp:299
CStringUTF8 m_Message
Definition: CDD_Error_.hpp:237
bool CanGetSeverity(void) const
Check if it is safe to call GetSeverity method.
Definition: CDD_Error_.hpp:352
TCode & SetCode(void)
Assign a value to Code data member.
Definition: CDD_Error_.hpp:334
bool CanGetMessage(void) const
Check if it is safe to call GetMessage method.
Definition: CDD_Error_.hpp:258
TSeverity GetSeverity(void) const
Get the Severity member data.
Definition: CDD_Error_.hpp:365
bool IsSetSeverity(void) const
Check if a value has been assigned to Severity data member.
Definition: CDD_Error_.hpp:346
void ResetCode(void)
Reset Code data member.
Definition: CDD_Error_.hpp:311
void ResetSeverity(void)
Reset Severity data member.
Definition: CDD_Error_.hpp:358
CCDD_Error_Base & operator=(const CCDD_Error_Base &)
bool IsSetMessage(void) const
Check if a value has been assigned to Message data member.
Definition: CDD_Error_.hpp:252
TCode GetCode(void) const
Get the Code member data.
Definition: CDD_Error_.hpp:318
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat Jun 08 14:26:09 2024 by modify_doxy.py rev. 669887