NCBI C++ ToolKit
Entrez2_term_.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 Entrez2_term_.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/entrez2/entrez2.asn">entrez2.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/entrez2/entrez2.def">entrez2.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_ENTREZ2_ENTREZ2_TERM_BASE_HPP
42 #define OBJECTS_ENTREZ2_ENTREZ2_TERM_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_Entrez2
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CEntrez2_term_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CEntrez2_term_Base(void);
78  // destructor
79  virtual ~CEntrez2_term_Base(void);
80 
81  // type info
83 
84  // types
85  typedef string TTerm;
87  typedef int TCount;
88  typedef bool TIs_leaf_node;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_term,
94  e_txid,
95  e_count,
96  e_is_leaf_node
97  };
99 
100  // getters
101  // setters
102 
103  /// Check if a value has been assigned to Term data member.
104  ///
105  /// Data member Term is mandatory;
106  /// its type is defined as 'typedef string TTerm'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetTerm(void) const;
111 
112  /// Check if it is safe to call GetTerm method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetTerm(void) const;
118 
119  /// Reset Term data member.
120  void ResetTerm(void);
121 
122  /// Get the Term member data.
123  ///
124  /// @return
125  /// Reference to the member data.
126  const TTerm& GetTerm(void) const;
127 
128  /// Assign a value to Term data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetTerm(const TTerm& value);
133  void SetTerm(TTerm&& value);
134 
135  /// Assign a value to Term data member.
136  ///
137  /// @return
138  /// Reference to the data value.
139  TTerm& SetTerm(void);
140 
141  /// Check if a value has been assigned to Txid data member.
142  ///
143  /// Data member Txid is optional;
144  /// its type is defined as 'typedef NCBI_NS_NCBI::TEntrezId TTxid'
145  /// @return
146  /// - true, if a value has been assigned.
147  /// - false, otherwise.
148  bool IsSetTxid(void) const;
149 
150  /// Check if it is safe to call GetTxid method.
151  ///
152  /// @return
153  /// - true, if the data member is getatable.
154  /// - false, otherwise.
155  bool CanGetTxid(void) const;
156 
157  /// Reset Txid data member.
158  void ResetTxid(void);
159 
160  /// Get the Txid member data.
161  ///
162  /// @return
163  /// Copy of the member data.
164  TTxid GetTxid(void) const;
165 
166  /// Assign a value to Txid data member.
167  ///
168  /// @param value
169  /// Value to assign
170  void SetTxid(TTxid value);
171 
172  /// Assign a value to Txid data member.
173  ///
174  /// @return
175  /// Reference to the data value.
176  TTxid& SetTxid(void);
177 
178  /// count of records with this term
179  /// Check if a value has been assigned to Count data member.
180  ///
181  /// Data member Count is mandatory;
182  /// its type is defined as 'typedef int TCount'
183  /// @return
184  /// - true, if a value has been assigned.
185  /// - false, otherwise.
186  bool IsSetCount(void) const;
187 
188  /// Check if it is safe to call GetCount method.
189  ///
190  /// @return
191  /// - true, if the data member is getatable.
192  /// - false, otherwise.
193  bool CanGetCount(void) const;
194 
195  /// Reset Count data member.
196  void ResetCount(void);
197 
198  /// Get the Count member data.
199  ///
200  /// @return
201  /// Copy of the member data.
202  TCount GetCount(void) const;
203 
204  /// Assign a value to Count data member.
205  ///
206  /// @param value
207  /// Value to assign
208  void SetCount(TCount value);
209 
210  /// Assign a value to Count data member.
211  ///
212  /// @return
213  /// Reference to the data value.
214  TCount& SetCount(void);
215 
216  /// used for hierarchy only
217  /// Check if a value has been assigned to Is_leaf_node data member.
218  ///
219  /// Data member Is_leaf_node is optional;
220  /// its type is defined as 'typedef bool TIs_leaf_node'
221  /// @return
222  /// - true, if a value has been assigned.
223  /// - false, otherwise.
224  bool IsSetIs_leaf_node(void) const;
225 
226  /// Check if it is safe to call GetIs_leaf_node method.
227  ///
228  /// @return
229  /// - true, if the data member is getatable.
230  /// - false, otherwise.
231  bool CanGetIs_leaf_node(void) const;
232 
233  /// Reset Is_leaf_node data member.
234  void ResetIs_leaf_node(void);
235 
236  /// Get the Is_leaf_node member data.
237  ///
238  /// @return
239  /// Copy of the member data.
240  TIs_leaf_node GetIs_leaf_node(void) const;
241 
242  /// Assign a value to Is_leaf_node data member.
243  ///
244  /// @param value
245  /// Value to assign
246  void SetIs_leaf_node(TIs_leaf_node value);
247 
248  /// Assign a value to Is_leaf_node data member.
249  ///
250  /// @return
251  /// Reference to the data value.
252  TIs_leaf_node& SetIs_leaf_node(void);
253 
254  /// Reset the whole object
255  virtual void Reset(void);
256 
257 
258 private:
259  // Prohibit copy constructor and assignment operator
262 
263  // data
264  Uint4 m_set_State[1];
265  string m_Term;
267  int m_Count;
269 };
270 
271 /* @} */
272 
273 
274 
275 
276 
277 ///////////////////////////////////////////////////////////
278 ///////////////////// inline methods //////////////////////
279 ///////////////////////////////////////////////////////////
280 inline
282 {
283  return ((m_set_State[0] & 0x3) != 0);
284 }
285 
286 inline
288 {
289  return IsSetTerm();
290 }
291 
292 inline
294 {
295  if (!CanGetTerm()) {
296  ThrowUnassigned(0);
297  }
298  return m_Term;
299 }
300 
301 inline
303 {
304  m_Term = value;
305  m_set_State[0] |= 0x3;
306 }
307 
308 inline
310 {
311  m_Term = std::forward<CEntrez2_term_Base::TTerm>(value);
312  m_set_State[0] |= 0x3;
313 }
314 
315 inline
317 {
318 #ifdef _DEBUG
319  if (!IsSetTerm()) {
321  }
322 #endif
323  m_set_State[0] |= 0x1;
324  return m_Term;
325 }
326 
327 inline
329 {
330  return ((m_set_State[0] & 0xc) != 0);
331 }
332 
333 inline
335 {
336  return IsSetTxid();
337 }
338 
339 inline
341 {
342  m_Txid = 0;
343  m_set_State[0] &= ~0xc;
344 }
345 
346 inline
348 {
349  if (!CanGetTxid()) {
350  ThrowUnassigned(1);
351  }
352  return reinterpret_cast<const TTxid&>(m_Txid);
353 }
354 
355 inline
357 {
358  reinterpret_cast<TTxid&>(m_Txid) = value;
359  m_set_State[0] |= 0xc;
360 }
361 
362 inline
364 {
365 #ifdef _DEBUG
366  if (!IsSetTxid()) {
367  memset(&m_Txid,UnassignedByte(),sizeof(m_Txid));
368  }
369 #endif
370  m_set_State[0] |= 0x4;
371  return reinterpret_cast<TTxid&>(m_Txid);
372 }
373 
374 inline
376 {
377  return ((m_set_State[0] & 0x30) != 0);
378 }
379 
380 inline
382 {
383  return IsSetCount();
384 }
385 
386 inline
388 {
389  m_Count = 0;
390  m_set_State[0] &= ~0x30;
391 }
392 
393 inline
395 {
396  if (!CanGetCount()) {
397  ThrowUnassigned(2);
398  }
399  return m_Count;
400 }
401 
402 inline
404 {
405  m_Count = value;
406  m_set_State[0] |= 0x30;
407 }
408 
409 inline
411 {
412 #ifdef _DEBUG
413  if (!IsSetCount()) {
414  memset(&m_Count,UnassignedByte(),sizeof(m_Count));
415  }
416 #endif
417  m_set_State[0] |= 0x10;
418  return m_Count;
419 }
420 
421 inline
423 {
424  return ((m_set_State[0] & 0xc0) != 0);
425 }
426 
427 inline
429 {
430  return IsSetIs_leaf_node();
431 }
432 
433 inline
435 {
436  m_Is_leaf_node = 0;
437  m_set_State[0] &= ~0xc0;
438 }
439 
440 inline
442 {
443  if (!CanGetIs_leaf_node()) {
444  ThrowUnassigned(3);
445  }
446  return m_Is_leaf_node;
447 }
448 
449 inline
451 {
453  m_set_State[0] |= 0xc0;
454 }
455 
456 inline
458 {
459 #ifdef _DEBUG
460  if (!IsSetIs_leaf_node()) {
461  memset(&m_Is_leaf_node,UnassignedByte(),sizeof(m_Is_leaf_node));
462  }
463 #endif
464  m_set_State[0] |= 0x40;
465  return m_Is_leaf_node;
466 }
467 
468 ///////////////////////////////////////////////////////////
469 ////////////////// end of inline methods //////////////////
470 ///////////////////////////////////////////////////////////
471 
472 
473 
474 
475 
476 END_objects_SCOPE // namespace ncbi::objects::
477 
479 
480 
481 #endif // OBJECTS_ENTREZ2_ENTREZ2_TERM_BASE_HPP
CEntrez2_term_Base –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
Definition: ncbimisc.hpp:1041
Int8 TIntId
Definition: ncbimisc.hpp:999
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
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_ENTREZ2_EXPORT
Definition: ncbi_export.h:464
void ResetIs_leaf_node(void)
Reset Is_leaf_node data member.
const TTerm & GetTerm(void) const
Get the Term member data.
bool IsSetCount(void) const
count of records with this term Check if a value has been assigned to Count data member.
bool IsSetIs_leaf_node(void) const
used for hierarchy only Check if a value has been assigned to Is_leaf_node data member.
bool CanGetIs_leaf_node(void) const
Check if it is safe to call GetIs_leaf_node method.
TTxid GetTxid(void) const
Get the Txid member data.
bool CanGetTerm(void) const
Check if it is safe to call GetTerm method.
void ResetTxid(void)
Reset Txid data member.
void ResetCount(void)
Reset Count data member.
CSerialObject Tparent
CEntrez2_term_Base(const CEntrez2_term_Base &)
bool CanGetCount(void) const
Check if it is safe to call GetCount method.
Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
TTxid & SetTxid(void)
Assign a value to Txid data member.
TIs_leaf_node GetIs_leaf_node(void) const
Get the Is_leaf_node member data.
bool IsSetTerm(void) const
Check if a value has been assigned to Term data member.
TTerm & SetTerm(void)
Assign a value to Term data member.
NCBI_NS_NCBI::TEntrezId TTxid
CEntrez2_term_Base & operator=(const CEntrez2_term_Base &)
TIs_leaf_node & SetIs_leaf_node(void)
Assign a value to Is_leaf_node data member.
bool IsSetTxid(void) const
Check if a value has been assigned to Txid data member.
TCount GetCount(void) const
Get the Count member data.
bool CanGetTxid(void) const
Check if it is safe to call GetTxid method.
TCount & SetCount(void)
Assign a value to Count data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed May 29 18:38:46 2024 by modify_doxy.py rev. 669887