NCBI C++ ToolKit
Keyword_.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
44 BEGIN_eutils_SCOPE // namespace eutils::
45 
46 
47 // generated classes
48 
49 BEGIN_NAMED_ENUM_IN_INFO("", CKeyword_Base::C_Attlist::, EAttlist_MajorTopicYN, false)
50 {
51  SET_ENUM_INTERNAL_NAME("Keyword.Attlist", "MajorTopicYN");
52  SET_ENUM_MODULE("efetch");
53  ADD_ENUM_VALUE("Y", eAttlist_MajorTopicYN_Y);
54  ADD_ENUM_VALUE("N", eAttlist_MajorTopicYN_N);
55 }
57 
59 {
61 }
62 
64 {
65  SET_INTERNAL_NAME("Keyword", "Attlist");
66  SET_CLASS_MODULE("efetch");
67  ADD_NAMED_ENUM_MEMBER("MajorTopicYN", m_MajorTopicYN, EAttlist_MajorTopicYN)->SetDefault(new TMajorTopicYN(eAttlist_MajorTopicYN_N))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional()->SetNsQualified(false);
68  info->SetRandomOrder(true);
69  info->CodeVersion(22400);
70  info->DataSpec(ncbi::EDataSpec::eXSD);
71 }
73 
74 // constructor
76  : m_MajorTopicYN(eAttlist_MajorTopicYN_N)
77 {
78  memset(m_set_State,0,sizeof(m_set_State));
79 }
80 
81 // destructor
83 {
84 }
85 
86 
88 {
89  if ( m_choice != e_not_set )
90  ResetSelection();
91 }
92 
94 {
95  switch ( m_choice ) {
96  case e__CharData:
97  m_string.Destruct();
98  break;
99  case e_Text:
100  case e_Math:
101  m_object->RemoveReference();
102  break;
103  default:
104  break;
105  }
106  m_choice = e_not_set;
107 }
108 
109 void CKeyword_Base::C_E_Keyword::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
110 {
111  switch ( index ) {
112  case e_Text:
113  (m_object = new(pool) eutils::CText())->AddReference();
114  break;
115  case e_Math:
116  (m_object = new(pool) eutils::CMath())->AddReference();
117  break;
118  case e__CharData:
119  m_string.Construct();
120  break;
121  default:
122  break;
123  }
124  m_choice = index;
125 }
126 
127 const char* const CKeyword_Base::C_E_Keyword::sm_SelectionNames[] = {
128  "not set",
129  "-CharData",
130  "text",
131  "math"
132 };
133 
135 {
136  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
137 }
138 
140 {
141  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
142 }
143 
145 {
146  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
147  *m_string = value;
148 }
149 
151 {
152  CheckSelected(e_Text);
153  return *static_cast<const TText*>(m_object);
154 }
155 
157 {
158  Select(e_Text, NCBI_NS_NCBI::eDoNotResetVariant);
159  return *static_cast<TText*>(m_object);
160 }
161 
163 {
164  TText* ptr = &value;
165  if ( m_choice != e_Text || m_object != ptr ) {
166  ResetSelection();
167  (m_object = ptr)->AddReference();
168  m_choice = e_Text;
169  }
170 }
171 
173 {
174  CheckSelected(e_Math);
175  return *static_cast<const TMath*>(m_object);
176 }
177 
179 {
180  Select(e_Math, NCBI_NS_NCBI::eDoNotResetVariant);
181  return *static_cast<TMath*>(m_object);
182 }
183 
185 {
186  TMath* ptr = &value;
187  if ( m_choice != e_Math || m_object != ptr ) {
188  ResetSelection();
189  (m_object = ptr)->AddReference();
190  m_choice = e_Math;
191  }
192 }
193 
194 // helper methods
195 
196 // type info
198 {
199  SET_INTERNAL_NAME("Keyword.Keyword", "E");
200  SET_CHOICE_MODULE("efetch");
201  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
202  ADD_NAMED_BUF_CHOICE_VARIANT("-CharData", m_string, STD, (NCBI_NS_STD::string))->SetNotag();
203  ADD_NAMED_REF_CHOICE_VARIANT("text", m_object, C_Text)->SetNotag();
204  ADD_NAMED_REF_CHOICE_VARIANT("math", m_object, CMath);
205  info->CodeVersion(22400);
206  info->DataSpec(ncbi::EDataSpec::eXSD);
207 }
209 
210 // constructor
212  : m_choice(e_not_set)
213 {
214 }
215 
216 // destructor
218 {
219  Reset();
220 }
221 
222 
224 {
225  if ( !m_Attlist ) {
226  m_Attlist.Reset(new TAttlist());
227  return;
228  }
229  (*m_Attlist).Reset();
230 }
231 
233 {
234  m_Attlist.Reset(&value);
235 }
236 
238 {
239  m_Keyword.clear();
240  m_set_State[0] &= ~0xc;
241 }
242 
244 {
245  ResetAttlist();
246  ResetKeyword();
247 }
248 
250 {
251  SET_CLASS_MODULE("efetch");
252  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
253  ADD_NAMED_REF_MEMBER("Attlist", m_Attlist, C_Attlist)->SetAttlist();
254  ADD_NAMED_MEMBER("Keyword", m_Keyword, STL_list, (STL_CRef, (CLASS, (C_E_Keyword))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional()->SetNotag();
255  info->RandomOrder();
256  info->CodeVersion(22400);
257  info->DataSpec(ncbi::EDataSpec::eXSD);
258 }
260 
261 // constructor
263 {
264  memset(m_set_State,0,sizeof(m_set_State));
265  if ( !IsAllocatedInPool() ) {
266  ResetAttlist();
267  }
268 }
269 
270 // destructor
272 {
273 }
274 
275 
276 
277 END_eutils_SCOPE // namespace eutils::
278 
#define BEGIN_eutils_SCOPE
Definition: Abstract_.hpp:51
#define END_eutils_SCOPE
Definition: Abstract_.hpp:52
END_ENUM_INFO
Definition: aln_errors.cpp:58
C_Attlist –.
Definition: Keyword_.hpp:94
C_E_Keyword –.
Definition: Keyword_.hpp:185
CKeyword –.
Definition: Keyword.hpp:64
CMath –.
Definition: Math.hpp:66
CText –.
Definition: Text.hpp:64
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 SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#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 ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#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
TAttlist & SetAttlist(void)
Assign a value to Attlist data member.
Definition: Keyword_.hpp:603
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: Keyword_.cpp:109
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
void ResetMajorTopicYN(void)
Reset MajorTopicYN data member.
Definition: Keyword_.hpp:482
E_Choice
Choice variants.
Definition: Keyword_.hpp:199
Uint4 m_set_State[1]
Definition: Keyword_.hpp:455
void ResetAttlist(void)
Reset Attlist data member.
Definition: Keyword_.cpp:223
T_CharData & Set_CharData(void)
Select the variant.
Definition: Keyword_.hpp:563
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Keyword_.cpp:139
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
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
void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:87
void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:58
NCBI_NS_STD::string T_CharData
Definition: Keyword_.hpp:258
virtual void Reset(void)
Reset the whole object.
Definition: Keyword_.cpp:243
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E_Keyword > > m_Keyword
Definition: Keyword_.hpp:457
NCBI_NS_NCBI::CRef< TAttlist > m_Attlist
Definition: Keyword_.hpp:456
const TMath & GetMath(void) const
Get the variant data.
Definition: Keyword_.cpp:172
static const char *const sm_SelectionNames[]
Definition: Keyword_.hpp:354
void ResetKeyword(void)
Definition: Keyword_.hpp:89
CKeyword_Base(void)
Definition: Keyword_.hpp:113
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CKeyword_Base::C_E_Keyword)
Definition: Keyword_.cpp:197
BEGIN_eutils_SCOPE BEGIN_NAMED_ENUM_IN_INFO("", CKeyword_Base::C_Attlist::, EAttlist_MajorTopicYN, false)
Definition: Keyword_.cpp:49
BEGIN_NAMED_BASE_CLASS_INFO("Keyword", CKeyword)
Definition: Keyword_.cpp:249
BEGIN_NAMED_CLASS_INFO("", CKeyword_Base::C_Attlist)
Definition: Keyword_.cpp:63
User-defined methods of the data storage class.
Modified on Wed Jul 24 17:16:58 2024 by modify_doxy.py rev. 669887