NCBI C++ ToolKit
SectionTitle_.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 SectionTitle_.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_SECTIONTITLE_BASE_HPP
42 #define eutils__OBJTOOLS_EUTILS_EFETCH_SECTIONTITLE_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 // generated classes
60 
61 
62 /** @addtogroup dataspec_efetch
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CSectionTitle_Base --
70 ///
71 
72 class CSectionTitle_Base : public NCBI_NS_NCBI::CSerialObject
73 {
74  typedef NCBI_NS_NCBI::CSerialObject Tparent;
75 public:
76  // constructor
77  CSectionTitle_Base(void);
78  // destructor
79  virtual ~CSectionTitle_Base(void);
80 
81  // type info
83 
84  /////////////////////////////////////////////////////////////////////////////
85  ///
86  /// C_Attlist --
87  ///
88 
89  class C_Attlist : public NCBI_NS_NCBI::CSerialObject
90  {
91  typedef NCBI_NS_NCBI::CSerialObject Tparent;
92  public:
93  // constructor
94  C_Attlist(void);
95  // destructor
96  ~C_Attlist(void);
97 
98  // type info
100 
101  // types
105 
106  // member index
107  enum class E_memberIndex {
108  e__allMandatory = 0,
109  e_book,
110  e_part,
111  e_sec
112  };
113  typedef Tparent::CMemberIndex<E_memberIndex, 4> TmemberIndex;
114 
115  // getters
116  // setters
117 
118  /// Check if a value has been assigned to Book data member.
119  ///
120  /// Data member Book is optional;
121  /// its type is defined as 'typedef NCBI_NS_STD::string TBook'
122  /// @return
123  /// - true, if a value has been assigned.
124  /// - false, otherwise.
125  bool IsSetBook(void) const;
126 
127  /// Check if it is safe to call GetBook method.
128  ///
129  /// @return
130  /// - true, if the data member is getatable.
131  /// - false, otherwise.
132  bool CanGetBook(void) const;
133 
134  /// Reset Book data member.
135  void ResetBook(void);
136 
137  /// Get the Book member data.
138  ///
139  /// @return
140  /// Reference to the member data.
141  const TBook& GetBook(void) const;
142 
143  /// Assign a value to Book data member.
144  ///
145  /// @param value
146  /// Value to assign
147  void SetBook(const TBook& value);
148  void SetBook(TBook&& value);
149 
150  /// Assign a value to Book data member.
151  ///
152  /// @return
153  /// Reference to the data value.
154  TBook& SetBook(void);
155 
156  /// Check if a value has been assigned to Part data member.
157  ///
158  /// Data member Part is optional;
159  /// its type is defined as 'typedef NCBI_NS_STD::string TPart'
160  /// @return
161  /// - true, if a value has been assigned.
162  /// - false, otherwise.
163  bool IsSetPart(void) const;
164 
165  /// Check if it is safe to call GetPart method.
166  ///
167  /// @return
168  /// - true, if the data member is getatable.
169  /// - false, otherwise.
170  bool CanGetPart(void) const;
171 
172  /// Reset Part data member.
173  void ResetPart(void);
174 
175  /// Get the Part member data.
176  ///
177  /// @return
178  /// Reference to the member data.
179  const TPart& GetPart(void) const;
180 
181  /// Assign a value to Part data member.
182  ///
183  /// @param value
184  /// Value to assign
185  void SetPart(const TPart& value);
186  void SetPart(TPart&& value);
187 
188  /// Assign a value to Part data member.
189  ///
190  /// @return
191  /// Reference to the data value.
192  TPart& SetPart(void);
193 
194  /// Check if a value has been assigned to Sec data member.
195  ///
196  /// Data member Sec is optional;
197  /// its type is defined as 'typedef NCBI_NS_STD::string TSec'
198  /// @return
199  /// - true, if a value has been assigned.
200  /// - false, otherwise.
201  bool IsSetSec(void) const;
202 
203  /// Check if it is safe to call GetSec method.
204  ///
205  /// @return
206  /// - true, if the data member is getatable.
207  /// - false, otherwise.
208  bool CanGetSec(void) const;
209 
210  /// Reset Sec data member.
211  void ResetSec(void);
212 
213  /// Get the Sec member data.
214  ///
215  /// @return
216  /// Reference to the member data.
217  const TSec& GetSec(void) const;
218 
219  /// Assign a value to Sec data member.
220  ///
221  /// @param value
222  /// Value to assign
223  void SetSec(const TSec& value);
224  void SetSec(TSec&& value);
225 
226  /// Assign a value to Sec data member.
227  ///
228  /// @return
229  /// Reference to the data value.
230  TSec& SetSec(void);
231 
232  /// Reset the whole object
233  void Reset(void);
234 
235 
236  private:
237  // Prohibit copy constructor and assignment operator
240 
241  // data
246  };
247  /////////////////////////////////////////////////////////////////////////////
248  ///
249  /// C_E_SectionTitle --
250  ///
251 
252  class C_E_SectionTitle : public NCBI_NS_NCBI::CSerialObject
253  {
254  typedef NCBI_NS_NCBI::CSerialObject Tparent;
255  public:
256  // constructor
257  C_E_SectionTitle(void);
258  // destructor
259  ~C_E_SectionTitle(void);
260 
261  // type info
263 
264  typedef CText C_Text;
265 
266  /// Choice variants.
267  enum E_Choice {
268  e_not_set = 0, ///< No variant selected
270  e_Text
271  };
272  /// Maximum+1 value of the choice variant enumerator.
274  e_MaxChoice = 3 ///< == e_Text+1
275  };
276 
277  /// Reset the whole object
278  void Reset(void);
279 
280  /// Reset the selection (set it to e_not_set).
281  void ResetSelection(void);
282 
283  /// Which variant is currently selected.
284  ///
285  /// @return
286  /// Choice state enumerator.
287  E_Choice Which(void) const;
288 
289  /// Verify selection, throw exception if it differs from the expected.
290  ///
291  /// @param index
292  /// Expected selection.
293  void CheckSelected(E_Choice index) const;
294 
295  /// Throw 'InvalidSelection' exception.
296  ///
297  /// @param index
298  /// Expected selection.
299  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
300 
301  /// Retrieve selection name (for diagnostic purposes).
302  ///
303  /// @param index
304  /// One of possible selection states.
305  /// @return
306  /// Name string.
308 
309  /// Select the requested variant if needed.
310  ///
311  /// @param index
312  /// New selection state.
313  /// @param reset
314  /// Flag that defines the resetting of the variant data. The data will
315  /// be reset if either the current selection differs from the new one,
316  /// or the flag is set to eDoResetVariant.
318  /// Select the requested variant if needed,
319  /// allocating CObject variants from memory pool.
320  void Select(E_Choice index,
322  NCBI_NS_NCBI::CObjectMemoryPool* pool);
323 
324  // types
326  typedef C_Text TText;
327 
328  // getters
329  // setters
330 
331 
332  /// Check if variant _CharData is selected.
333  ///
334  /// _CharData type is defined as 'typedef NCBI_NS_STD::string T_CharData'.
335  /// @return
336  /// - true, if the variant is selected.
337  /// - false, otherwise.
338  bool Is_CharData(void) const;
339 
340  /// Get the variant data.
341  ///
342  /// @return
343  /// Reference to the data.
344  const T_CharData& Get_CharData(void) const;
345 
346  /// Select the variant.
347  ///
348  /// @return
349  /// Reference to the variant data.
350  T_CharData& Set_CharData(void);
351 
352  /// Select the variant and set its data.
353  ///
354  /// @param value
355  /// Variant data.
356  void Set_CharData(const T_CharData& value);
357 
358 
359  /// Check if variant Text is selected.
360  ///
361  /// Text type is defined as 'typedef C_Text TText'.
362  /// @return
363  /// - true, if the variant is selected.
364  /// - false, otherwise.
365  bool IsText(void) const;
366 
367  /// Get the variant data.
368  ///
369  /// @return
370  /// Reference to the data.
371  const TText& GetText(void) const;
372 
373  /// Select the variant.
374  ///
375  /// @return
376  /// Reference to the variant data.
377  TText& SetText(void);
378  /// Select the variant and set its data.
379  ///
380  /// @param value
381  /// Reference to the data.
382  void SetText(TText& value);
383 
384 
385  private:
386  // copy constructor and assignment operator
389  // choice state
391  // helper methods
392  void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool = 0);
393 
394  static const char* const sm_SelectionNames[];
395  // data
396  union {
397  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
398  NCBI_NS_NCBI::CSerialObject *m_object;
399  };
400  };
401  // types
404  typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_SectionTitle > > TSectionTitle;
405 
406  // member index
407  enum class E_memberIndex {
408  e__allMandatory = 0,
409  e_Attlist,
411  };
412  typedef Tparent::CMemberIndex<E_memberIndex, 3> TmemberIndex;
413 
414  // getters
415  // setters
416 
417  /// Check if a value has been assigned to Attlist data member.
418  ///
419  /// Data member Attlist is mandatory;
420  /// its type is defined as 'typedef C_Attlist TAttlist'
421  /// @return
422  /// - true, if a value has been assigned.
423  /// - false, otherwise.
424  bool IsSetAttlist(void) const;
425 
426  /// Check if it is safe to call GetAttlist method.
427  ///
428  /// @return
429  /// - true, if the data member is getatable.
430  /// - false, otherwise.
431  bool CanGetAttlist(void) const;
432 
433  /// Reset Attlist data member.
434  void ResetAttlist(void);
435 
436  /// Get the Attlist member data.
437  ///
438  /// @return
439  /// Reference to the member data.
440  const TAttlist& GetAttlist(void) const;
441 
442  /// Assign a value to Attlist data member.
443  ///
444  /// @param value
445  /// Reference to value.
446  void SetAttlist(TAttlist& value);
447 
448  /// Assign a value to Attlist data member.
449  ///
450  /// @return
451  /// Reference to the data value.
452  TAttlist& SetAttlist(void);
453 
454  /// Check if a value has been assigned to SectionTitle data member.
455  ///
456  /// Data member SectionTitle is optional;
457  /// its type is defined as 'typedef NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_SectionTitle > > TSectionTitle'
458  /// @return
459  /// - true, if a value has been assigned.
460  /// - false, otherwise.
461  bool IsSetSectionTitle(void) const;
462 
463  /// Check if it is safe to call GetSectionTitle method.
464  ///
465  /// @return
466  /// - true, if the data member is getatable.
467  /// - false, otherwise.
468  bool CanGetSectionTitle(void) const;
469 
470  /// Reset SectionTitle data member.
471  void ResetSectionTitle(void);
472 
473  /// Get the SectionTitle member data.
474  ///
475  /// @return
476  /// Reference to the member data.
477  const TSectionTitle& GetSectionTitle(void) const;
478 
479  /// Assign a value to SectionTitle data member.
480  ///
481  /// @return
482  /// Reference to the data value.
484 
485  /// Reset the whole object
486  virtual void Reset(void);
487 
488 
489 private:
490  // Prohibit copy constructor and assignment operator
493 
494  // data
496  NCBI_NS_NCBI::CRef< TAttlist > m_Attlist;
497  NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_SectionTitle > > m_SectionTitle;
498 };
499 
500 /* @} */
501 
502 
503 
504 
505 
506 ///////////////////////////////////////////////////////////
507 ///////////////////// inline methods //////////////////////
508 ///////////////////////////////////////////////////////////
509 inline
511 {
512  return ((m_set_State[0] & 0x3) != 0);
513 }
514 
515 inline
517 {
518  return IsSetBook();
519 }
520 
521 inline
523 {
524  if (!CanGetBook()) {
525  ThrowUnassigned(0);
526  }
527  return m_Book;
528 }
529 
530 inline
532 {
533  m_Book = value;
534  m_set_State[0] |= 0x3;
535 }
536 
537 inline
539 {
540  m_Book = std::forward<CSectionTitle_Base::C_Attlist::TBook>(value);
541  m_set_State[0] |= 0x3;
542 }
543 
544 inline
546 {
547 #ifdef _DEBUG
548  if (!IsSetBook()) {
549  m_Book = UnassignedString();
550  }
551 #endif
552  m_set_State[0] |= 0x1;
553  return m_Book;
554 }
555 
556 inline
558 {
559  return ((m_set_State[0] & 0xc) != 0);
560 }
561 
562 inline
564 {
565  return IsSetPart();
566 }
567 
568 inline
570 {
571  if (!CanGetPart()) {
572  ThrowUnassigned(1);
573  }
574  return m_Part;
575 }
576 
577 inline
579 {
580  m_Part = value;
581  m_set_State[0] |= 0xc;
582 }
583 
584 inline
586 {
587  m_Part = std::forward<CSectionTitle_Base::C_Attlist::TPart>(value);
588  m_set_State[0] |= 0xc;
589 }
590 
591 inline
593 {
594 #ifdef _DEBUG
595  if (!IsSetPart()) {
596  m_Part = UnassignedString();
597  }
598 #endif
599  m_set_State[0] |= 0x4;
600  return m_Part;
601 }
602 
603 inline
605 {
606  return ((m_set_State[0] & 0x30) != 0);
607 }
608 
609 inline
611 {
612  return IsSetSec();
613 }
614 
615 inline
617 {
618  if (!CanGetSec()) {
619  ThrowUnassigned(2);
620  }
621  return m_Sec;
622 }
623 
624 inline
626 {
627  m_Sec = value;
628  m_set_State[0] |= 0x30;
629 }
630 
631 inline
633 {
634  m_Sec = std::forward<CSectionTitle_Base::C_Attlist::TSec>(value);
635  m_set_State[0] |= 0x30;
636 }
637 
638 inline
640 {
641 #ifdef _DEBUG
642  if (!IsSetSec()) {
643  m_Sec = UnassignedString();
644  }
645 #endif
646  m_set_State[0] |= 0x10;
647  return m_Sec;
648 }
649 
650 inline
652 {
653  return m_choice;
654 }
655 
656 inline
658 {
659  if ( m_choice != index )
660  ThrowInvalidSelection(index);
661 }
662 
663 inline
664 void CSectionTitle_Base::C_E_SectionTitle::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
665 {
666  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
667  if ( m_choice != e_not_set )
668  ResetSelection();
669  DoSelect(index, pool);
670  }
671 }
672 
673 inline
675 {
676  Select(index, reset, 0);
677 }
678 
679 inline
681 {
682  return m_choice == e__CharData;
683 }
684 
685 inline
687 {
688  CheckSelected(e__CharData);
689  return *m_string;
690 }
691 
692 inline
694 {
695  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
696  return *m_string;
697 }
698 
699 inline
701 {
702  return m_choice == e_Text;
703 }
704 
705 inline
707 {
708  return m_Attlist.NotEmpty();
709 }
710 
711 inline
713 {
714  return true;
715 }
716 
717 inline
719 {
720  if ( !m_Attlist ) {
721  const_cast<CSectionTitle_Base*>(this)->ResetAttlist();
722  }
723  return (*m_Attlist);
724 }
725 
726 inline
728 {
729  if ( !m_Attlist ) {
730  ResetAttlist();
731  }
732  return (*m_Attlist);
733 }
734 
735 inline
737 {
738  return ((m_set_State[0] & 0xc) != 0);
739 }
740 
741 inline
743 {
744  return true;
745 }
746 
747 inline
749 {
750  return m_SectionTitle;
751 }
752 
753 inline
755 {
756  m_set_State[0] |= 0x4;
757  return m_SectionTitle;
758 }
759 
760 ///////////////////////////////////////////////////////////
761 ////////////////// end of inline methods //////////////////
762 ///////////////////////////////////////////////////////////
763 
764 
765 
766 
767 
768 END_eutils_SCOPE // namespace eutils::
769 
770 
771 #endif // eutils__OBJTOOLS_EUTILS_EFETCH_SECTIONTITLE_BASE_HPP
#define BEGIN_eutils_SCOPE
#define END_eutils_SCOPE
User-defined methods of the data storage class.
CSectionTitle_Base –.
CText –.
Definition: Text.hpp:64
char value[7]
Definition: config.c:431
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
TPart & SetPart(void)
Assign a value to Part data member.
void ResetPart(void)
Reset Part data member.
NCBI_NS_NCBI::CSerialObject * m_object
T_CharData & Set_CharData(void)
Select the variant.
bool IsSetAttlist(void) const
Check if a value has been assigned to Attlist data member.
void Reset(void)
Reset the whole object.
virtual ~CSectionTitle_Base(void)
C_Attlist & operator=(const C_Attlist &)
const TText & GetText(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
bool IsText(void) const
Check if variant Text is selected.
TAttlist & SetAttlist(void)
Assign a value to Attlist data member.
TSec & SetSec(void)
Assign a value to Sec data member.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
void Reset(void)
Reset the whole object.
NCBI_NS_NCBI::CSerialObject Tparent
CSectionTitle_Base & operator=(const CSectionTitle_Base &)
bool IsSetSec(void) const
Check if a value has been assigned to Sec data member.
bool CanGetAttlist(void) const
Check if it is safe to call GetAttlist method.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
const TPart & GetPart(void) const
Get the Part member data.
const TBook & GetBook(void) const
Get the Book member data.
bool IsSetSectionTitle(void) const
Check if a value has been assigned to SectionTitle data member.
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_SectionTitle > > m_SectionTitle
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
TSectionTitle & SetSectionTitle(void)
Assign a value to SectionTitle data member.
TBook & SetBook(void)
Assign a value to Book data member.
virtual void Reset(void)
Reset the whole object.
void ResetSec(void)
Reset Sec data member.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
CSectionTitle_Base(const CSectionTitle_Base &)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
bool CanGetBook(void) const
Check if it is safe to call GetBook method.
static const char *const sm_SelectionNames[]
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
const TSectionTitle & GetSectionTitle(void) const
Get the SectionTitle member data.
void ResetSectionTitle(void)
Reset SectionTitle data member.
bool IsSetPart(void) const
Check if a value has been assigned to Part data member.
bool Is_CharData(void) const
Check if variant _CharData is selected.
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_SectionTitle > > TSectionTitle
C_E_SectionTitle & operator=(const C_E_SectionTitle &)
bool CanGetSec(void) const
Check if it is safe to call GetSec method.
NCBI_NS_NCBI::CRef< TAttlist > m_Attlist
C_Attlist(const C_Attlist &)
bool CanGetPart(void) const
Check if it is safe to call GetPart method.
TText & SetText(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject Tparent
NCBI_NS_NCBI::CSerialObject Tparent
C_E_SectionTitle(const C_E_SectionTitle &)
C_E_SectionTitle C_E
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
bool IsSetBook(void) const
Check if a value has been assigned to Book data member.
void ResetBook(void)
Reset Book data member.
const TSec & GetSec(void) const
Get the Sec member data.
void ResetAttlist(void)
Reset Attlist data member.
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
const T_CharData & Get_CharData(void) const
Get the variant data.
bool CanGetSectionTitle(void) const
Check if it is safe to call GetSectionTitle method.
@ e_not_set
Modified on Mon Feb 26 04:04:20 2024 by modify_doxy.py rev. 669887