NCBI C++ ToolKit
Keyword_.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 Keyword_.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/eutils/efetch/efetch.xsd">efetch.xsd</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/eutils/efetch/efetch.def">efetch.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 eutils__OBJTOOLS_EUTILS_EFETCH_KEYWORD_BASE_HPP
42 #define eutils__OBJTOOLS_EUTILS_EFETCH_KEYWORD_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
49 #include <string>
51 
52 #ifndef BEGIN_eutils_SCOPE
53 # define BEGIN_eutils_SCOPE BEGIN_SCOPE(eutils)
54 # define END_eutils_SCOPE END_SCOPE(eutils)
55 #endif
56 BEGIN_eutils_SCOPE // namespace eutils::
57 
58 
59 // forward declarations
60 class CMath;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_efetch
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CKeyword_Base --
74 ///
75 
76 class CKeyword_Base : public NCBI_NS_NCBI::CSerialObject
77 {
78  typedef NCBI_NS_NCBI::CSerialObject Tparent;
79 public:
80  // constructor
82  // destructor
83  virtual ~CKeyword_Base(void);
84 
85  // type info
87 
88  /////////////////////////////////////////////////////////////////////////////
89  ///
90  /// C_Attlist --
91  ///
92 
93  class C_Attlist : public NCBI_NS_NCBI::CSerialObject
94  {
95  typedef NCBI_NS_NCBI::CSerialObject Tparent;
96  public:
97  // constructor
98  C_Attlist(void);
99  // destructor
100  ~C_Attlist(void);
101 
102  // type info
104 
108  };
109 
110  /// Access to EAttlist_MajorTopicYN's attributes (values, names) as defined in spec
111  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(EAttlist_MajorTopicYN)(void);
112 
113  // types
115 
116  // member index
117  enum class E_memberIndex {
118  e__allMandatory = 0,
120  };
121  typedef Tparent::CMemberIndex<E_memberIndex, 2> TmemberIndex;
122 
123  // getters
124  // setters
125 
126  /// Check if a value has been assigned to MajorTopicYN data member.
127  ///
128  /// Data member MajorTopicYN is optional with default eAttlist_MajorTopicYN_N;
129  /// its type is defined as 'typedef EAttlist_MajorTopicYN TMajorTopicYN'
130  /// @return
131  /// - true, if a value has been assigned.
132  /// - false, otherwise.
133  bool IsSetMajorTopicYN(void) const;
134 
135  /// Check if it is safe to call GetMajorTopicYN method.
136  ///
137  /// @return
138  /// - true, if the data member is getatable.
139  /// - false, otherwise.
140  bool CanGetMajorTopicYN(void) const;
141 
142  /// Reset MajorTopicYN data member.
143  void ResetMajorTopicYN(void);
144 
145  /// Assign default value to MajorTopicYN data member.
146  void SetDefaultMajorTopicYN(void);
147 
148  /// Get the MajorTopicYN member data.
149  ///
150  /// @return
151  /// Copy of the member data.
152  TMajorTopicYN GetMajorTopicYN(void) const;
153 
154  /// Assign a value to MajorTopicYN data member.
155  ///
156  /// @param value
157  /// Value to assign
159 
160  /// Assign a value to MajorTopicYN data member.
161  ///
162  /// @return
163  /// Reference to the data value.
165 
166  /// Reset the whole object
167  void Reset(void);
168 
169 
170  private:
171  // Prohibit copy constructor and assignment operator
174 
175  // data
178  };
179  /////////////////////////////////////////////////////////////////////////////
180  ///
181  /// C_E_Keyword --
182  ///
183 
184  class C_E_Keyword : public NCBI_NS_NCBI::CSerialObject
185  {
186  typedef NCBI_NS_NCBI::CSerialObject Tparent;
187  public:
188  // constructor
189  C_E_Keyword(void);
190  // destructor
191  ~C_E_Keyword(void);
192 
193  // type info
195 
196  typedef CText C_Text;
197 
198  /// Choice variants.
199  enum E_Choice {
200  e_not_set = 0, ///< No variant selected
203  e_Math
204  };
205  /// Maximum+1 value of the choice variant enumerator.
207  e_MaxChoice = 4 ///< == e_Math+1
208  };
209 
210  /// Reset the whole object
211  void Reset(void);
212 
213  /// Reset the selection (set it to e_not_set).
214  void ResetSelection(void);
215 
216  /// Which variant is currently selected.
217  ///
218  /// @return
219  /// Choice state enumerator.
220  E_Choice Which(void) const;
221 
222  /// Verify selection, throw exception if it differs from the expected.
223  ///
224  /// @param index
225  /// Expected selection.
226  void CheckSelected(E_Choice index) const;
227 
228  /// Throw 'InvalidSelection' exception.
229  ///
230  /// @param index
231  /// Expected selection.
232  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
233 
234  /// Retrieve selection name (for diagnostic purposes).
235  ///
236  /// @param index
237  /// One of possible selection states.
238  /// @return
239  /// Name string.
241 
242  /// Select the requested variant if needed.
243  ///
244  /// @param index
245  /// New selection state.
246  /// @param reset
247  /// Flag that defines the resetting of the variant data. The data will
248  /// be reset if either the current selection differs from the new one,
249  /// or the flag is set to eDoResetVariant.
251  /// Select the requested variant if needed,
252  /// allocating CObject variants from memory pool.
253  void Select(E_Choice index,
255  NCBI_NS_NCBI::CObjectMemoryPool* pool);
256 
257  // types
259  typedef C_Text TText;
260  typedef CMath TMath;
261 
262  // getters
263  // setters
264 
265 
266  /// Check if variant _CharData is selected.
267  ///
268  /// _CharData type is defined as 'typedef NCBI_NS_STD::string T_CharData'.
269  /// @return
270  /// - true, if the variant is selected.
271  /// - false, otherwise.
272  bool Is_CharData(void) const;
273 
274  /// Get the variant data.
275  ///
276  /// @return
277  /// Reference to the data.
278  const T_CharData& Get_CharData(void) const;
279 
280  /// Select the variant.
281  ///
282  /// @return
283  /// Reference to the variant data.
284  T_CharData& Set_CharData(void);
285 
286  /// Select the variant and set its data.
287  ///
288  /// @param value
289  /// Variant data.
290  void Set_CharData(const T_CharData& value);
291 
292 
293  /// Check if variant Text is selected.
294  ///
295  /// Text type is defined as 'typedef C_Text TText'.
296  /// @return
297  /// - true, if the variant is selected.
298  /// - false, otherwise.
299  bool IsText(void) const;
300 
301  /// Get the variant data.
302  ///
303  /// @return
304  /// Reference to the data.
305  const TText& GetText(void) const;
306 
307  /// Select the variant.
308  ///
309  /// @return
310  /// Reference to the variant data.
311  TText& SetText(void);
312  /// Select the variant and set its data.
313  ///
314  /// @param value
315  /// Reference to the data.
316  void SetText(TText& value);
317 
318 
319  /// Check if variant Math is selected.
320  ///
321  /// Math type is defined as 'typedef CMath TMath'.
322  /// @return
323  /// - true, if the variant is selected.
324  /// - false, otherwise.
325  bool IsMath(void) const;
326 
327  /// Get the variant data.
328  ///
329  /// @return
330  /// Reference to the data.
331  const TMath& GetMath(void) const;
332 
333  /// Select the variant.
334  ///
335  /// @return
336  /// Reference to the variant data.
337  TMath& SetMath(void);
338  /// Select the variant and set its data.
339  ///
340  /// @param value
341  /// Reference to the data.
342  void SetMath(TMath& value);
343 
344 
345  private:
346  // copy constructor and assignment operator
349  // choice state
351  // helper methods
352  void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool = 0);
353 
354  static const char* const sm_SelectionNames[];
355  // data
356  union {
357  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
358  NCBI_NS_NCBI::CSerialObject *m_object;
359  };
360  };
361  // types
363  typedef C_E_Keyword C_E;
364  typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > TKeyword;
365 
366  // member index
367  enum class E_memberIndex {
368  e__allMandatory = 0,
369  e_Attlist,
370  e_Keyword
371  };
372  typedef Tparent::CMemberIndex<E_memberIndex, 3> TmemberIndex;
373 
374  // getters
375  // setters
376 
377  /// Check if a value has been assigned to Attlist data member.
378  ///
379  /// Data member Attlist is mandatory;
380  /// its type is defined as 'typedef C_Attlist TAttlist'
381  /// @return
382  /// - true, if a value has been assigned.
383  /// - false, otherwise.
384  bool IsSetAttlist(void) const;
385 
386  /// Check if it is safe to call GetAttlist method.
387  ///
388  /// @return
389  /// - true, if the data member is getatable.
390  /// - false, otherwise.
391  bool CanGetAttlist(void) const;
392 
393  /// Reset Attlist data member.
394  void ResetAttlist(void);
395 
396  /// Get the Attlist member data.
397  ///
398  /// @return
399  /// Reference to the member data.
400  const TAttlist& GetAttlist(void) const;
401 
402  /// Assign a value to Attlist data member.
403  ///
404  /// @param value
405  /// Reference to value.
407 
408  /// Assign a value to Attlist data member.
409  ///
410  /// @return
411  /// Reference to the data value.
412  TAttlist& SetAttlist(void);
413 
414  /// Check if a value has been assigned to Keyword data member.
415  ///
416  /// Data member Keyword is optional;
417  /// its type is defined as 'typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > TKeyword'
418  /// @return
419  /// - true, if a value has been assigned.
420  /// - false, otherwise.
421  bool IsSetKeyword(void) const;
422 
423  /// Check if it is safe to call GetKeyword method.
424  ///
425  /// @return
426  /// - true, if the data member is getatable.
427  /// - false, otherwise.
428  bool CanGetKeyword(void) const;
429 
430  /// Reset Keyword data member.
431  void ResetKeyword(void);
432 
433  /// Get the Keyword member data.
434  ///
435  /// @return
436  /// Reference to the member data.
437  const TKeyword& GetKeyword(void) const;
438 
439  /// Assign a value to Keyword data member.
440  ///
441  /// @return
442  /// Reference to the data value.
444 
445  /// Reset the whole object
446  virtual void Reset(void);
447 
448 
449 private:
450  // Prohibit copy constructor and assignment operator
453 
454  // data
456  NCBI_NS_NCBI::CRef< TAttlist > m_Attlist;
457  NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > m_Keyword;
458 };
459 
460 /* @} */
461 
462 
463 
464 
465 
466 ///////////////////////////////////////////////////////////
467 ///////////////////// inline methods //////////////////////
468 ///////////////////////////////////////////////////////////
469 inline
471 {
472  return ((m_set_State[0] & 0x3) != 0);
473 }
474 
475 inline
477 {
478  return true;
479 }
480 
481 inline
483 {
484  m_MajorTopicYN = eAttlist_MajorTopicYN_N;
485  m_set_State[0] &= ~0x3;
486 }
487 
488 inline
490 {
491  ResetMajorTopicYN();
492  m_set_State[0] |= 0x1;
493 }
494 
495 inline
497 {
498  return m_MajorTopicYN;
499 }
500 
501 inline
503 {
504  m_MajorTopicYN = value;
505  m_set_State[0] |= 0x3;
506 }
507 
508 inline
510 {
511 #ifdef _DEBUG
512  if (!IsSetMajorTopicYN()) {
513  memset(&m_MajorTopicYN,UnassignedByte(),sizeof(m_MajorTopicYN));
514  }
515 #endif
516  m_set_State[0] |= 0x1;
517  return m_MajorTopicYN;
518 }
519 
520 inline
522 {
523  return m_choice;
524 }
525 
526 inline
528 {
529  if ( m_choice != index )
530  ThrowInvalidSelection(index);
531 }
532 
533 inline
534 void CKeyword_Base::C_E_Keyword::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
535 {
536  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
537  if ( m_choice != e_not_set )
538  ResetSelection();
539  DoSelect(index, pool);
540  }
541 }
542 
543 inline
545 {
546  Select(index, reset, 0);
547 }
548 
549 inline
551 {
552  return m_choice == e__CharData;
553 }
554 
555 inline
557 {
558  CheckSelected(e__CharData);
559  return *m_string;
560 }
561 
562 inline
564 {
565  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
566  return *m_string;
567 }
568 
569 inline
571 {
572  return m_choice == e_Text;
573 }
574 
575 inline
577 {
578  return m_choice == e_Math;
579 }
580 
581 inline
583 {
584  return m_Attlist.NotEmpty();
585 }
586 
587 inline
589 {
590  return true;
591 }
592 
593 inline
595 {
596  if ( !m_Attlist ) {
597  const_cast<CKeyword_Base*>(this)->ResetAttlist();
598  }
599  return (*m_Attlist);
600 }
601 
602 inline
604 {
605  if ( !m_Attlist ) {
606  ResetAttlist();
607  }
608  return (*m_Attlist);
609 }
610 
611 inline
612 bool CKeyword_Base::IsSetKeyword(void) const
613 {
614  return ((m_set_State[0] & 0xc) != 0);
615 }
616 
617 inline
618 bool CKeyword_Base::CanGetKeyword(void) const
619 {
620  return true;
621 }
622 
623 inline
625 {
626  return m_Keyword;
627 }
628 
629 inline
631 {
632  m_set_State[0] |= 0x4;
633  return m_Keyword;
634 }
635 
636 ///////////////////////////////////////////////////////////
637 ////////////////// end of inline methods //////////////////
638 ///////////////////////////////////////////////////////////
639 
640 
641 
642 
643 
644 END_eutils_SCOPE // namespace eutils::
645 
646 
647 #endif // eutils__OBJTOOLS_EUTILS_EFETCH_KEYWORD_BASE_HPP
User-defined methods of the data storage class.
C_Attlist –.
Definition: Keyword_.hpp:94
C_E_Keyword –.
Definition: Keyword_.hpp:185
ncbi: removed IsWebBootstrapper ncbi: removed JCPA
Definition: Keyword_.hpp:73
CMath –.
Definition: Math.hpp:66
CText –.
Definition: Text.hpp:64
char value[7]
Definition: config.c:431
string
Definition: cgiapp.hpp:687
EResetVariant
Definition: serialbase.hpp:76
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
CKeyword_Base & operator=(const CKeyword_Base &)
bool IsText(void) const
Check if variant Text is selected.
Definition: Keyword_.hpp:570
TAttlist & SetAttlist(void)
Assign a value to Attlist data member.
Definition: Keyword_.hpp:603
bool IsSetAttlist(void) const
Check if a value has been assigned to Attlist data member.
Definition: Keyword_.hpp:582
Tparent::CMemberIndex< E_memberIndex, 2 > TmemberIndex
Definition: Keyword_.hpp:121
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
Definition: Keyword_.hpp:372
NCBI_NS_NCBI::CSerialObject Tparent
Definition: Keyword_.hpp:78
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: Keyword_.cpp:109
NCBI_NS_NCBI::CSerialObject Tparent
Definition: Keyword_.hpp:95
TText & SetText(void)
Select the variant.
Definition: Keyword_.cpp:156
TMath & SetMath(void)
Select the variant.
Definition: Keyword_.cpp:178
C_Attlist TAttlist
Definition: Keyword_.hpp:362
bool Is_CharData(void) const
Check if variant _CharData is selected.
Definition: Keyword_.hpp:550
bool CanGetKeyword(void) const
Check if it is safe to call GetKeyword method.
TKeyword & SetKeyword(void)
Assign a value to Keyword data member.
void ResetMajorTopicYN(void)
Reset MajorTopicYN data member.
Definition: Keyword_.hpp:482
E_Choice
Choice variants.
Definition: Keyword_.hpp:199
C_E_Keyword(const C_E_Keyword &)
NCBI_NS_NCBI::CSerialObject Tparent
Definition: Keyword_.hpp:186
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > TKeyword
Definition: Keyword_.hpp:364
void ResetKeyword(void)
Reset Keyword data member.
EAttlist_MajorTopicYN TMajorTopicYN
Definition: Keyword_.hpp:114
Uint4 m_set_State[1]
Definition: Keyword_.hpp:455
bool CanGetMajorTopicYN(void) const
Check if it is safe to call GetMajorTopicYN method.
Definition: Keyword_.hpp:476
void SetAttlist(TAttlist &value)
Assign a value to Attlist data member.
void ResetAttlist(void)
Reset Attlist data member.
Definition: Keyword_.cpp:223
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
Definition: Keyword_.hpp:594
C_Attlist & operator=(const C_Attlist &)
T_CharData & Set_CharData(void)
Select the variant.
Definition: Keyword_.hpp:563
EAttlist_MajorTopicYN m_MajorTopicYN
Definition: Keyword_.hpp:177
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Keyword_.cpp:139
C_E_Keyword & operator=(const C_E_Keyword &)
CKeyword_Base(void)
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Keyword_.cpp:93
const TText & GetText(void) const
Get the variant data.
Definition: Keyword_.cpp:150
bool IsMath(void) const
Check if variant Math is selected.
Definition: Keyword_.hpp:576
TMajorTopicYN GetMajorTopicYN(void) const
Get the MajorTopicYN member data.
Definition: Keyword_.hpp:496
CKeyword_Base(const CKeyword_Base &)
C_Attlist(const C_Attlist &)
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Keyword_.cpp:134
virtual ~CKeyword_Base(void)
Definition: Keyword_.cpp:271
bool IsSetKeyword(void) const
Check if a value has been assigned to Keyword data member.
void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:87
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Keyword_.hpp:358
void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:58
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Keyword_.hpp:206
C_E_Keyword C_E
Definition: Keyword_.hpp:363
NCBI_NS_STD::string T_CharData
Definition: Keyword_.hpp:258
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Keyword_.hpp:527
const TKeyword & GetKeyword(void) const
Get the Keyword member data.
TMajorTopicYN & SetMajorTopicYN(void)
Assign a value to MajorTopicYN data member.
Definition: Keyword_.hpp:509
virtual void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:243
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
Definition: Keyword_.hpp:544
DECLARE_INTERNAL_TYPE_INFO()
const T_CharData & Get_CharData(void) const
Get the variant data.
Definition: Keyword_.hpp:556
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > m_Keyword
Definition: Keyword_.hpp:457
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Keyword_.hpp:357
NCBI_NS_NCBI::CRef< TAttlist > m_Attlist
Definition: Keyword_.hpp:456
bool CanGetAttlist(void) const
Check if it is safe to call GetAttlist method.
Definition: Keyword_.hpp:588
const TMath & GetMath(void) const
Get the variant data.
Definition: Keyword_.cpp:172
E_Choice Which(void) const
Which variant is currently selected.
Definition: Keyword_.hpp:521
static const char *const sm_SelectionNames[]
Definition: Keyword_.hpp:354
void SetDefaultMajorTopicYN(void)
Assign default value to MajorTopicYN data member.
Definition: Keyword_.hpp:489
bool IsSetMajorTopicYN(void) const
Check if a value has been assigned to MajorTopicYN data member.
Definition: Keyword_.hpp:470
@ e_not_set
No variant selected.
Definition: Keyword_.hpp:200
const TKeyword & GetKeyword(void) const
Definition: Keyword_.hpp:92
bool CanGetKeyword(void) const
Definition: Keyword_.hpp:86
Tparent::TStringPropertyType TKeyword
Definition: Keyword_.hpp:82
TKeyword & SetKeyword(void)
Definition: Keyword_.hpp:95
bool IsSetKeyword(void) const
Definition: Keyword_.hpp:83
@ e_not_set
#define BEGIN_eutils_SCOPE
Definition: Keyword_.hpp:53
#define END_eutils_SCOPE
Definition: Keyword_.hpp:54
Modified on Mon Mar 04 05:10:11 2024 by modify_doxy.py rev. 669887