NCBI C++ ToolKit
TaxElement_.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 TaxElement_.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/seqfeat/seqfeat.asn">seqfeat.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqfeat/seqfeat.def">seqfeat.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_SEQFEAT_TAXELEMENT_BASE_HPP
42 #define OBJECTS_SEQFEAT_TAXELEMENT_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_Organism
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CTaxElement_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CTaxElement_Base(void);
78  // destructor
79  virtual ~CTaxElement_Base(void);
80 
81  // type info
83 
84  enum EFixed_level {
85  eFixed_level_other = 0, ///< level must be set in string
86  eFixed_level_family = 1,
87  eFixed_level_order = 2,
88  eFixed_level_class = 3
89  };
90 
91  /// Access to EFixed_level's attributes (values, names) as defined in spec
92  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(EFixed_level)(void);
93 
94  // types
95  typedef int TFixed_level;
96  typedef string TLevel;
97  typedef string TName;
98 
99  // member index
100  enum class E_memberIndex {
101  e__allMandatory = 0,
102  e_fixed_level,
103  e_level,
104  e_name
105  };
107 
108  // getters
109  // setters
110 
111  /// Check if a value has been assigned to Fixed_level data member.
112  ///
113  /// Data member Fixed_level is mandatory;
114  /// its type is defined as 'typedef int TFixed_level'
115  /// @return
116  /// - true, if a value has been assigned.
117  /// - false, otherwise.
118  bool IsSetFixed_level(void) const;
119 
120  /// Check if it is safe to call GetFixed_level method.
121  ///
122  /// @return
123  /// - true, if the data member is getatable.
124  /// - false, otherwise.
125  bool CanGetFixed_level(void) const;
126 
127  /// Reset Fixed_level data member.
128  void ResetFixed_level(void);
129 
130  /// Get the Fixed_level member data.
131  ///
132  /// @return
133  /// Copy of the member data.
134  TFixed_level GetFixed_level(void) const;
135 
136  /// Assign a value to Fixed_level data member.
137  ///
138  /// @param value
139  /// Value to assign
140  void SetFixed_level(TFixed_level value);
141 
142  /// Assign a value to Fixed_level data member.
143  ///
144  /// @return
145  /// Reference to the data value.
146  TFixed_level& SetFixed_level(void);
147 
148  /// Check if a value has been assigned to Level data member.
149  ///
150  /// Data member Level is optional;
151  /// its type is defined as 'typedef string TLevel'
152  /// @return
153  /// - true, if a value has been assigned.
154  /// - false, otherwise.
155  bool IsSetLevel(void) const;
156 
157  /// Check if it is safe to call GetLevel method.
158  ///
159  /// @return
160  /// - true, if the data member is getatable.
161  /// - false, otherwise.
162  bool CanGetLevel(void) const;
163 
164  /// Reset Level data member.
165  void ResetLevel(void);
166 
167  /// Get the Level member data.
168  ///
169  /// @return
170  /// Reference to the member data.
171  const TLevel& GetLevel(void) const;
172 
173  /// Assign a value to Level data member.
174  ///
175  /// @param value
176  /// Value to assign
177  void SetLevel(const TLevel& value);
178  void SetLevel(TLevel&& value);
179 
180  /// Assign a value to Level data member.
181  ///
182  /// @return
183  /// Reference to the data value.
184  TLevel& SetLevel(void);
185 
186  /// Check if a value has been assigned to Name data member.
187  ///
188  /// Data member Name is mandatory;
189  /// its type is defined as 'typedef string TName'
190  /// @return
191  /// - true, if a value has been assigned.
192  /// - false, otherwise.
193  bool IsSetName(void) const;
194 
195  /// Check if it is safe to call GetName method.
196  ///
197  /// @return
198  /// - true, if the data member is getatable.
199  /// - false, otherwise.
200  bool CanGetName(void) const;
201 
202  /// Reset Name data member.
203  void ResetName(void);
204 
205  /// Get the Name member data.
206  ///
207  /// @return
208  /// Reference to the member data.
209  const TName& GetName(void) const;
210 
211  /// Assign a value to Name data member.
212  ///
213  /// @param value
214  /// Value to assign
215  void SetName(const TName& value);
216  void SetName(TName&& value);
217 
218  /// Assign a value to Name data member.
219  ///
220  /// @return
221  /// Reference to the data value.
222  TName& SetName(void);
223 
224  /// Reset the whole object
225  virtual void Reset(void);
226 
227 
228 private:
229  // Prohibit copy constructor and assignment operator
232 
233  // data
234  Uint4 m_set_State[1];
236  string m_Level;
237  string m_Name;
238 };
239 
240 /* @} */
241 
242 
243 
244 
245 
246 ///////////////////////////////////////////////////////////
247 ///////////////////// inline methods //////////////////////
248 ///////////////////////////////////////////////////////////
249 inline
251 {
252  return ((m_set_State[0] & 0x3) != 0);
253 }
254 
255 inline
257 {
258  return IsSetFixed_level();
259 }
260 
261 inline
263 {
265  m_set_State[0] &= ~0x3;
266 }
267 
268 inline
270 {
271  if (!CanGetFixed_level()) {
272  ThrowUnassigned(0);
273  }
274  return m_Fixed_level;
275 }
276 
277 inline
279 {
281  m_set_State[0] |= 0x3;
282 }
283 
284 inline
286 {
287 #ifdef _DEBUG
288  if (!IsSetFixed_level()) {
289  memset(&m_Fixed_level,UnassignedByte(),sizeof(m_Fixed_level));
290  }
291 #endif
292  m_set_State[0] |= 0x1;
293  return m_Fixed_level;
294 }
295 
296 inline
298 {
299  return ((m_set_State[0] & 0xc) != 0);
300 }
301 
302 inline
304 {
305  return IsSetLevel();
306 }
307 
308 inline
310 {
311  if (!CanGetLevel()) {
312  ThrowUnassigned(1);
313  }
314  return m_Level;
315 }
316 
317 inline
319 {
320  m_Level = value;
321  m_set_State[0] |= 0xc;
322 }
323 
324 inline
326 {
327  m_Level = std::forward<CTaxElement_Base::TLevel>(value);
328  m_set_State[0] |= 0xc;
329 }
330 
331 inline
333 {
334 #ifdef _DEBUG
335  if (!IsSetLevel()) {
337  }
338 #endif
339  m_set_State[0] |= 0x4;
340  return m_Level;
341 }
342 
343 inline
345 {
346  return ((m_set_State[0] & 0x30) != 0);
347 }
348 
349 inline
351 {
352  return IsSetName();
353 }
354 
355 inline
357 {
358  if (!CanGetName()) {
359  ThrowUnassigned(2);
360  }
361  return m_Name;
362 }
363 
364 inline
366 {
367  m_Name = value;
368  m_set_State[0] |= 0x30;
369 }
370 
371 inline
373 {
374  m_Name = std::forward<CTaxElement_Base::TName>(value);
375  m_set_State[0] |= 0x30;
376 }
377 
378 inline
380 {
381 #ifdef _DEBUG
382  if (!IsSetName()) {
384  }
385 #endif
386  m_set_State[0] |= 0x10;
387  return m_Name;
388 }
389 
390 ///////////////////////////////////////////////////////////
391 ////////////////// end of inline methods //////////////////
392 ///////////////////////////////////////////////////////////
393 
394 
395 
396 
397 
398 END_objects_SCOPE // namespace ncbi::objects::
399 
401 
402 
403 #endif // OBJECTS_SEQFEAT_TAXELEMENT_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTaxElement_Base –.
Definition: TaxElement_.hpp:73
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_SEQFEAT_EXPORT
Definition: ncbi_export.h:768
bool CanGetLevel(void) const
Check if it is safe to call GetLevel method.
CTaxElement_Base & operator=(const CTaxElement_Base &)
TFixed_level GetFixed_level(void) const
Get the Fixed_level member data.
TName & SetName(void)
Assign a value to Name data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
bool IsSetFixed_level(void) const
Check if a value has been assigned to Fixed_level data member.
CTaxElement_Base(const CTaxElement_Base &)
bool CanGetFixed_level(void) const
Check if it is safe to call GetFixed_level method.
bool CanGetName(void) const
Check if it is safe to call GetName method.
const TLevel & GetLevel(void) const
Get the Level member data.
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
TFixed_level & SetFixed_level(void)
Assign a value to Fixed_level data member.
const TName & GetName(void) const
Get the Name member data.
Uint4 m_set_State[1]
bool IsSetLevel(void) const
Check if a value has been assigned to Level data member.
void ResetFixed_level(void)
Reset Fixed_level data member.
CSerialObject Tparent
Definition: TaxElement_.hpp:74
TLevel & SetLevel(void)
Assign a value to Level data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat May 25 14:20:18 2024 by modify_doxy.py rev. 669887