NCBI C++ ToolKit
Taxon1_req_.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  * 'taxon1.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
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 
50 // generated classes
51 
53 {
54  if ( m_choice != e_not_set )
56 }
57 
59 {
60  switch ( m_choice ) {
61  case e_Findname:
62  case e_Getdesignator:
63  case e_Getunique:
64  case e_Getdomain:
65  m_string.Destruct();
66  break;
67  case e_Getidbyorg:
68  case e_Lookup:
69  case e_Getorgmod:
70  case e_Getorgprop:
71  case e_Searchname:
72  m_object->RemoveReference();
73  break;
74  default:
75  break;
76  }
78 }
79 
80 void CTaxon1_req_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
81 {
82  switch ( index ) {
83  case e_Getidbyorg:
84  (m_object = new(pool) ncbi::objects::COrg_ref())->AddReference();
85  break;
86  case e_Getorgnames:
87  m_Getorgnames = 0;
88  break;
89  case e_Getlineage:
90  m_Getlineage = 0;
91  break;
92  case e_Getchildren:
93  m_Getchildren = 0;
94  break;
95  case e_Getbyid:
96  m_Getbyid = 0;
97  break;
98  case e_Lookup:
99  (m_object = new(pool) ncbi::objects::COrg_ref())->AddReference();
100  break;
101  case e_Getorgmod:
102  (m_object = new(pool) ncbi::objects::CTaxon1_info())->AddReference();
103  break;
104  case e_Id4gi:
105  m_Id4gi = 0;
106  break;
107  case e_Taxachildren:
108  m_Taxachildren = 0;
109  break;
110  case e_Taxalineage:
111  m_Taxalineage = 0;
112  break;
113  case e_Getorgprop:
114  (m_object = new(pool) ncbi::objects::CTaxon1_info())->AddReference();
115  break;
116  case e_Searchname:
117  (m_object = new(pool) ncbi::objects::CTaxon1_info())->AddReference();
118  break;
119  case e_Dumpnames4class:
120  m_Dumpnames4class = 0;
121  break;
122  case e_Findname:
123  case e_Getdesignator:
124  case e_Getunique:
125  case e_Getdomain:
126  m_string.Construct();
127  break;
128  default:
129  break;
130  }
131  m_choice = index;
132 }
133 
134 const char* const CTaxon1_req_Base::sm_SelectionNames[] = {
135  "not set",
136  "init",
137  "findname",
138  "getdesignator",
139  "getunique",
140  "getidbyorg",
141  "getorgnames",
142  "getcde",
143  "getranks",
144  "getdivs",
145  "getgcs",
146  "getlineage",
147  "getchildren",
148  "getbyid",
149  "lookup",
150  "getorgmod",
151  "fini",
152  "id4gi",
153  "taxachildren",
154  "taxalineage",
155  "maxtaxid",
156  "getproptypes",
157  "getorgprop",
158  "searchname",
159  "dumpnames4class",
160  "getdomain"
161 };
162 
164 {
165  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
166 }
167 
169 {
170  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
171 }
172 
174 {
176  *m_string = value;
177 }
178 
180 {
182  *m_string = value;
183 }
184 
186 {
188  *m_string = value;
189 }
190 
192 {
194  return *static_cast<const TGetidbyorg*>(m_object);
195 }
196 
198 {
200  return *static_cast<TGetidbyorg*>(m_object);
201 }
202 
204 {
205  TGetidbyorg* ptr = &value;
206  if ( m_choice != e_Getidbyorg || m_object != ptr ) {
207  ResetSelection();
208  (m_object = ptr)->AddReference();
210  }
211 }
212 
214 {
216  return *static_cast<const TLookup*>(m_object);
217 }
218 
220 {
222  return *static_cast<TLookup*>(m_object);
223 }
224 
226 {
227  TLookup* ptr = &value;
228  if ( m_choice != e_Lookup || m_object != ptr ) {
229  ResetSelection();
230  (m_object = ptr)->AddReference();
231  m_choice = e_Lookup;
232  }
233 }
234 
236 {
238  return *static_cast<const TGetorgmod*>(m_object);
239 }
240 
242 {
244  return *static_cast<TGetorgmod*>(m_object);
245 }
246 
248 {
249  TGetorgmod* ptr = &value;
250  if ( m_choice != e_Getorgmod || m_object != ptr ) {
251  ResetSelection();
252  (m_object = ptr)->AddReference();
254  }
255 }
256 
258 {
260  return *static_cast<const TGetorgprop*>(m_object);
261 }
262 
264 {
266  return *static_cast<TGetorgprop*>(m_object);
267 }
268 
270 {
271  TGetorgprop* ptr = &value;
272  if ( m_choice != e_Getorgprop || m_object != ptr ) {
273  ResetSelection();
274  (m_object = ptr)->AddReference();
276  }
277 }
278 
280 {
282  return *static_cast<const TSearchname*>(m_object);
283 }
284 
286 {
288  return *static_cast<TSearchname*>(m_object);
289 }
290 
292 {
293  TSearchname* ptr = &value;
294  if ( m_choice != e_Searchname || m_object != ptr ) {
295  ResetSelection();
296  (m_object = ptr)->AddReference();
298  }
299 }
300 
302 {
304  *m_string = value;
305 }
306 
307 // helper methods
308 
309 // type info
311 {
312  SET_CHOICE_MODULE("NCBI-Taxon1");
313  ADD_NAMED_NULL_CHOICE_VARIANT("init", null, ());
314  ADD_NAMED_BUF_CHOICE_VARIANT("findname", m_string, STD, (string));
315  ADD_NAMED_BUF_CHOICE_VARIANT("getdesignator", m_string, STD, (string));
316  ADD_NAMED_BUF_CHOICE_VARIANT("getunique", m_string, STD, (string));
317  ADD_NAMED_REF_CHOICE_VARIANT("getidbyorg", m_object, COrg_ref);
318  ADD_NAMED_STD_CHOICE_VARIANT("getorgnames", m_Getorgnames);
319  ADD_NAMED_NULL_CHOICE_VARIANT("getcde", null, ());
320  ADD_NAMED_NULL_CHOICE_VARIANT("getranks", null, ());
321  ADD_NAMED_NULL_CHOICE_VARIANT("getdivs", null, ());
322  ADD_NAMED_NULL_CHOICE_VARIANT("getgcs", null, ());
323  ADD_NAMED_STD_CHOICE_VARIANT("getlineage", m_Getlineage);
324  ADD_NAMED_STD_CHOICE_VARIANT("getchildren", m_Getchildren);
325  ADD_NAMED_STD_CHOICE_VARIANT("getbyid", m_Getbyid);
326  ADD_NAMED_REF_CHOICE_VARIANT("lookup", m_object, COrg_ref);
327  ADD_NAMED_REF_CHOICE_VARIANT("getorgmod", m_object, CTaxon1_info);
328  ADD_NAMED_NULL_CHOICE_VARIANT("fini", null, ());
329  ADD_NAMED_STD_CHOICE_VARIANT("id4gi", m_Id4gi);
330  ADD_NAMED_STD_CHOICE_VARIANT("taxachildren", m_Taxachildren);
331  ADD_NAMED_STD_CHOICE_VARIANT("taxalineage", m_Taxalineage);
332  ADD_NAMED_NULL_CHOICE_VARIANT("maxtaxid", null, ());
333  ADD_NAMED_NULL_CHOICE_VARIANT("getproptypes", null, ());
334  ADD_NAMED_REF_CHOICE_VARIANT("getorgprop", m_object, CTaxon1_info);
335  ADD_NAMED_REF_CHOICE_VARIANT("searchname", m_object, CTaxon1_info);
336  ADD_NAMED_STD_CHOICE_VARIANT("dumpnames4class", m_Dumpnames4class);
337  ADD_NAMED_BUF_CHOICE_VARIANT("getdomain", m_string, STD, (string));
338  info->CodeVersion(22400);
339  info->DataSpec(ncbi::EDataSpec::eASN);
340 }
342 
343 // constructor
345  : m_choice(e_not_set)
346 {
347 }
348 
349 // destructor
351 {
352  Reset();
353 }
354 
355 
356 
357 END_objects_SCOPE // namespace ncbi::objects::
358 
360 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Taxon1-req", CTaxon1_req)
CTaxon1_info –.
Definition: Taxon1_info.hpp:66
CTaxon1_req –.
Definition: Taxon1_req.hpp:66
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 ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#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
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:385
@ 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
ncbi::TIntId m_Id4gi
TGetchildren m_Getchildren
virtual void Reset(void)
Reset the whole object.
Definition: Taxon1_req_.cpp:52
TGetdesignator & SetGetdesignator(void)
Select the variant.
TGetorgnames m_Getorgnames
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TGetdomain & SetGetdomain(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
NCBI_NS_NCBI::CSerialObject * m_object
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TGetlineage m_Getlineage
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TLookup & GetLookup(void) const
Get the variant data.
TDumpnames4class m_Dumpnames4class
const TGetidbyorg & GetGetidbyorg(void) const
Get the variant data.
TTaxalineage m_Taxalineage
const TGetorgmod & GetGetorgmod(void) const
Get the variant data.
static const char *const sm_SelectionNames[]
TLookup & SetLookup(void)
Select the variant.
TSearchname & SetSearchname(void)
Select the variant.
E_Choice
Choice variants.
Definition: Taxon1_req_.hpp:92
const TGetorgprop & GetGetorgprop(void) const
Get the variant data.
TFindname & SetFindname(void)
Select the variant.
TGetunique & SetGetunique(void)
Select the variant.
virtual ~CTaxon1_req_Base(void)
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TTaxachildren m_Taxachildren
const TSearchname & GetSearchname(void) const
Get the variant data.
TGetorgprop & SetGetorgprop(void)
Select the variant.
TGetorgmod & SetGetorgmod(void)
Select the variant.
TGetidbyorg & SetGetidbyorg(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Taxon1_req_.cpp:80
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Taxon1_req_.cpp:58
@ e_Taxalineage
get extended lineage for org
@ e_Dumpnames4class
all names of certain name class
@ e_Getdesignator
find designator
Definition: Taxon1_req_.hpp:96
@ e_Getbyid
get Org-ref by TaxonID
@ e_Getunique
get taxid for unique name
Definition: Taxon1_req_.hpp:97
@ e_Getdomain
get domain description and values
@ e_Id4gi
get taxid by gi
@ e_Lookup
lookup by data
@ e_not_set
No variant selected.
Definition: Taxon1_req_.hpp:93
@ e_Taxachildren
get children
@ e_Findname
find orgnames match string
Definition: Taxon1_req_.hpp:95
@ e_Searchname
fancy search (token set, wild card)
@ e_Getchildren
get children
@ e_Getorgprop
get properties for organism
@ e_Getorgmod
lookup for OrgMod
@ e_Getlineage
get lineage for org
@ e_Getorgnames
get all organism names
Definition: Taxon1_req_.hpp:99
@ e_Getidbyorg
get taxid matches orgref
Definition: Taxon1_req_.hpp:98
@ 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 Wed May 22 11:36:10 2024 by modify_doxy.py rev. 669887