NCBI C++ ToolKit
ArticleTitle_.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 ArticleTitle_.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_ARTICLETITLE_BASE_HPP
42 #define eutils__OBJTOOLS_EUTILS_EFETCH_ARTICLETITLE_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 /// CArticleTitle_Base --
74 ///
75 
76 class CArticleTitle_Base : public NCBI_NS_NCBI::CSerialObject
77 {
78  typedef NCBI_NS_NCBI::CSerialObject Tparent;
79 public:
80  // constructor
81  CArticleTitle_Base(void);
82  // destructor
83  virtual ~CArticleTitle_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 
105  // types
109 
110  // member index
111  enum class E_memberIndex {
112  e__allMandatory = 0,
113  e_book,
114  e_part,
115  e_sec
116  };
117  typedef Tparent::CMemberIndex<E_memberIndex, 4> TmemberIndex;
118 
119  // getters
120  // setters
121 
122  /// Check if a value has been assigned to Book data member.
123  ///
124  /// Data member Book is optional;
125  /// its type is defined as 'typedef NCBI_NS_STD::string TBook'
126  /// @return
127  /// - true, if a value has been assigned.
128  /// - false, otherwise.
129  bool IsSetBook(void) const;
130 
131  /// Check if it is safe to call GetBook method.
132  ///
133  /// @return
134  /// - true, if the data member is getatable.
135  /// - false, otherwise.
136  bool CanGetBook(void) const;
137 
138  /// Reset Book data member.
139  void ResetBook(void);
140 
141  /// Get the Book member data.
142  ///
143  /// @return
144  /// Reference to the member data.
145  const TBook& GetBook(void) const;
146 
147  /// Assign a value to Book data member.
148  ///
149  /// @param value
150  /// Value to assign
151  void SetBook(const TBook& value);
152  void SetBook(TBook&& value);
153 
154  /// Assign a value to Book data member.
155  ///
156  /// @return
157  /// Reference to the data value.
158  TBook& SetBook(void);
159 
160  /// Check if a value has been assigned to Part data member.
161  ///
162  /// Data member Part is optional;
163  /// its type is defined as 'typedef NCBI_NS_STD::string TPart'
164  /// @return
165  /// - true, if a value has been assigned.
166  /// - false, otherwise.
167  bool IsSetPart(void) const;
168 
169  /// Check if it is safe to call GetPart method.
170  ///
171  /// @return
172  /// - true, if the data member is getatable.
173  /// - false, otherwise.
174  bool CanGetPart(void) const;
175 
176  /// Reset Part data member.
177  void ResetPart(void);
178 
179  /// Get the Part member data.
180  ///
181  /// @return
182  /// Reference to the member data.
183  const TPart& GetPart(void) const;
184 
185  /// Assign a value to Part data member.
186  ///
187  /// @param value
188  /// Value to assign
189  void SetPart(const TPart& value);
190  void SetPart(TPart&& value);
191 
192  /// Assign a value to Part data member.
193  ///
194  /// @return
195  /// Reference to the data value.
196  TPart& SetPart(void);
197 
198  /// Check if a value has been assigned to Sec data member.
199  ///
200  /// Data member Sec is optional;
201  /// its type is defined as 'typedef NCBI_NS_STD::string TSec'
202  /// @return
203  /// - true, if a value has been assigned.
204  /// - false, otherwise.
205  bool IsSetSec(void) const;
206 
207  /// Check if it is safe to call GetSec method.
208  ///
209  /// @return
210  /// - true, if the data member is getatable.
211  /// - false, otherwise.
212  bool CanGetSec(void) const;
213 
214  /// Reset Sec data member.
215  void ResetSec(void);
216 
217  /// Get the Sec member data.
218  ///
219  /// @return
220  /// Reference to the member data.
221  const TSec& GetSec(void) const;
222 
223  /// Assign a value to Sec data member.
224  ///
225  /// @param value
226  /// Value to assign
227  void SetSec(const TSec& value);
228  void SetSec(TSec&& value);
229 
230  /// Assign a value to Sec data member.
231  ///
232  /// @return
233  /// Reference to the data value.
234  TSec& SetSec(void);
235 
236  /// Reset the whole object
237  void Reset(void);
238 
239 
240  private:
241  // Prohibit copy constructor and assignment operator
244 
245  // data
250  };
251  /////////////////////////////////////////////////////////////////////////////
252  ///
253  /// C_E_ArticleTitle --
254  ///
255 
256  class C_E_ArticleTitle : public NCBI_NS_NCBI::CSerialObject
257  {
258  typedef NCBI_NS_NCBI::CSerialObject Tparent;
259  public:
260  // constructor
261  C_E_ArticleTitle(void);
262  // destructor
263  ~C_E_ArticleTitle(void);
264 
265  // type info
267 
268  typedef CText C_Text;
269 
270  /// Choice variants.
271  enum E_Choice {
272  e_not_set = 0, ///< No variant selected
275  e_Math
276  };
277  /// Maximum+1 value of the choice variant enumerator.
279  e_MaxChoice = 4 ///< == e_Math+1
280  };
281 
282  /// Reset the whole object
283  void Reset(void);
284 
285  /// Reset the selection (set it to e_not_set).
286  void ResetSelection(void);
287 
288  /// Which variant is currently selected.
289  ///
290  /// @return
291  /// Choice state enumerator.
292  E_Choice Which(void) const;
293 
294  /// Verify selection, throw exception if it differs from the expected.
295  ///
296  /// @param index
297  /// Expected selection.
298  void CheckSelected(E_Choice index) const;
299 
300  /// Throw 'InvalidSelection' exception.
301  ///
302  /// @param index
303  /// Expected selection.
304  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
305 
306  /// Retrieve selection name (for diagnostic purposes).
307  ///
308  /// @param index
309  /// One of possible selection states.
310  /// @return
311  /// Name string.
313 
314  /// Select the requested variant if needed.
315  ///
316  /// @param index
317  /// New selection state.
318  /// @param reset
319  /// Flag that defines the resetting of the variant data. The data will
320  /// be reset if either the current selection differs from the new one,
321  /// or the flag is set to eDoResetVariant.
323  /// Select the requested variant if needed,
324  /// allocating CObject variants from memory pool.
325  void Select(E_Choice index,
327  NCBI_NS_NCBI::CObjectMemoryPool* pool);
328 
329  // types
331  typedef C_Text TText;
332  typedef CMath TMath;
333 
334  // getters
335  // setters
336 
337 
338  /// Check if variant _CharData is selected.
339  ///
340  /// _CharData type is defined as 'typedef NCBI_NS_STD::string T_CharData'.
341  /// @return
342  /// - true, if the variant is selected.
343  /// - false, otherwise.
344  bool Is_CharData(void) const;
345 
346  /// Get the variant data.
347  ///
348  /// @return
349  /// Reference to the data.
350  const T_CharData& Get_CharData(void) const;
351 
352  /// Select the variant.
353  ///
354  /// @return
355  /// Reference to the variant data.
356  T_CharData& Set_CharData(void);
357 
358  /// Select the variant and set its data.
359  ///
360  /// @param value
361  /// Variant data.
362  void Set_CharData(const T_CharData& value);
363 
364 
365  /// Check if variant Text is selected.
366  ///
367  /// Text type is defined as 'typedef C_Text TText'.
368  /// @return
369  /// - true, if the variant is selected.
370  /// - false, otherwise.
371  bool IsText(void) const;
372 
373  /// Get the variant data.
374  ///
375  /// @return
376  /// Reference to the data.
377  const TText& GetText(void) const;
378 
379  /// Select the variant.
380  ///
381  /// @return
382  /// Reference to the variant data.
383  TText& SetText(void);
384  /// Select the variant and set its data.
385  ///
386  /// @param value
387  /// Reference to the data.
388  void SetText(TText& value);
389 
390 
391  /// Check if variant Math is selected.
392  ///
393  /// Math type is defined as 'typedef CMath TMath'.
394  /// @return
395  /// - true, if the variant is selected.
396  /// - false, otherwise.
397  bool IsMath(void) const;
398 
399  /// Get the variant data.
400  ///
401  /// @return
402  /// Reference to the data.
403  const TMath& GetMath(void) const;
404 
405  /// Select the variant.
406  ///
407  /// @return
408  /// Reference to the variant data.
409  TMath& SetMath(void);
410  /// Select the variant and set its data.
411  ///
412  /// @param value
413  /// Reference to the data.
414  void SetMath(TMath& value);
415 
416 
417  private:
418  // copy constructor and assignment operator
421  // choice state
423  // helper methods
424  void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool = 0);
425 
426  static const char* const sm_SelectionNames[];
427  // data
428  union {
429  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
430  NCBI_NS_NCBI::CSerialObject *m_object;
431  };
432  };
433  // types
436  typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_ArticleTitle > > TArticleTitle;
437 
438  // member index
439  enum class E_memberIndex {
440  e__allMandatory = 0,
441  e_Attlist,
443  };
444  typedef Tparent::CMemberIndex<E_memberIndex, 3> TmemberIndex;
445 
446  // getters
447  // setters
448 
449  /// Check if a value has been assigned to Attlist data member.
450  ///
451  /// Data member Attlist is mandatory;
452  /// its type is defined as 'typedef C_Attlist TAttlist'
453  /// @return
454  /// - true, if a value has been assigned.
455  /// - false, otherwise.
456  bool IsSetAttlist(void) const;
457 
458  /// Check if it is safe to call GetAttlist method.
459  ///
460  /// @return
461  /// - true, if the data member is getatable.
462  /// - false, otherwise.
463  bool CanGetAttlist(void) const;
464 
465  /// Reset Attlist data member.
466  void ResetAttlist(void);
467 
468  /// Get the Attlist member data.
469  ///
470  /// @return
471  /// Reference to the member data.
472  const TAttlist& GetAttlist(void) const;
473 
474  /// Assign a value to Attlist data member.
475  ///
476  /// @param value
477  /// Reference to value.
478  void SetAttlist(TAttlist& value);
479 
480  /// Assign a value to Attlist data member.
481  ///
482  /// @return
483  /// Reference to the data value.
484  TAttlist& SetAttlist(void);
485 
486  /// Check if a value has been assigned to ArticleTitle data member.
487  ///
488  /// Data member ArticleTitle is optional;
489  /// its type is defined as 'typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_ArticleTitle > > TArticleTitle'
490  /// @return
491  /// - true, if a value has been assigned.
492  /// - false, otherwise.
493  bool IsSetArticleTitle(void) const;
494 
495  /// Check if it is safe to call GetArticleTitle method.
496  ///
497  /// @return
498  /// - true, if the data member is getatable.
499  /// - false, otherwise.
500  bool CanGetArticleTitle(void) const;
501 
502  /// Reset ArticleTitle data member.
503  void ResetArticleTitle(void);
504 
505  /// Get the ArticleTitle member data.
506  ///
507  /// @return
508  /// Reference to the member data.
509  const TArticleTitle& GetArticleTitle(void) const;
510 
511  /// Assign a value to ArticleTitle data member.
512  ///
513  /// @return
514  /// Reference to the data value.
516 
517  /// Reset the whole object
518  virtual void Reset(void);
519 
520 
521 private:
522  // Prohibit copy constructor and assignment operator
525 
526  // data
528  NCBI_NS_NCBI::CRef< TAttlist > m_Attlist;
529  NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_ArticleTitle > > m_ArticleTitle;
530 };
531 
532 /* @} */
533 
534 
535 
536 
537 
538 ///////////////////////////////////////////////////////////
539 ///////////////////// inline methods //////////////////////
540 ///////////////////////////////////////////////////////////
541 inline
543 {
544  return ((m_set_State[0] & 0x3) != 0);
545 }
546 
547 inline
549 {
550  return IsSetBook();
551 }
552 
553 inline
555 {
556  if (!CanGetBook()) {
557  ThrowUnassigned(0);
558  }
559  return m_Book;
560 }
561 
562 inline
564 {
565  m_Book = value;
566  m_set_State[0] |= 0x3;
567 }
568 
569 inline
571 {
572  m_Book = std::forward<CArticleTitle_Base::C_Attlist::TBook>(value);
573  m_set_State[0] |= 0x3;
574 }
575 
576 inline
578 {
579 #ifdef _DEBUG
580  if (!IsSetBook()) {
581  m_Book = UnassignedString();
582  }
583 #endif
584  m_set_State[0] |= 0x1;
585  return m_Book;
586 }
587 
588 inline
590 {
591  return ((m_set_State[0] & 0xc) != 0);
592 }
593 
594 inline
596 {
597  return IsSetPart();
598 }
599 
600 inline
602 {
603  if (!CanGetPart()) {
604  ThrowUnassigned(1);
605  }
606  return m_Part;
607 }
608 
609 inline
611 {
612  m_Part = value;
613  m_set_State[0] |= 0xc;
614 }
615 
616 inline
618 {
619  m_Part = std::forward<CArticleTitle_Base::C_Attlist::TPart>(value);
620  m_set_State[0] |= 0xc;
621 }
622 
623 inline
625 {
626 #ifdef _DEBUG
627  if (!IsSetPart()) {
628  m_Part = UnassignedString();
629  }
630 #endif
631  m_set_State[0] |= 0x4;
632  return m_Part;
633 }
634 
635 inline
637 {
638  return ((m_set_State[0] & 0x30) != 0);
639 }
640 
641 inline
643 {
644  return IsSetSec();
645 }
646 
647 inline
649 {
650  if (!CanGetSec()) {
651  ThrowUnassigned(2);
652  }
653  return m_Sec;
654 }
655 
656 inline
658 {
659  m_Sec = value;
660  m_set_State[0] |= 0x30;
661 }
662 
663 inline
665 {
666  m_Sec = std::forward<CArticleTitle_Base::C_Attlist::TSec>(value);
667  m_set_State[0] |= 0x30;
668 }
669 
670 inline
672 {
673 #ifdef _DEBUG
674  if (!IsSetSec()) {
675  m_Sec = UnassignedString();
676  }
677 #endif
678  m_set_State[0] |= 0x10;
679  return m_Sec;
680 }
681 
682 inline
684 {
685  return m_choice;
686 }
687 
688 inline
690 {
691  if ( m_choice != index )
692  ThrowInvalidSelection(index);
693 }
694 
695 inline
696 void CArticleTitle_Base::C_E_ArticleTitle::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
697 {
698  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
699  if ( m_choice != e_not_set )
700  ResetSelection();
701  DoSelect(index, pool);
702  }
703 }
704 
705 inline
707 {
708  Select(index, reset, 0);
709 }
710 
711 inline
713 {
714  return m_choice == e__CharData;
715 }
716 
717 inline
719 {
720  CheckSelected(e__CharData);
721  return *m_string;
722 }
723 
724 inline
726 {
727  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
728  return *m_string;
729 }
730 
731 inline
733 {
734  return m_choice == e_Text;
735 }
736 
737 inline
739 {
740  return m_choice == e_Math;
741 }
742 
743 inline
745 {
746  return m_Attlist.NotEmpty();
747 }
748 
749 inline
751 {
752  return true;
753 }
754 
755 inline
757 {
758  if ( !m_Attlist ) {
759  const_cast<CArticleTitle_Base*>(this)->ResetAttlist();
760  }
761  return (*m_Attlist);
762 }
763 
764 inline
766 {
767  if ( !m_Attlist ) {
768  ResetAttlist();
769  }
770  return (*m_Attlist);
771 }
772 
773 inline
775 {
776  return ((m_set_State[0] & 0xc) != 0);
777 }
778 
779 inline
781 {
782  return true;
783 }
784 
785 inline
787 {
788  return m_ArticleTitle;
789 }
790 
791 inline
793 {
794  m_set_State[0] |= 0x4;
795  return m_ArticleTitle;
796 }
797 
798 ///////////////////////////////////////////////////////////
799 ////////////////// end of inline methods //////////////////
800 ///////////////////////////////////////////////////////////
801 
802 
803 
804 
805 
806 END_eutils_SCOPE // namespace eutils::
807 
808 
809 #endif // eutils__OBJTOOLS_EUTILS_EFETCH_ARTICLETITLE_BASE_HPP
#define BEGIN_eutils_SCOPE
#define END_eutils_SCOPE
User-defined methods of the data storage class.
CArticleTitle_Base –.
CMath –.
Definition: Math.hpp:66
CText –.
Definition: Text.hpp:64
string
Definition: cgiapp.hpp:687
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
const T_CharData & Get_CharData(void) const
Get the variant data.
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TBook & SetBook(void)
Assign a value to Book data member.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
C_E_ArticleTitle & operator=(const C_E_ArticleTitle &)
void ResetArticleTitle(void)
Reset ArticleTitle data member.
bool IsSetBook(void) const
Check if a value has been assigned to Book data member.
TArticleTitle & SetArticleTitle(void)
Assign a value to ArticleTitle data member.
const TSec & GetSec(void) const
Get the Sec member data.
NCBI_NS_NCBI::CRef< TAttlist > m_Attlist
E_Choice Which(void) const
Which variant is currently selected.
C_E_ArticleTitle C_E
void ResetSelection(void)
Reset the selection (set it to e_not_set).
CArticleTitle_Base & operator=(const CArticleTitle_Base &)
bool CanGetAttlist(void) const
Check if it is safe to call GetAttlist method.
bool IsSetArticleTitle(void) const
Check if a value has been assigned to ArticleTitle data member.
TMath & SetMath(void)
Select the variant.
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_ArticleTitle > > TArticleTitle
TText & SetText(void)
Select the variant.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
NCBI_NS_NCBI::CSerialObject Tparent
bool CanGetSec(void) const
Check if it is safe to call GetSec method.
void ResetBook(void)
Reset Book data member.
bool CanGetArticleTitle(void) const
Check if it is safe to call GetArticleTitle method.
bool CanGetBook(void) const
Check if it is safe to call GetBook method.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
const TArticleTitle & GetArticleTitle(void) const
Get the ArticleTitle member data.
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
TPart & SetPart(void)
Assign a value to Part data member.
TSec & SetSec(void)
Assign a value to Sec data member.
TAttlist & SetAttlist(void)
Assign a value to Attlist data member.
virtual ~CArticleTitle_Base(void)
const TBook & GetBook(void) const
Get the Book member data.
static const char *const sm_SelectionNames[]
C_Attlist(const C_Attlist &)
bool IsSetPart(void) const
Check if a value has been assigned to Part data member.
bool IsText(void) const
Check if variant Text is selected.
const TPart & GetPart(void) const
Get the Part member data.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TText & GetText(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
C_E_ArticleTitle(const C_E_ArticleTitle &)
void ResetPart(void)
Reset Part data member.
void ResetAttlist(void)
Reset Attlist data member.
CArticleTitle_Base(const CArticleTitle_Base &)
NCBI_NS_NCBI::CSerialObject Tparent
bool IsSetAttlist(void) const
Check if a value has been assigned to Attlist data member.
bool IsMath(void) const
Check if variant Math is selected.
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_ArticleTitle > > m_ArticleTitle
bool IsSetSec(void) const
Check if a value has been assigned to Sec data member.
void Reset(void)
Reset the whole object.
T_CharData & Set_CharData(void)
Select the variant.
void Reset(void)
Reset the whole object.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
bool Is_CharData(void) const
Check if variant _CharData is selected.
void ResetSec(void)
Reset Sec data member.
bool CanGetPart(void) const
Check if it is safe to call GetPart method.
NCBI_NS_NCBI::CSerialObject Tparent
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
C_Attlist & operator=(const C_Attlist &)
const TMath & GetMath(void) const
Get the variant data.
NCBI_NS_NCBI::CSerialObject * m_object
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Jun 19 17:03:07 2024 by modify_doxy.py rev. 669887