NCBI C++ ToolKit
PubDate_.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
48 BEGIN_eutils_SCOPE // namespace eutils::
49 
50 
51 // generated classes
52 
54 {
55  if ( !m_Month ) {
56  m_Month.Reset(new TMonth());
57  return;
58  }
59  (*m_Month).Reset();
60 }
61 
63 {
64  m_Month.Reset(&value);
65 }
66 
68 {
69  m_Day.Reset();
70 }
71 
73 {
74  m_Day.Reset(&value);
75 }
76 
78 {
79  if ( !m_Day )
80  m_Day.Reset(new TDay());
81  return (*m_Day);
82 }
83 
85 {
86  ResetMonth();
87  ResetDay();
88 }
89 
91 {
92  SET_INTERNAL_NAME("PubDate.YM.MS", "MD");
93  SET_CLASS_MODULE("efetch");
94  ADD_NAMED_REF_MEMBER("Month", m_Month, CMonth);
95  ADD_NAMED_REF_MEMBER("Day", m_Day, CDay)->SetOptional();
96  info->RandomOrder();
97  info->CodeVersion(22301);
98  info->DataSpec(ncbi::EDataSpec::eXSD);
99 }
101 
102 // constructor
104 {
105  memset(m_set_State,0,sizeof(m_set_State));
106  if ( !IsAllocatedInPool() ) {
107  ResetMonth();
108  }
109 }
110 
111 // destructor
113 {
114 }
115 
116 
118 {
119  if ( m_choice != e_not_set )
120  ResetSelection();
121 }
122 
124 {
125  switch ( m_choice ) {
126  case e_MD:
127  case e_Season:
128  m_object->RemoveReference();
129  break;
130  default:
131  break;
132  }
134 }
135 
136 void CPubDate_Base::C_YM::C_MS::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
137 {
138  switch ( index ) {
139  case e_MD:
140  (m_object = new(pool) C_MD())->AddReference();
141  break;
142  case e_Season:
143  (m_object = new(pool) eutils::CSeason())->AddReference();
144  break;
145  default:
146  break;
147  }
148  m_choice = index;
149 }
150 
151 const char* const CPubDate_Base::C_YM::C_MS::sm_SelectionNames[] = {
152  "not set",
153  "MD",
154  "Season"
155 };
156 
158 {
159  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
160 }
161 
163 {
164  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
165 }
166 
168 {
170  return *static_cast<const TMD*>(m_object);
171 }
172 
174 {
176  return *static_cast<TMD*>(m_object);
177 }
178 
180 {
181  TMD* ptr = &value;
182  if ( m_choice != e_MD || m_object != ptr ) {
183  ResetSelection();
184  (m_object = ptr)->AddReference();
185  m_choice = e_MD;
186  }
187 }
188 
190 {
192  return *static_cast<const TSeason*>(m_object);
193 }
194 
196 {
198  return *static_cast<TSeason*>(m_object);
199 }
200 
202 {
203  TSeason* ptr = &value;
204  if ( m_choice != e_Season || m_object != ptr ) {
205  ResetSelection();
206  (m_object = ptr)->AddReference();
207  m_choice = e_Season;
208  }
209 }
210 
211 // helper methods
212 
213 // type info
215 {
216  SET_INTERNAL_NAME("PubDate.YM", "MS");
217  SET_CHOICE_MODULE("efetch");
218  ADD_NAMED_REF_CHOICE_VARIANT("MD", m_object, C_MD)->SetNotag();
220  info->CodeVersion(22301);
221  info->DataSpec(ncbi::EDataSpec::eXSD);
222 }
224 
225 // constructor
228 {
229 }
230 
231 // destructor
233 {
234  Reset();
235 }
236 
237 
239 {
240  if ( !m_Year ) {
241  m_Year.Reset(new TYear());
242  return;
243  }
244  (*m_Year).Reset();
245 }
246 
248 {
249  m_Year.Reset(&value);
250 }
251 
253 {
254  m_MS.Reset();
255 }
256 
258 {
259  m_MS.Reset(&value);
260 }
261 
263 {
264  if ( !m_MS )
265  m_MS.Reset(new TMS());
266  return (*m_MS);
267 }
268 
270 {
271  ResetYear();
272  ResetMS();
273 }
274 
276 {
277  SET_INTERNAL_NAME("PubDate", "YM");
278  SET_CLASS_MODULE("efetch");
280  ADD_NAMED_REF_MEMBER("MS", m_MS, C_MS)->SetOptional()->SetNotag();
281  info->RandomOrder();
282  info->CodeVersion(22301);
283  info->DataSpec(ncbi::EDataSpec::eXSD);
284 }
286 
287 // constructor
289 {
290  memset(m_set_State,0,sizeof(m_set_State));
291  if ( !IsAllocatedInPool() ) {
292  ResetYear();
293  }
294 }
295 
296 // destructor
298 {
299 }
300 
301 
303 {
304  if ( m_choice != e_not_set )
305  ResetSelection();
306 }
307 
309 {
310  switch ( m_choice ) {
311  case e_YM:
312  case e_MedlineDate:
313  m_object->RemoveReference();
314  break;
315  default:
316  break;
317  }
319 }
320 
321 void CPubDate_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
322 {
323  switch ( index ) {
324  case e_YM:
325  (m_object = new(pool) C_YM())->AddReference();
326  break;
327  case e_MedlineDate:
328  (m_object = new(pool) eutils::CMedlineDate())->AddReference();
329  break;
330  default:
331  break;
332  }
333  m_choice = index;
334 }
335 
336 const char* const CPubDate_Base::sm_SelectionNames[] = {
337  "not set",
338  "YM",
339  "MedlineDate"
340 };
341 
343 {
344  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
345 }
346 
348 {
349  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
350 }
351 
353 {
355  return *static_cast<const TYM*>(m_object);
356 }
357 
359 {
361  return *static_cast<TYM*>(m_object);
362 }
363 
365 {
366  TYM* ptr = &value;
367  if ( m_choice != e_YM || m_object != ptr ) {
368  ResetSelection();
369  (m_object = ptr)->AddReference();
370  m_choice = e_YM;
371  }
372 }
373 
375 {
377  return *static_cast<const TMedlineDate*>(m_object);
378 }
379 
381 {
383  return *static_cast<TMedlineDate*>(m_object);
384 }
385 
387 {
388  TMedlineDate* ptr = &value;
389  if ( m_choice != e_MedlineDate || m_object != ptr ) {
390  ResetSelection();
391  (m_object = ptr)->AddReference();
393  }
394 }
395 
396 // helper methods
397 
398 // type info
400 {
401  SET_CHOICE_MODULE("efetch");
402  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
403  ADD_NAMED_REF_CHOICE_VARIANT("YM", m_object, C_YM)->SetNotag();
405  info->CodeVersion(22301);
406  info->DataSpec(ncbi::EDataSpec::eXSD);
407 }
409 
410 // constructor
413 {
414 }
415 
416 // destructor
418 {
419  Reset();
420 }
421 
422 
423 
424 END_eutils_SCOPE // namespace eutils::
425 
#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.
BEGIN_NAMED_CLASS_INFO("", CPubDate_Base::C_YM::C_MS::C_MD)
Definition: PubDate_.cpp:90
BEGIN_NAMED_CHOICE_INFO("", CPubDate_Base::C_YM::C_MS)
Definition: PubDate_.cpp:214
BEGIN_NAMED_BASE_CHOICE_INFO("PubDate", CPubDate)
Definition: PubDate_.cpp:399
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CDay –.
Definition: Day.hpp:64
CMedlineDate –.
Definition: MedlineDate.hpp:64
CMonth –.
Definition: Month.hpp:64
CPubDate –.
Definition: PubDate.hpp:64
CSeason –.
Definition: Season.hpp:64
CYear –.
Definition: Year.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 ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#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
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: PubDate_.hpp:675
E_Choice
Choice variants.
Definition: PubDate_.hpp:477
NCBI_NS_NCBI::CSerialObject * m_object
Definition: PubDate_.hpp:605
void Reset(void)
Reset the whole object.
Definition: PubDate_.cpp:117
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: PubDate_.hpp:767
TYM & SetYM(void)
Select the variant.
Definition: PubDate_.cpp:358
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: PubDate_.cpp:342
const TYM & GetYM(void) const
Get the variant data.
Definition: PubDate_.cpp:352
TMedlineDate & SetMedlineDate(void)
Select the variant.
Definition: PubDate_.cpp:380
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: PubDate_.cpp:321
virtual ~CPubDate_Base(void)
Definition: PubDate_.cpp:417
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: PubDate_.cpp:123
TMS & SetMS(void)
Assign a value to MS data member.
Definition: PubDate_.cpp:262
void Reset(void)
Reset the whole object.
Definition: PubDate_.cpp:84
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: PubDate_.cpp:162
NCBI_NS_NCBI::CRef< TMonth > m_Month
Definition: PubDate_.hpp:237
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: PubDate_.cpp:347
static const char *const sm_SelectionNames[]
Definition: PubDate_.hpp:603
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
Definition: PubDate_.hpp:692
Uint4 m_set_State[1]
Definition: PubDate_.hpp:471
E_Choice
Choice variants.
Definition: PubDate_.hpp:242
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: PubDate_.cpp:308
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: PubDate_.cpp:136
TYear & SetYear(void)
Assign a value to Year data member.
Definition: PubDate_.hpp:731
void ResetMonth(void)
Reset Month data member.
Definition: PubDate_.cpp:53
void Reset(void)
Reset data member.
Definition: Day_.cpp:48
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: PubDate_.cpp:157
void ResetMS(void)
Reset MS data member.
Definition: PubDate_.cpp:252
TDay & SetDay(void)
Assign a value to Day data member.
Definition: PubDate_.cpp:77
E_Choice m_choice
Definition: PubDate_.hpp:599
const TMD & GetMD(void) const
Get the variant data.
Definition: PubDate_.cpp:167
CPubDate_Base(void)
Definition: PubDate_.cpp:411
NCBI_NS_NCBI::CRef< TYear > m_Year
Definition: PubDate_.hpp:472
NCBI_NS_NCBI::CRef< TMS > m_MS
Definition: PubDate_.hpp:473
NCBI_NS_NCBI::CSerialObject * m_object
Definition: PubDate_.hpp:370
const TSeason & GetSeason(void) const
Get the variant data.
Definition: PubDate_.cpp:189
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
Definition: PubDate_.hpp:784
TMD & SetMD(void)
Select the variant.
Definition: PubDate_.cpp:173
void Reset(void)
Reset data member.
Definition: Month_.cpp:48
void ResetDay(void)
Reset Day data member.
Definition: PubDate_.cpp:67
virtual void Reset(void)
Reset the whole object.
Definition: PubDate_.cpp:302
TMonth & SetMonth(void)
Assign a value to Month data member.
Definition: PubDate_.hpp:639
void ResetYear(void)
Reset Year data member.
Definition: PubDate_.cpp:238
static const char *const sm_SelectionNames[]
Definition: PubDate_.hpp:368
void Reset(void)
Reset the whole object.
Definition: PubDate_.cpp:269
TSeason & SetSeason(void)
Select the variant.
Definition: PubDate_.cpp:195
const TMedlineDate & GetMedlineDate(void) const
Get the variant data.
Definition: PubDate_.cpp:374
@ e_not_set
No variant selected.
Definition: PubDate_.hpp:478
@ e_not_set
No variant selected.
Definition: PubDate_.hpp:243
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sun Apr 14 05:26:11 2024 by modify_doxy.py rev. 669887