NCBI C++ ToolKit
E2Request_.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  * 'entrez2.asn'.
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
51 
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 
55 // generated classes
56 
58 {
59  if ( m_choice != e_not_set )
61 }
62 
64 {
65  switch ( m_choice ) {
66  case e_Eval_boolean:
67  case e_Get_docsum:
68  case e_Get_term_pos:
69  case e_Get_term_list:
71  case e_Get_links:
72  case e_Get_linked:
73  case e_Get_link_counts:
74  m_object->RemoveReference();
75  break;
76  default:
77  break;
78  }
80 }
81 
82 void CE2Request_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
83 {
84  switch ( index ) {
85  case e_Eval_boolean:
86  (m_object = new(pool) ncbi::objects::CEntrez2_eval_boolean())->AddReference();
87  break;
88  case e_Get_docsum:
89  (m_object = new(pool) ncbi::objects::CEntrez2_id_list())->AddReference();
90  break;
91  case e_Get_term_pos:
92  (m_object = new(pool) ncbi::objects::CEntrez2_term_query())->AddReference();
93  break;
94  case e_Get_term_list:
95  (m_object = new(pool) ncbi::objects::CEntrez2_term_pos())->AddReference();
96  break;
98  (m_object = new(pool) ncbi::objects::CEntrez2_hier_query())->AddReference();
99  break;
100  case e_Get_links:
101  (m_object = new(pool) ncbi::objects::CEntrez2_get_links())->AddReference();
102  break;
103  case e_Get_linked:
104  (m_object = new(pool) ncbi::objects::CEntrez2_get_links())->AddReference();
105  break;
106  case e_Get_link_counts:
107  (m_object = new(pool) ncbi::objects::CEntrez2_id())->AddReference();
108  break;
109  default:
110  break;
111  }
112  m_choice = index;
113 }
114 
115 const char* const CE2Request_Base::sm_SelectionNames[] = {
116  "not set",
117  "get-info",
118  "eval-boolean",
119  "get-docsum",
120  "get-term-pos",
121  "get-term-list",
122  "get-term-hierarchy",
123  "get-links",
124  "get-linked",
125  "get-link-counts"
126 };
127 
129 {
130  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
131 }
132 
134 {
135  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
136 }
137 
139 {
141  return *static_cast<const TEval_boolean*>(m_object);
142 }
143 
145 {
147  return *static_cast<TEval_boolean*>(m_object);
148 }
149 
151 {
152  TEval_boolean* ptr = &value;
153  if ( m_choice != e_Eval_boolean || m_object != ptr ) {
154  ResetSelection();
155  (m_object = ptr)->AddReference();
157  }
158 }
159 
161 {
163  return *static_cast<const TGet_docsum*>(m_object);
164 }
165 
167 {
169  return *static_cast<TGet_docsum*>(m_object);
170 }
171 
173 {
174  TGet_docsum* ptr = &value;
175  if ( m_choice != e_Get_docsum || m_object != ptr ) {
176  ResetSelection();
177  (m_object = ptr)->AddReference();
179  }
180 }
181 
183 {
185  return *static_cast<const TGet_term_pos*>(m_object);
186 }
187 
189 {
191  return *static_cast<TGet_term_pos*>(m_object);
192 }
193 
195 {
196  TGet_term_pos* ptr = &value;
197  if ( m_choice != e_Get_term_pos || m_object != ptr ) {
198  ResetSelection();
199  (m_object = ptr)->AddReference();
201  }
202 }
203 
205 {
207  return *static_cast<const TGet_term_list*>(m_object);
208 }
209 
211 {
213  return *static_cast<TGet_term_list*>(m_object);
214 }
215 
217 {
218  TGet_term_list* ptr = &value;
219  if ( m_choice != e_Get_term_list || m_object != ptr ) {
220  ResetSelection();
221  (m_object = ptr)->AddReference();
223  }
224 }
225 
227 {
229  return *static_cast<const TGet_term_hierarchy*>(m_object);
230 }
231 
233 {
235  return *static_cast<TGet_term_hierarchy*>(m_object);
236 }
237 
239 {
240  TGet_term_hierarchy* ptr = &value;
241  if ( m_choice != e_Get_term_hierarchy || m_object != ptr ) {
242  ResetSelection();
243  (m_object = ptr)->AddReference();
245  }
246 }
247 
249 {
251  return *static_cast<const TGet_links*>(m_object);
252 }
253 
255 {
257  return *static_cast<TGet_links*>(m_object);
258 }
259 
261 {
262  TGet_links* ptr = &value;
263  if ( m_choice != e_Get_links || m_object != ptr ) {
264  ResetSelection();
265  (m_object = ptr)->AddReference();
267  }
268 }
269 
271 {
273  return *static_cast<const TGet_linked*>(m_object);
274 }
275 
277 {
279  return *static_cast<TGet_linked*>(m_object);
280 }
281 
283 {
284  TGet_linked* ptr = &value;
285  if ( m_choice != e_Get_linked || m_object != ptr ) {
286  ResetSelection();
287  (m_object = ptr)->AddReference();
289  }
290 }
291 
293 {
295  return *static_cast<const TGet_link_counts*>(m_object);
296 }
297 
299 {
301  return *static_cast<TGet_link_counts*>(m_object);
302 }
303 
305 {
306  TGet_link_counts* ptr = &value;
307  if ( m_choice != e_Get_link_counts || m_object != ptr ) {
308  ResetSelection();
309  (m_object = ptr)->AddReference();
311  }
312 }
313 
314 // helper methods
315 
316 // type info
318 {
319  SET_CHOICE_MODULE("NCBI-Entrez2");
320  ADD_NAMED_NULL_CHOICE_VARIANT("get-info", null, ());
321  ADD_NAMED_REF_CHOICE_VARIANT("eval-boolean", m_object, CEntrez2_eval_boolean);
322  ADD_NAMED_REF_CHOICE_VARIANT("get-docsum", m_object, CEntrez2_id_list);
323  ADD_NAMED_REF_CHOICE_VARIANT("get-term-pos", m_object, CEntrez2_term_query);
324  ADD_NAMED_REF_CHOICE_VARIANT("get-term-list", m_object, CEntrez2_term_pos);
325  ADD_NAMED_REF_CHOICE_VARIANT("get-term-hierarchy", m_object, CEntrez2_hier_query);
326  ADD_NAMED_REF_CHOICE_VARIANT("get-links", m_object, CEntrez2_get_links);
327  ADD_NAMED_REF_CHOICE_VARIANT("get-linked", m_object, CEntrez2_get_links);
328  ADD_NAMED_REF_CHOICE_VARIANT("get-link-counts", m_object, CEntrez2_id);
329  info->CodeVersion(22400);
330  info->DataSpec(ncbi::EDataSpec::eASN);
331 }
333 
334 // constructor
336  : m_choice(e_not_set)
337 {
338 }
339 
340 // destructor
342 {
343  Reset();
344 }
345 
346 
347 
348 END_objects_SCOPE // namespace ncbi::objects::
349 
351 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("E2Request", CE2Request)
Definition: E2Request_.cpp:317
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.
CE2Request –.
Definition: E2Request.hpp:66
CEntrez2_eval_boolean –.
CEntrez2_hier_query –.
CEntrez2_id –.
Definition: Entrez2_id.hpp:66
CEntrez2_term_pos –.
CEntrez2_term_query –.
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_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:379
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TGet_term_hierarchy & SetGet_term_hierarchy(void)
Select the variant.
Definition: E2Request_.cpp:232
const TGet_docsum & GetGet_docsum(void) const
Get the variant data.
Definition: E2Request_.cpp:160
E_Choice m_choice
Definition: E2Request_.hpp:395
TGet_link_counts & SetGet_link_counts(void)
Select the variant.
Definition: E2Request_.cpp:298
TGet_term_pos & SetGet_term_pos(void)
Select the variant.
Definition: E2Request_.cpp:188
static const char *const sm_SelectionNames[]
Definition: E2Request_.hpp:399
const TEval_boolean & GetEval_boolean(void) const
Get the variant data.
Definition: E2Request_.cpp:138
const TGet_term_list & GetGet_term_list(void) const
Get the variant data.
Definition: E2Request_.cpp:204
const TGet_term_pos & GetGet_term_pos(void) const
Get the variant data.
Definition: E2Request_.cpp:182
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: E2Request_.cpp:63
const TGet_linked & GetGet_linked(void) const
Get the variant data.
Definition: E2Request_.cpp:270
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: E2Request_.cpp:128
const TGet_links & GetGet_links(void) const
Get the variant data.
Definition: E2Request_.cpp:248
TGet_docsum & SetGet_docsum(void)
Select the variant.
Definition: E2Request_.cpp:166
virtual void Reset(void)
Reset the whole object.
Definition: E2Request_.cpp:57
NCBI_NS_NCBI::CSerialObject * m_object
Definition: E2Request_.hpp:402
TEval_boolean & SetEval_boolean(void)
Select the variant.
Definition: E2Request_.cpp:144
const TGet_link_counts & GetGet_link_counts(void) const
Get the variant data.
Definition: E2Request_.cpp:292
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: E2Request_.cpp:133
TGet_linked & SetGet_linked(void)
Select the variant.
Definition: E2Request_.cpp:276
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: E2Request_.hpp:422
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
virtual ~CE2Request_Base(void)
Definition: E2Request_.cpp:341
TGet_links & SetGet_links(void)
Select the variant.
Definition: E2Request_.cpp:254
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: E2Request_.cpp:82
const TGet_term_hierarchy & GetGet_term_hierarchy(void) const
Get the variant data.
Definition: E2Request_.cpp:226
E_Choice
Choice variants.
Definition: E2Request_.hpp:93
TGet_term_list & SetGet_term_list(void)
Select the variant.
Definition: E2Request_.cpp:210
@ e_Get_term_pos
get position in term list
Definition: E2Request_.hpp:98
@ e_Get_link_counts
get all links from one UID
Definition: E2Request_.hpp:103
@ e_Get_docsum
get the DocSums
Definition: E2Request_.hpp:97
@ e_Get_linked
get subset of UID list which has links
Definition: E2Request_.hpp:102
@ e_not_set
No variant selected.
Definition: E2Request_.hpp:94
@ e_Get_links
get specific links from a UID list
Definition: E2Request_.hpp:101
@ e_Get_term_list
get Term list by position
Definition: E2Request_.hpp:99
@ e_Get_term_hierarchy
get a hierarchy from a term
Definition: E2Request_.hpp:100
@ e_Eval_boolean
Boolean lookup.
Definition: E2Request_.hpp:96
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Mon May 20 05:03:51 2024 by modify_doxy.py rev. 669887