NCBI C++ ToolKit
Taxon1_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 Taxon1_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/objects/taxon1/taxon1.asn">taxon1.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/taxon1/taxon1.def">taxon1.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 OBJECTS_TAXON1_TAXON1_ERROR_BASE_HPP
42 #define OBJECTS_TAXON1_TAXON1_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_Taxon1
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CTaxon1_error_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CTaxon1_error_Base(void);
78  // destructor
79  virtual ~CTaxon1_error_Base(void);
80 
81  // type info
83 
84  enum ELevel {
85  eLevel_none = 0, ///< not an error, just a message
86  eLevel_info = 1, ///< informational error
87  eLevel_warn = 2,
88  eLevel_error = 3,
89  eLevel_fatal = 4
90  };
91 
92  /// Access to ELevel's attributes (values, names) as defined in spec
93  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ELevel)(void);
94 
95  // types
96  typedef ELevel TLevel;
97  typedef string TMsg;
98 
99  // member index
100  enum class E_memberIndex {
101  e__allMandatory = 0,
102  e_level,
103  e_msg
104  };
106 
107  // getters
108  // setters
109 
110  /// Check if a value has been assigned to Level data member.
111  ///
112  /// Data member Level is mandatory;
113  /// its type is defined as 'typedef ELevel TLevel'
114  /// @return
115  /// - true, if a value has been assigned.
116  /// - false, otherwise.
117  bool IsSetLevel(void) const;
118 
119  /// Check if it is safe to call GetLevel method.
120  ///
121  /// @return
122  /// - true, if the data member is getatable.
123  /// - false, otherwise.
124  bool CanGetLevel(void) const;
125 
126  /// Reset Level data member.
127  void ResetLevel(void);
128 
129  /// Get the Level member data.
130  ///
131  /// @return
132  /// Copy of the member data.
133  TLevel GetLevel(void) const;
134 
135  /// Assign a value to Level data member.
136  ///
137  /// @param value
138  /// Value to assign
139  void SetLevel(TLevel value);
140 
141  /// Assign a value to Level data member.
142  ///
143  /// @return
144  /// Reference to the data value.
145  TLevel& SetLevel(void);
146 
147  /// Check if a value has been assigned to Msg data member.
148  ///
149  /// Data member Msg is optional;
150  /// its type is defined as 'typedef string TMsg'
151  /// @return
152  /// - true, if a value has been assigned.
153  /// - false, otherwise.
154  bool IsSetMsg(void) const;
155 
156  /// Check if it is safe to call GetMsg method.
157  ///
158  /// @return
159  /// - true, if the data member is getatable.
160  /// - false, otherwise.
161  bool CanGetMsg(void) const;
162 
163  /// Reset Msg data member.
164  void ResetMsg(void);
165 
166  /// Get the Msg member data.
167  ///
168  /// @return
169  /// Reference to the member data.
170  const TMsg& GetMsg(void) const;
171 
172  /// Assign a value to Msg data member.
173  ///
174  /// @param value
175  /// Value to assign
176  void SetMsg(const TMsg& value);
177  void SetMsg(TMsg&& value);
178 
179  /// Assign a value to Msg data member.
180  ///
181  /// @return
182  /// Reference to the data value.
183  TMsg& SetMsg(void);
184 
185  /// Reset the whole object
186  virtual void Reset(void);
187 
188 
189 private:
190  // Prohibit copy constructor and assignment operator
193 
194  // data
195  Uint4 m_set_State[1];
197  string m_Msg;
198 };
199 
200 /* @} */
201 
202 
203 
204 
205 
206 ///////////////////////////////////////////////////////////
207 ///////////////////// inline methods //////////////////////
208 ///////////////////////////////////////////////////////////
209 inline
211 {
212  return ((m_set_State[0] & 0x3) != 0);
213 }
214 
215 inline
217 {
218  return IsSetLevel();
219 }
220 
221 inline
223 {
224  m_Level = (ELevel)(0);
225  m_set_State[0] &= ~0x3;
226 }
227 
228 inline
230 {
231  if (!CanGetLevel()) {
232  ThrowUnassigned(0);
233  }
234  return m_Level;
235 }
236 
237 inline
239 {
240  m_Level = value;
241  m_set_State[0] |= 0x3;
242 }
243 
244 inline
246 {
247 #ifdef _DEBUG
248  if (!IsSetLevel()) {
249  memset(&m_Level,UnassignedByte(),sizeof(m_Level));
250  }
251 #endif
252  m_set_State[0] |= 0x1;
253  return m_Level;
254 }
255 
256 inline
258 {
259  return ((m_set_State[0] & 0xc) != 0);
260 }
261 
262 inline
264 {
265  return IsSetMsg();
266 }
267 
268 inline
270 {
271  if (!CanGetMsg()) {
272  ThrowUnassigned(1);
273  }
274  return m_Msg;
275 }
276 
277 inline
279 {
280  m_Msg = value;
281  m_set_State[0] |= 0xc;
282 }
283 
284 inline
286 {
287  m_Msg = std::forward<CTaxon1_error_Base::TMsg>(value);
288  m_set_State[0] |= 0xc;
289 }
290 
291 inline
293 {
294 #ifdef _DEBUG
295  if (!IsSetMsg()) {
297  }
298 #endif
299  m_set_State[0] |= 0x4;
300  return m_Msg;
301 }
302 
303 ///////////////////////////////////////////////////////////
304 ////////////////// end of inline methods //////////////////
305 ///////////////////////////////////////////////////////////
306 
307 
308 
309 
310 
311 END_objects_SCOPE // namespace ncbi::objects::
312 
314 
315 
316 #endif // OBJECTS_TAXON1_TAXON1_ERROR_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTaxon1_error_Base –.
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
static string UnassignedString(void)
Definition: serialbase.hpp:175
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
#define NCBI_TAXON1_EXPORT
Definition: ncbi_export.h:857
TLevel & SetLevel(void)
Assign a value to Level data member.
bool IsSetLevel(void) const
Check if a value has been assigned to Level data member.
CSerialObject Tparent
bool CanGetLevel(void) const
Check if it is safe to call GetLevel method.
bool IsSetMsg(void) const
Check if a value has been assigned to Msg data member.
TMsg & SetMsg(void)
Assign a value to Msg data member.
TLevel GetLevel(void) const
Get the Level member data.
CTaxon1_error_Base & operator=(const CTaxon1_error_Base &)
const TMsg & GetMsg(void) const
Get the Msg member data.
bool CanGetMsg(void) const
Check if it is safe to call GetMsg method.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
CTaxon1_error_Base(const CTaxon1_error_Base &)
void ResetLevel(void)
Reset Level data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:44 2024 by modify_doxy.py rev. 669887