NCBI C++ ToolKit
T3Error_.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 T3Error_.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/taxon3/taxon3.asn">taxon3.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/taxon3/taxon3.def">taxon3.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_TAXON3_T3ERROR_BASE_HPP
42 #define OBJECTS_TAXON3_T3ERROR_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 // forward declarations
60 class COrg_ref;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_Taxon3
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CT3Error_Base --
74 ///
75 
77 {
79 public:
80  // constructor
81  CT3Error_Base(void);
82  // destructor
83  virtual ~CT3Error_Base(void);
84 
85  // type info
87 
88  enum ELevel {
89  eLevel_none = 0, ///< not an error, just a message
90  eLevel_info = 1, ///< informational error
91  eLevel_warn = 2,
92  eLevel_error = 3,
93  eLevel_fatal = 4
94  };
95 
96  /// Access to ELevel's attributes (values, names) as defined in spec
97  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ELevel)(void);
98 
99  // types
100  typedef ELevel TLevel;
101  typedef string TMessage;
102  typedef int TTaxid;
103  typedef string TName;
104  typedef COrg_ref TOrg;
105 
106  // member index
107  enum class E_memberIndex {
108  e__allMandatory = 0,
109  e_level,
110  e_message,
111  e_taxid,
112  e_name,
113  e_org
114  };
116 
117  // getters
118  // setters
119 
120  /// Check if a value has been assigned to Level data member.
121  ///
122  /// Data member Level is mandatory;
123  /// its type is defined as 'typedef ELevel TLevel'
124  /// @return
125  /// - true, if a value has been assigned.
126  /// - false, otherwise.
127  bool IsSetLevel(void) const;
128 
129  /// Check if it is safe to call GetLevel method.
130  ///
131  /// @return
132  /// - true, if the data member is getatable.
133  /// - false, otherwise.
134  bool CanGetLevel(void) const;
135 
136  /// Reset Level data member.
137  void ResetLevel(void);
138 
139  /// Get the Level member data.
140  ///
141  /// @return
142  /// Copy of the member data.
143  TLevel GetLevel(void) const;
144 
145  /// Assign a value to Level data member.
146  ///
147  /// @param value
148  /// Value to assign
149  void SetLevel(TLevel value);
150 
151  /// Assign a value to Level data member.
152  ///
153  /// @return
154  /// Reference to the data value.
155  TLevel& SetLevel(void);
156 
157  /// Check if a value has been assigned to Message data member.
158  ///
159  /// Data member Message is mandatory;
160  /// its type is defined as 'typedef string TMessage'
161  /// @return
162  /// - true, if a value has been assigned.
163  /// - false, otherwise.
164  bool IsSetMessage(void) const;
165 
166  /// Check if it is safe to call GetMessage method.
167  ///
168  /// @return
169  /// - true, if the data member is getatable.
170  /// - false, otherwise.
171  bool CanGetMessage(void) const;
172 
173  /// Reset Message data member.
174  void ResetMessage(void);
175 
176  /// Get the Message member data.
177  ///
178  /// @return
179  /// Reference to the member data.
180  const TMessage& GetMessage(void) const;
181 
182  /// Assign a value to Message data member.
183  ///
184  /// @param value
185  /// Value to assign
186  void SetMessage(const TMessage& value);
187  void SetMessage(TMessage&& value);
188 
189  /// Assign a value to Message data member.
190  ///
191  /// @return
192  /// Reference to the data value.
193  TMessage& SetMessage(void);
194 
195  /// Check if a value has been assigned to Taxid data member.
196  ///
197  /// Data member Taxid is optional;
198  /// its type is defined as 'typedef int TTaxid'
199  /// @return
200  /// - true, if a value has been assigned.
201  /// - false, otherwise.
202  bool IsSetTaxid(void) const;
203 
204  /// Check if it is safe to call GetTaxid method.
205  ///
206  /// @return
207  /// - true, if the data member is getatable.
208  /// - false, otherwise.
209  bool CanGetTaxid(void) const;
210 
211  /// Reset Taxid data member.
212  void ResetTaxid(void);
213 
214  /// Get the Taxid member data.
215  ///
216  /// @return
217  /// Copy of the member data.
218  TTaxid GetTaxid(void) const;
219 
220  /// Assign a value to Taxid data member.
221  ///
222  /// @param value
223  /// Value to assign
224  void SetTaxid(TTaxid value);
225 
226  /// Assign a value to Taxid data member.
227  ///
228  /// @return
229  /// Reference to the data value.
230  TTaxid& SetTaxid(void);
231 
232  /// Check if a value has been assigned to Name data member.
233  ///
234  /// Data member Name is optional;
235  /// its type is defined as 'typedef string TName'
236  /// @return
237  /// - true, if a value has been assigned.
238  /// - false, otherwise.
239  bool IsSetName(void) const;
240 
241  /// Check if it is safe to call GetName method.
242  ///
243  /// @return
244  /// - true, if the data member is getatable.
245  /// - false, otherwise.
246  bool CanGetName(void) const;
247 
248  /// Reset Name data member.
249  void ResetName(void);
250 
251  /// Get the Name member data.
252  ///
253  /// @return
254  /// Reference to the member data.
255  const TName& GetName(void) const;
256 
257  /// Assign a value to Name data member.
258  ///
259  /// @param value
260  /// Value to assign
261  void SetName(const TName& value);
262  void SetName(TName&& value);
263 
264  /// Assign a value to Name data member.
265  ///
266  /// @return
267  /// Reference to the data value.
268  TName& SetName(void);
269 
270  /// Check if a value has been assigned to Org data member.
271  ///
272  /// Data member Org is optional;
273  /// its type is defined as 'typedef COrg_ref TOrg'
274  /// @return
275  /// - true, if a value has been assigned.
276  /// - false, otherwise.
277  bool IsSetOrg(void) const;
278 
279  /// Check if it is safe to call GetOrg method.
280  ///
281  /// @return
282  /// - true, if the data member is getatable.
283  /// - false, otherwise.
284  bool CanGetOrg(void) const;
285 
286  /// Reset Org data member.
287  void ResetOrg(void);
288 
289  /// Get the Org member data.
290  ///
291  /// @return
292  /// Reference to the member data.
293  const TOrg& GetOrg(void) const;
294 
295  /// Assign a value to Org data member.
296  ///
297  /// @param value
298  /// Reference to value.
299  void SetOrg(TOrg& value);
300 
301  /// Assign a value to Org data member.
302  ///
303  /// @return
304  /// Reference to the data value.
305  TOrg& SetOrg(void);
306 
307  /// Reset the whole object
308  virtual void Reset(void);
309 
310 
311 private:
312  // Prohibit copy constructor and assignment operator
315 
316  // data
317  Uint4 m_set_State[1];
319  string m_Message;
320  int m_Taxid;
321  string m_Name;
323 };
324 
325 /* @} */
326 
327 
328 
329 
330 
331 ///////////////////////////////////////////////////////////
332 ///////////////////// inline methods //////////////////////
333 ///////////////////////////////////////////////////////////
334 inline
336 {
337  return ((m_set_State[0] & 0x3) != 0);
338 }
339 
340 inline
342 {
343  return IsSetLevel();
344 }
345 
346 inline
348 {
349  m_Level = (ELevel)(0);
350  m_set_State[0] &= ~0x3;
351 }
352 
353 inline
355 {
356  if (!CanGetLevel()) {
357  ThrowUnassigned(0);
358  }
359  return m_Level;
360 }
361 
362 inline
364 {
365  m_Level = value;
366  m_set_State[0] |= 0x3;
367 }
368 
369 inline
371 {
372 #ifdef _DEBUG
373  if (!IsSetLevel()) {
374  memset(&m_Level,UnassignedByte(),sizeof(m_Level));
375  }
376 #endif
377  m_set_State[0] |= 0x1;
378  return m_Level;
379 }
380 
381 inline
383 {
384  return ((m_set_State[0] & 0xc) != 0);
385 }
386 
387 inline
389 {
390  return IsSetMessage();
391 }
392 
393 inline
395 {
396  if (!CanGetMessage()) {
397  ThrowUnassigned(1);
398  }
399  return m_Message;
400 }
401 
402 inline
404 {
405  m_Message = value;
406  m_set_State[0] |= 0xc;
407 }
408 
409 inline
411 {
412  m_Message = std::forward<CT3Error_Base::TMessage>(value);
413  m_set_State[0] |= 0xc;
414 }
415 
416 inline
418 {
419 #ifdef _DEBUG
420  if (!IsSetMessage()) {
422  }
423 #endif
424  m_set_State[0] |= 0x4;
425  return m_Message;
426 }
427 
428 inline
430 {
431  return ((m_set_State[0] & 0x30) != 0);
432 }
433 
434 inline
436 {
437  return IsSetTaxid();
438 }
439 
440 inline
442 {
443  m_Taxid = 0;
444  m_set_State[0] &= ~0x30;
445 }
446 
447 inline
449 {
450  if (!CanGetTaxid()) {
451  ThrowUnassigned(2);
452  }
453  return m_Taxid;
454 }
455 
456 inline
458 {
459  m_Taxid = value;
460  m_set_State[0] |= 0x30;
461 }
462 
463 inline
465 {
466 #ifdef _DEBUG
467  if (!IsSetTaxid()) {
468  memset(&m_Taxid,UnassignedByte(),sizeof(m_Taxid));
469  }
470 #endif
471  m_set_State[0] |= 0x10;
472  return m_Taxid;
473 }
474 
475 inline
476 bool CT3Error_Base::IsSetName(void) const
477 {
478  return ((m_set_State[0] & 0xc0) != 0);
479 }
480 
481 inline
483 {
484  return IsSetName();
485 }
486 
487 inline
489 {
490  if (!CanGetName()) {
491  ThrowUnassigned(3);
492  }
493  return m_Name;
494 }
495 
496 inline
498 {
499  m_Name = value;
500  m_set_State[0] |= 0xc0;
501 }
502 
503 inline
505 {
506  m_Name = std::forward<CT3Error_Base::TName>(value);
507  m_set_State[0] |= 0xc0;
508 }
509 
510 inline
512 {
513 #ifdef _DEBUG
514  if (!IsSetName()) {
516  }
517 #endif
518  m_set_State[0] |= 0x40;
519  return m_Name;
520 }
521 
522 inline
523 bool CT3Error_Base::IsSetOrg(void) const
524 {
525  return m_Org.NotEmpty();
526 }
527 
528 inline
529 bool CT3Error_Base::CanGetOrg(void) const
530 {
531  return IsSetOrg();
532 }
533 
534 inline
536 {
537  if (!CanGetOrg()) {
538  ThrowUnassigned(4);
539  }
540  return (*m_Org);
541 }
542 
543 ///////////////////////////////////////////////////////////
544 ////////////////// end of inline methods //////////////////
545 ///////////////////////////////////////////////////////////
546 
547 
548 
549 
550 
551 END_objects_SCOPE // namespace ncbi::objects::
552 
554 
555 
556 #endif // OBJECTS_TAXON3_T3ERROR_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
CT3Error_Base –.
Definition: T3Error_.hpp:77
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_TAXON3_EXPORT
Definition: ncbi_export.h:865
CRef< TOrg > m_Org
Definition: T3Error_.hpp:322
TLevel GetLevel(void) const
Get the Level member data.
Definition: T3Error_.hpp:354
bool CanGetName(void) const
Check if it is safe to call GetName method.
Definition: T3Error_.hpp:482
void ResetLevel(void)
Reset Level data member.
Definition: T3Error_.hpp:347
string m_Message
Definition: T3Error_.hpp:319
string m_Name
Definition: T3Error_.hpp:321
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
Definition: T3Error_.hpp:523
void ResetTaxid(void)
Reset Taxid data member.
Definition: T3Error_.hpp:441
CT3Error_Base(const CT3Error_Base &)
bool IsSetLevel(void) const
Check if a value has been assigned to Level data member.
Definition: T3Error_.hpp:335
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
Definition: T3Error_.hpp:476
ELevel m_Level
Definition: T3Error_.hpp:318
CSerialObject Tparent
Definition: T3Error_.hpp:78
TName & SetName(void)
Assign a value to Name data member.
Definition: T3Error_.hpp:511
bool IsSetTaxid(void) const
Check if a value has been assigned to Taxid data member.
Definition: T3Error_.hpp:429
bool CanGetLevel(void) const
Check if it is safe to call GetLevel method.
Definition: T3Error_.hpp:341
TLevel & SetLevel(void)
Assign a value to Level data member.
Definition: T3Error_.hpp:370
COrg_ref TOrg
Definition: T3Error_.hpp:104
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: T3Error_.hpp:535
bool CanGetTaxid(void) const
Check if it is safe to call GetTaxid method.
Definition: T3Error_.hpp:435
ELevel TLevel
Definition: T3Error_.hpp:100
Uint4 m_set_State[1]
Definition: T3Error_.hpp:317
CT3Error_Base & operator=(const CT3Error_Base &)
const TName & GetName(void) const
Get the Name member data.
Definition: T3Error_.hpp:488
bool CanGetMessage(void) const
Check if it is safe to call GetMessage method.
Definition: T3Error_.hpp:388
bool CanGetOrg(void) const
Check if it is safe to call GetOrg method.
Definition: T3Error_.hpp:529
TMessage & SetMessage(void)
Assign a value to Message data member.
Definition: T3Error_.hpp:417
TTaxid & SetTaxid(void)
Assign a value to Taxid data member.
Definition: T3Error_.hpp:464
string TMessage
Definition: T3Error_.hpp:101
DECLARE_INTERNAL_TYPE_INFO()
string TName
Definition: T3Error_.hpp:103
TTaxid GetTaxid(void) const
Get the Taxid member data.
Definition: T3Error_.hpp:448
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
Definition: T3Error_.hpp:115
const TMessage & GetMessage(void) const
Get the Message member data.
Definition: T3Error_.hpp:394
bool IsSetMessage(void) const
Check if a value has been assigned to Message data member.
Definition: T3Error_.hpp:382
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Mon Jul 15 05:34:44 2024 by modify_doxy.py rev. 669887