NCBI C++ ToolKit
Author_.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
50 BEGIN_eutils_SCOPE // namespace eutils::
51 
52 
53 // generated classes
54 
55 BEGIN_NAMED_ENUM_IN_INFO("", CAuthor_Base::C_Attlist::, EAttlist_ValidYN, false)
56 {
57  SET_ENUM_INTERNAL_NAME("Author.Attlist", "ValidYN");
58  SET_ENUM_MODULE("efetch");
59  ADD_ENUM_VALUE("Y", eAttlist_ValidYN_Y);
60  ADD_ENUM_VALUE("N", eAttlist_ValidYN_N);
61 }
63 
64 BEGIN_NAMED_ENUM_IN_INFO("", CAuthor_Base::C_Attlist::, EAttlist_EqualContrib, false)
65 {
66  SET_ENUM_INTERNAL_NAME("Author.Attlist", "EqualContrib");
67  SET_ENUM_MODULE("efetch");
68  ADD_ENUM_VALUE("Y", eAttlist_EqualContrib_Y);
69  ADD_ENUM_VALUE("N", eAttlist_EqualContrib_N);
70 }
72 
74 {
75  ResetValidYN();
77 }
78 
80 {
81  SET_INTERNAL_NAME("Author", "Attlist");
82  SET_CLASS_MODULE("efetch");
83  ADD_NAMED_ENUM_MEMBER("ValidYN", m_ValidYN, EAttlist_ValidYN)->SetDefault(new TValidYN(eAttlist_ValidYN_Y))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional()->SetNsQualified(false);
84  ADD_NAMED_ENUM_MEMBER("EqualContrib", m_EqualContrib, EAttlist_EqualContrib)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional()->SetNsQualified(false);
85  info->SetRandomOrder(true);
86  info->CodeVersion(22400);
87  info->DataSpec(ncbi::EDataSpec::eXSD);
88 }
90 
91 // constructor
93  : m_ValidYN(eAttlist_ValidYN_Y), m_EqualContrib((EAttlist_EqualContrib)(0))
94 {
95  memset(m_set_State,0,sizeof(m_set_State));
96 }
97 
98 // destructor
100 {
101 }
102 
103 
105 {
106  if ( !m_LastName ) {
107  m_LastName.Reset(new TLastName());
108  return;
109  }
110  (*m_LastName).Reset();
111 }
112 
114 {
115  m_LastName.Reset(&value);
116 }
117 
119 {
120  m_ForeName.Reset();
121 }
122 
124 {
125  m_ForeName.Reset(&value);
126 }
127 
129 {
130  if ( !m_ForeName )
131  m_ForeName.Reset(new TForeName());
132  return (*m_ForeName);
133 }
134 
136 {
137  m_Initials.Reset();
138 }
139 
141 {
142  m_Initials.Reset(&value);
143 }
144 
146 {
147  if ( !m_Initials )
148  m_Initials.Reset(new TInitials());
149  return (*m_Initials);
150 }
151 
153 {
154  m_Suffix.Reset();
155 }
156 
158 {
159  m_Suffix.Reset(&value);
160 }
161 
163 {
164  if ( !m_Suffix )
165  m_Suffix.Reset(new TSuffix());
166  return (*m_Suffix);
167 }
168 
170 {
171  ResetLastName();
172  ResetForeName();
173  ResetInitials();
174  ResetSuffix();
175 }
176 
178 {
179  SET_INTERNAL_NAME("Author.LC", "LFIS");
180  SET_CLASS_MODULE("efetch");
181  ADD_NAMED_REF_MEMBER("LastName", m_LastName, CLastName);
182  ADD_NAMED_REF_MEMBER("ForeName", m_ForeName, CForeName)->SetOptional();
183  ADD_NAMED_REF_MEMBER("Initials", m_Initials, CInitials)->SetOptional();
184  ADD_NAMED_REF_MEMBER("Suffix", m_Suffix, CSuffix)->SetOptional();
185  info->RandomOrder();
186  info->CodeVersion(22400);
187  info->DataSpec(ncbi::EDataSpec::eXSD);
188 }
190 
191 // constructor
193 {
194  memset(m_set_State,0,sizeof(m_set_State));
195  if ( !IsAllocatedInPool() ) {
196  ResetLastName();
197  }
198 }
199 
200 // destructor
202 {
203 }
204 
205 
207 {
208  if ( m_choice != e_not_set )
209  ResetSelection();
210 }
211 
213 {
214  switch ( m_choice ) {
215  case e_LFIS:
216  case e_CollectiveName:
217  m_object->RemoveReference();
218  break;
219  default:
220  break;
221  }
222  m_choice = e_not_set;
223 }
224 
225 void CAuthor_Base::C_LC::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
226 {
227  switch ( index ) {
228  case e_LFIS:
229  (m_object = new(pool) C_LFIS())->AddReference();
230  break;
231  case e_CollectiveName:
232  (m_object = new(pool) eutils::CCollectiveName())->AddReference();
233  break;
234  default:
235  break;
236  }
237  m_choice = index;
238 }
239 
240 const char* const CAuthor_Base::C_LC::sm_SelectionNames[] = {
241  "not set",
242  "LFIS",
243  "CollectiveName"
244 };
245 
247 {
248  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
249 }
250 
252 {
253  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
254 }
255 
257 {
258  CheckSelected(e_LFIS);
259  return *static_cast<const TLFIS*>(m_object);
260 }
261 
263 {
264  Select(e_LFIS, NCBI_NS_NCBI::eDoNotResetVariant);
265  return *static_cast<TLFIS*>(m_object);
266 }
267 
269 {
270  TLFIS* ptr = &value;
271  if ( m_choice != e_LFIS || m_object != ptr ) {
272  ResetSelection();
273  (m_object = ptr)->AddReference();
274  m_choice = e_LFIS;
275  }
276 }
277 
279 {
280  CheckSelected(e_CollectiveName);
281  return *static_cast<const TCollectiveName*>(m_object);
282 }
283 
285 {
286  Select(e_CollectiveName, NCBI_NS_NCBI::eDoNotResetVariant);
287  return *static_cast<TCollectiveName*>(m_object);
288 }
289 
291 {
292  TCollectiveName* ptr = &value;
293  if ( m_choice != e_CollectiveName || m_object != ptr ) {
294  ResetSelection();
295  (m_object = ptr)->AddReference();
296  m_choice = e_CollectiveName;
297  }
298 }
299 
300 // helper methods
301 
302 // type info
304 {
305  SET_INTERNAL_NAME("Author", "LC");
306  SET_CHOICE_MODULE("efetch");
307  ADD_NAMED_REF_CHOICE_VARIANT("LFIS", m_object, C_LFIS)->SetNotag();
308  ADD_NAMED_REF_CHOICE_VARIANT("CollectiveName", m_object, CCollectiveName);
309  info->CodeVersion(22400);
310  info->DataSpec(ncbi::EDataSpec::eXSD);
311 }
313 
314 // constructor
316  : m_choice(e_not_set)
317 {
318 }
319 
320 // destructor
322 {
323  Reset();
324 }
325 
326 
328 {
329  if ( !m_Attlist ) {
330  m_Attlist.Reset(new TAttlist());
331  return;
332  }
333  (*m_Attlist).Reset();
334 }
335 
337 {
338  m_Attlist.Reset(&value);
339 }
340 
342 {
343  if ( !m_LC ) {
344  m_LC.Reset(new TLC());
345  return;
346  }
347  (*m_LC).Reset();
348 }
349 
351 {
352  m_LC.Reset(&value);
353 }
354 
356 {
357  m_Identifier.clear();
358  m_set_State[0] &= ~0x30;
359 }
360 
362 {
363  m_AffiliationInfo.clear();
364  m_set_State[0] &= ~0xc0;
365 }
366 
367 void CAuthor_Base::Reset(void)
368 {
369  ResetAttlist();
370  ResetLC();
371  ResetIdentifier();
373 }
374 
376 {
377  SET_CLASS_MODULE("efetch");
378  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
379  ADD_NAMED_REF_MEMBER("Attlist", m_Attlist, C_Attlist)->SetAttlist();
380  ADD_NAMED_REF_MEMBER("LC", m_LC, C_LC)->SetNotag();
381  ADD_NAMED_MEMBER("Identifier", m_Identifier, STL_list, (STL_CRef, (CLASS, (CIdentifier))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
382  ADD_NAMED_MEMBER("AffiliationInfo", m_AffiliationInfo, STL_list, (STL_CRef, (CLASS, (CAffiliationInfo))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
383  info->RandomOrder();
384  info->CodeVersion(22400);
385  info->DataSpec(ncbi::EDataSpec::eXSD);
386 }
388 
389 // constructor
391 {
392  memset(m_set_State,0,sizeof(m_set_State));
393  if ( !IsAllocatedInPool() ) {
394  ResetAttlist();
395  ResetLC();
396  }
397 }
398 
399 // destructor
401 {
402 }
403 
404 
405 
406 END_eutils_SCOPE // namespace eutils::
407 
#define BEGIN_eutils_SCOPE
Definition: Abstract_.hpp:51
#define END_eutils_SCOPE
Definition: Abstract_.hpp:52
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
END_ENUM_INFO
Definition: aln_errors.cpp:58
CAffiliationInfo –.
C_Attlist –.
Definition: Author_.hpp:98
CAuthor –.
Definition: Author.hpp:59
CCollectiveName –.
CForeName –.
Definition: ForeName.hpp:64
CIdentifier –.
Definition: Identifier.hpp:64
CInitials –.
Definition: Initials.hpp:64
CLastName –.
Definition: LastName.hpp:64
CSuffix –.
Definition: Suffix.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
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
bool IsAllocatedInPool(void) const THROWS_NONE
Check if object is allocated in memory pool (not system heap)
Definition: ncbiobj.hpp:461
virtual void Reset(void)
Reset the whole object.
Definition: Author_.cpp:103
virtual ~CAuthor_Base(void)
Definition: Author_.cpp:137
Uint4 m_set_State[1]
Definition: Author_.hpp:322
CAuthor_Base(void)
Definition: Author_.cpp:127
void Reset(void)
Reset data member.
Definition: Suffix_.cpp:156
void ResetLC(void)
Reset LC data member.
Definition: Author_.cpp:341
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Author_.cpp:246
void ResetIdentifier(void)
Reset Identifier data member.
Definition: Author_.cpp:355
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: Author_.cpp:225
void Reset(void)
Reset the whole object.
Definition: Author_.cpp:169
TCollectiveName & SetCollectiveName(void)
Select the variant.
Definition: Author_.cpp:284
static const char *const sm_SelectionNames[]
Definition: Author_.hpp:576
void ResetEqualContrib(void)
Reset EqualContrib data member.
Definition: Author_.hpp:825
void ResetInitials(void)
Reset Initials data member.
Definition: Author_.cpp:135
TInitials & SetInitials(void)
Assign a value to Initials data member.
Definition: Author_.cpp:145
void Reset(void)
Reset data member.
Definition: Initials_.cpp:48
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CAffiliationInfo > > m_AffiliationInfo
Definition: Author_.hpp:749
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Author_.cpp:212
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Author_.cpp:251
void Reset(void)
Reset the whole object.
Definition: Author_.cpp:73
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< CIdentifier > > m_Identifier
Definition: Author_.hpp:748
void ResetAttlist(void)
Reset Attlist data member.
Definition: Author_.cpp:327
C_Attlist TAttlist
Definition: Author_.hpp:581
const TCollectiveName & GetCollectiveName(void) const
Get the variant data.
Definition: Author_.cpp:278
void Reset(void)
Reset data member.
Definition: ForeName_.cpp:48
const TLFIS & GetLFIS(void) const
Get the variant data.
Definition: Author_.cpp:256
NCBI_NS_NCBI::CRef< TLC > m_LC
Definition: Author_.hpp:747
void Reset(void)
Reset data member.
Definition: LastName_.cpp:48
void ResetSuffix(void)
Reset Suffix data member.
Definition: Author_.cpp:152
TAttlist & SetAttlist(void)
Assign a value to Attlist data member.
Definition: Author_.hpp:1015
void ResetForeName(void)
Reset ForeName data member.
Definition: Author_.cpp:118
TSuffix & SetSuffix(void)
Assign a value to Suffix data member.
Definition: Author_.cpp:162
void ResetValidYN(void)
Reset ValidYN data member.
Definition: Author_.hpp:774
TLastName & SetLastName(void)
Assign a value to LastName data member.
Definition: Author_.hpp:881
TLC & SetLC(void)
Assign a value to LC data member.
Definition: Author_.hpp:1045
TForeName & SetForeName(void)
Assign a value to ForeName data member.
Definition: Author_.cpp:128
void Reset(void)
Reset the whole object.
Definition: Author_.cpp:206
void ResetAffiliationInfo(void)
Reset AffiliationInfo data member.
Definition: Author_.cpp:361
NCBI_NS_NCBI::CRef< TAttlist > m_Attlist
Definition: Author_.hpp:746
void ResetLastName(void)
Reset LastName data member.
Definition: Author_.cpp:104
E_Choice
Choice variants.
Definition: Author_.hpp:450
TLFIS & SetLFIS(void)
Select the variant.
Definition: Author_.cpp:262
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
BEGIN_NAMED_BASE_CLASS_INFO("Author", CAuthor)
Definition: Author_.cpp:112
BEGIN_NAMED_ENUM_IN_INFO("", CAuthor_Base::, ELevel, false)
Definition: Author_.cpp:52
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CAuthor_Base::C_LC)
Definition: Author_.cpp:303
BEGIN_NAMED_CLASS_INFO("", CAuthor_Base::C_Attlist)
Definition: Author_.cpp:79
Modified on Thu Jun 13 17:26:20 2024 by modify_doxy.py rev. 669887