NCBI C++ ToolKit
VolumeTitle_.cpp
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  * File Description:
27  * This code was generated by application DATATOOL
28  * using the following specifications:
29  * 'efetch.xsd'.
30  *
31  * ATTENTION:
32  * Don't edit or commit this file into CVS as this file will
33  * be overridden (by DATATOOL) without warning!
34  * ===========================================================================
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/serialimpl.hpp>
40 
41 // generated includes
43 BEGIN_eutils_SCOPE // namespace eutils::
44 
45 
46 // generated classes
47 
49 {
50  if ( m_choice != e_not_set )
52 }
53 
55 {
56  switch ( m_choice ) {
57  case e__CharData:
58  m_string.Destruct();
59  break;
60  case e_Text:
61  m_object->RemoveReference();
62  break;
63  default:
64  break;
65  }
66  m_choice = e_not_set;
67 }
68 
69 void CVolumeTitle_Base::C_E::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
70 {
71  switch ( index ) {
72  case e_Text:
73  (m_object = new(pool) eutils::CText())->AddReference();
74  break;
75  case e__CharData:
76  m_string.Construct();
77  break;
78  default:
79  break;
80  }
81  m_choice = index;
82 }
83 
84 const char* const CVolumeTitle_Base::C_E::sm_SelectionNames[] = {
85  "not set",
86  "-CharData",
87  "text"
88 };
89 
91 {
92  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
93 }
94 
96 {
97  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
98 }
99 
101 {
102  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
103  *m_string = value;
104 }
105 
107 {
108  CheckSelected(e_Text);
109  return *static_cast<const TText*>(m_object);
110 }
111 
113 {
114  Select(e_Text, NCBI_NS_NCBI::eDoNotResetVariant);
115  return *static_cast<TText*>(m_object);
116 }
117 
119 {
120  TText* ptr = &value;
121  if ( m_choice != e_Text || m_object != ptr ) {
122  ResetSelection();
123  (m_object = ptr)->AddReference();
124  m_choice = e_Text;
125  }
126 }
127 
128 // helper methods
129 
130 // type info
132 {
133  SET_INTERNAL_NAME("VolumeTitle", "E");
134  SET_CHOICE_MODULE("efetch");
135  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
136  ADD_NAMED_BUF_CHOICE_VARIANT("-CharData", m_string, STD, (NCBI_NS_STD::string))->SetNotag();
137  ADD_NAMED_REF_CHOICE_VARIANT("text", m_object, C_Text)->SetNotag();
138  info->CodeVersion(22301);
139  info->DataSpec(ncbi::EDataSpec::eXSD);
140 }
142 
143 // constructor
145  : m_choice(e_not_set)
146 {
147 }
148 
149 // destructor
151 {
152  Reset();
153 }
154 
155 
157 {
158  m_data.clear();
159  m_set_State[0] &= ~0x3;
160 }
161 
163 {
164  SET_CLASS_MODULE("efetch");
165  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
166  ADD_NAMED_MEMBER("", m_data, STL_list, (STL_CRef, (CLASS, (C_E))))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
167  info->RandomOrder();
168  info->CodeVersion(22301);
169  info->DataSpec(ncbi::EDataSpec::eXSD);
170 }
172 
173 // constructor
175 {
176  memset(m_set_State,0,sizeof(m_set_State));
177 }
178 
179 // destructor
181 {
182 }
183 
184 
185 
186 END_eutils_SCOPE // namespace eutils::
187 
#define BEGIN_eutils_SCOPE
Definition: Abstract_.hpp:51
#define END_eutils_SCOPE
Definition: Abstract_.hpp:52
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_IMPLICIT_CLASS_INFO("VolumeTitle", CVolumeTitle)
BEGIN_NAMED_CHOICE_INFO("", CVolumeTitle_Base::C_E)
CText –.
Definition: Text.hpp:64
CVolumeTitle –.
Definition: VolumeTitle.hpp:64
char value[7]
Definition: config.c:431
string
Definition: cgiapp.hpp:687
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
#define MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define SET_NAMESPACE(name)
Definition: serialimpl.hpp:450
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:447
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:385
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void Reset(void)
Reset data member.
TText & SetText(void)
Select the variant.
virtual ~CVolumeTitle_Base(void)
const TText & GetText(void) const
Get the variant data.
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
void ResetSelection(void)
Reset the selection (set it to e_not_set).
T_CharData & Set_CharData(void)
Select the variant.
static const char *const sm_SelectionNames[]
void Reset(void)
Reset the whole object.
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E > > m_data
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
E_Choice
Choice variants.
NCBI_NS_STD::string T_CharData
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Mon Dec 11 02:36:49 2023 by modify_doxy.py rev. 669887