NCBI C++ ToolKit
Pagination_.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
46 BEGIN_eutils_SCOPE // namespace eutils::
47 
48 
49 // generated classes
50 
52 {
53  if ( !m_StartPage ) {
54  m_StartPage.Reset(new TStartPage());
55  return;
56  }
57  (*m_StartPage).Reset();
58 }
59 
61 {
62  m_StartPage.Reset(&value);
63 }
64 
66 {
67  m_EndPage.Reset();
68 }
69 
71 {
72  m_EndPage.Reset(&value);
73 }
74 
76 {
77  if ( !m_EndPage )
78  m_EndPage.Reset(new TEndPage());
79  return (*m_EndPage);
80 }
81 
83 {
84  m_MedlinePgn.Reset();
85 }
86 
88 {
89  m_MedlinePgn.Reset(&value);
90 }
91 
93 {
94  if ( !m_MedlinePgn )
95  m_MedlinePgn.Reset(new TMedlinePgn());
96  return (*m_MedlinePgn);
97 }
98 
100 {
101  ResetStartPage();
102  ResetEndPage();
103  ResetMedlinePgn();
104 }
105 
107 {
108  SET_INTERNAL_NAME("Pagination", "SEM");
109  SET_CLASS_MODULE("efetch");
110  ADD_NAMED_REF_MEMBER("StartPage", m_StartPage, CStartPage);
111  ADD_NAMED_REF_MEMBER("EndPage", m_EndPage, CEndPage)->SetOptional();
112  ADD_NAMED_REF_MEMBER("MedlinePgn", m_MedlinePgn, CMedlinePgn)->SetOptional();
113  info->RandomOrder();
114  info->CodeVersion(22400);
115  info->DataSpec(ncbi::EDataSpec::eXSD);
116 }
118 
119 // constructor
121 {
122  memset(m_set_State,0,sizeof(m_set_State));
123  if ( !IsAllocatedInPool() ) {
124  ResetStartPage();
125  }
126 }
127 
128 // destructor
130 {
131 }
132 
133 
135 {
136  if ( m_choice != e_not_set )
137  ResetSelection();
138 }
139 
141 {
142  switch ( m_choice ) {
143  case e_SEM:
144  case e_MedlinePgn:
145  m_object->RemoveReference();
146  break;
147  default:
148  break;
149  }
151 }
152 
153 void CPagination_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
154 {
155  switch ( index ) {
156  case e_SEM:
157  (m_object = new(pool) C_SEM())->AddReference();
158  break;
159  case e_MedlinePgn:
160  (m_object = new(pool) eutils::CMedlinePgn())->AddReference();
161  break;
162  default:
163  break;
164  }
165  m_choice = index;
166 }
167 
168 const char* const CPagination_Base::sm_SelectionNames[] = {
169  "not set",
170  "SEM",
171  "MedlinePgn"
172 };
173 
175 {
176  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
177 }
178 
180 {
181  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
182 }
183 
185 {
187  return *static_cast<const TSEM*>(m_object);
188 }
189 
191 {
193  return *static_cast<TSEM*>(m_object);
194 }
195 
197 {
198  TSEM* ptr = &value;
199  if ( m_choice != e_SEM || m_object != ptr ) {
200  ResetSelection();
201  (m_object = ptr)->AddReference();
202  m_choice = e_SEM;
203  }
204 }
205 
207 {
209  return *static_cast<const TMedlinePgn*>(m_object);
210 }
211 
213 {
215  return *static_cast<TMedlinePgn*>(m_object);
216 }
217 
219 {
220  TMedlinePgn* ptr = &value;
221  if ( m_choice != e_MedlinePgn || m_object != ptr ) {
222  ResetSelection();
223  (m_object = ptr)->AddReference();
225  }
226 }
227 
228 // helper methods
229 
230 // type info
232 {
233  SET_CHOICE_MODULE("efetch");
234  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
235  ADD_NAMED_REF_CHOICE_VARIANT("SEM", m_object, C_SEM)->SetNotag();
237  info->CodeVersion(22400);
238  info->DataSpec(ncbi::EDataSpec::eXSD);
239 }
241 
242 // constructor
245 {
246 }
247 
248 // destructor
250 {
251  Reset();
252 }
253 
254 
255 
256 END_eutils_SCOPE // namespace eutils::
257 
#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.
BEGIN_NAMED_CLASS_INFO("", CPagination_Base::C_SEM)
BEGIN_NAMED_BASE_CHOICE_INFO("Pagination", CPagination)
CEndPage –.
Definition: EndPage.hpp:64
CMedlinePgn –.
Definition: MedlinePgn.hpp:64
CPagination –.
Definition: Pagination.hpp:64
CStartPage –.
Definition: StartPage.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
TEndPage & SetEndPage(void)
Assign a value to EndPage data member.
Definition: Pagination_.cpp:75
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TMedlinePgn & SetMedlinePgn(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TStartPage & SetStartPage(void)
Assign a value to StartPage data member.
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
CMedlinePgn TMedlinePgn
void Reset(void)
Reset data member.
Definition: StartPage_.cpp:48
const TMedlinePgn & GetMedlinePgn(void) const
Get the variant data.
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
const TSEM & GetSEM(void) const
Get the variant data.
void Reset(void)
Reset data member.
Definition: MedlinePgn_.cpp:48
void Reset(void)
Reset the whole object.
Definition: Pagination_.cpp:99
static const char *const sm_SelectionNames[]
void Reset(void)
Reset data member.
Definition: EndPage_.cpp:48
TMedlinePgn & SetMedlinePgn(void)
Assign a value to MedlinePgn data member.
Definition: Pagination_.cpp:92
void ResetEndPage(void)
Reset EndPage data member.
Definition: Pagination_.cpp:65
virtual ~CPagination_Base(void)
TSEM & SetSEM(void)
Select the variant.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
E_Choice
Choice variants.
void ResetStartPage(void)
Reset StartPage data member.
Definition: Pagination_.cpp:51
void ResetMedlinePgn(void)
Reset MedlinePgn data member.
Definition: Pagination_.cpp:82
void Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset=NCBI_NS_NCBI::eDoResetVariant)
Select the requested variant if needed.
NCBI_NS_NCBI::CRef< TStartPage > m_StartPage
virtual void Reset(void)
Reset the whole object.
NCBI_NS_NCBI::CSerialObject * m_object
@ e_not_set
No variant selected.
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.
Modified on Sat Apr 20 12:19:21 2024 by modify_doxy.py rev. 669887