NCBI C++ ToolKit
OrgName_.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  * 'seqfeat.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
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 
52 // generated classes
53 
55 {
56  if ( m_choice != e_not_set )
58 }
59 
61 {
62  switch ( m_choice ) {
63  case e_Virus:
64  m_string.Destruct();
65  break;
66  case e_Binomial:
67  case e_Hybrid:
68  case e_Namedhybrid:
69  case e_Partial:
70  m_object->RemoveReference();
71  break;
72  default:
73  break;
74  }
75  m_choice = e_not_set;
76 }
77 
78 void COrgName_Base::C_Name::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
79 {
80  switch ( index ) {
81  case e_Binomial:
82  (m_object = new(pool) ncbi::objects::CBinomialOrgName())->AddReference();
83  break;
84  case e_Hybrid:
85  (m_object = new(pool) ncbi::objects::CMultiOrgName())->AddReference();
86  break;
87  case e_Namedhybrid:
88  (m_object = new(pool) ncbi::objects::CBinomialOrgName())->AddReference();
89  break;
90  case e_Partial:
91  (m_object = new(pool) ncbi::objects::CPartialOrgName())->AddReference();
92  break;
93  case e_Virus:
94  m_string.Construct();
95  break;
96  default:
97  break;
98  }
99  m_choice = index;
100 }
101 
102 const char* const COrgName_Base::C_Name::sm_SelectionNames[] = {
103  "not set",
104  "binomial",
105  "virus",
106  "hybrid",
107  "namedhybrid",
108  "partial"
109 };
110 
112 {
113  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
114 }
115 
117 {
118  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
119 }
120 
122 {
123  CheckSelected(e_Binomial);
124  return *static_cast<const TBinomial*>(m_object);
125 }
126 
128 {
129  Select(e_Binomial, NCBI_NS_NCBI::eDoNotResetVariant);
130  return *static_cast<TBinomial*>(m_object);
131 }
132 
134 {
135  TBinomial* ptr = &value;
136  if ( m_choice != e_Binomial || m_object != ptr ) {
137  ResetSelection();
138  (m_object = ptr)->AddReference();
139  m_choice = e_Binomial;
140  }
141 }
142 
144 {
145  Select(e_Virus, NCBI_NS_NCBI::eDoNotResetVariant);
146  *m_string = value;
147 }
148 
150 {
151  CheckSelected(e_Hybrid);
152  return *static_cast<const THybrid*>(m_object);
153 }
154 
156 {
157  Select(e_Hybrid, NCBI_NS_NCBI::eDoNotResetVariant);
158  return *static_cast<THybrid*>(m_object);
159 }
160 
162 {
163  THybrid* ptr = &value;
164  if ( m_choice != e_Hybrid || m_object != ptr ) {
165  ResetSelection();
166  (m_object = ptr)->AddReference();
167  m_choice = e_Hybrid;
168  }
169 }
170 
172 {
173  CheckSelected(e_Namedhybrid);
174  return *static_cast<const TNamedhybrid*>(m_object);
175 }
176 
178 {
179  Select(e_Namedhybrid, NCBI_NS_NCBI::eDoNotResetVariant);
180  return *static_cast<TNamedhybrid*>(m_object);
181 }
182 
184 {
185  TNamedhybrid* ptr = &value;
186  if ( m_choice != e_Namedhybrid || m_object != ptr ) {
187  ResetSelection();
188  (m_object = ptr)->AddReference();
189  m_choice = e_Namedhybrid;
190  }
191 }
192 
194 {
195  CheckSelected(e_Partial);
196  return *static_cast<const TPartial*>(m_object);
197 }
198 
200 {
201  Select(e_Partial, NCBI_NS_NCBI::eDoNotResetVariant);
202  return *static_cast<TPartial*>(m_object);
203 }
204 
206 {
207  TPartial* ptr = &value;
208  if ( m_choice != e_Partial || m_object != ptr ) {
209  ResetSelection();
210  (m_object = ptr)->AddReference();
211  m_choice = e_Partial;
212  }
213 }
214 
215 // helper methods
216 
217 // type info
219 {
220  SET_INTERNAL_NAME("OrgName", "name");
221  SET_CHOICE_MODULE("NCBI-Organism");
222  ADD_NAMED_REF_CHOICE_VARIANT("binomial", m_object, CBinomialOrgName);
223  ADD_NAMED_BUF_CHOICE_VARIANT("virus", m_string, STD, (string));
224  ADD_NAMED_REF_CHOICE_VARIANT("hybrid", m_object, CMultiOrgName);
225  ADD_NAMED_REF_CHOICE_VARIANT("namedhybrid", m_object, CBinomialOrgName);
226  ADD_NAMED_REF_CHOICE_VARIANT("partial", m_object, CPartialOrgName);
227  info->CodeVersion(22400);
228  info->DataSpec(ncbi::EDataSpec::eASN);
229 }
231 
232 // constructor
234  : m_choice(e_not_set)
235 {
236 }
237 
238 // destructor
240 {
241  Reset();
242 }
243 
244 
246 {
247  m_Name.Reset();
248 }
249 
251 {
252  m_Name.Reset(&value);
253 }
254 
256 {
257  if ( !m_Name )
258  m_Name.Reset(new TName());
259  return (*m_Name);
260 }
261 
263 {
264  m_Attrib.erase();
265  m_set_State[0] &= ~0xc;
266 }
267 
269 {
270  m_Mod.clear();
271  m_set_State[0] &= ~0x30;
272 }
273 
275 {
276  m_Lineage.erase();
277  m_set_State[0] &= ~0xc0;
278 }
279 
281 {
282  m_Div.erase();
283  m_set_State[0] &= ~0x3000;
284 }
285 
287 {
288  ResetName();
289  ResetAttrib();
290  ResetMod();
291  ResetLineage();
292  ResetGcode();
293  ResetMgcode();
294  ResetDiv();
295  ResetPgcode();
296 }
297 
299 {
300  SET_CLASS_MODULE("NCBI-Organism");
301  ADD_NAMED_REF_MEMBER("name", m_Name, C_Name)->SetOptional();
302  ADD_NAMED_STD_MEMBER("attrib", m_Attrib)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
303  ADD_NAMED_MEMBER("mod", m_Mod, STL_list, (STL_CRef, (CLASS, (COrgMod))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
304  ADD_NAMED_STD_MEMBER("lineage", m_Lineage)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
305  ADD_NAMED_STD_MEMBER("gcode", m_Gcode)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
306  ADD_NAMED_STD_MEMBER("mgcode", m_Mgcode)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
307  ADD_NAMED_STD_MEMBER("div", m_Div)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
308  ADD_NAMED_STD_MEMBER("pgcode", m_Pgcode)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
309  info->RandomOrder();
310  info->CodeVersion(22400);
311  info->DataSpec(ncbi::EDataSpec::eASN);
312 }
314 
315 // constructor
317  : m_Gcode(0), m_Mgcode(0), m_Pgcode(0)
318 {
319  memset(m_set_State,0,sizeof(m_set_State));
320 }
321 
322 // destructor
324 {
325 }
326 
327 
328 
329 END_objects_SCOPE // namespace ncbi::objects::
330 
332 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("OrgName", COrgName)
Definition: OrgName_.cpp:298
BEGIN_NAMED_CHOICE_INFO("", COrgName_Base::C_Name)
Definition: OrgName_.cpp:218
User-defined methods of the data storage class.
CBinomialOrgName –.
CMultiOrgName –.
@OrgMod.hpp User-defined methods of the data storage class.
Definition: OrgMod.hpp:54
CPartialOrgName –.
string
Definition: cgiapp.hpp:690
#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 ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#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 ADD_NAMED_STD_MEMBER(MemberAlias, MemberName)
Definition: serialimpl.hpp:345
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#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
#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
void ResetDiv(void)
Reset Div data member.
Definition: OrgName_.cpp:280
void ResetMod(void)
Reset Mod data member.
Definition: OrgName_.cpp:268
void ResetAttrib(void)
Reset Attrib data member.
Definition: OrgName_.cpp:262
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: OrgName_.cpp:78
string m_Lineage
Definition: OrgName_.hpp:669
void ResetMgcode(void)
Reset Mgcode data member.
Definition: OrgName_.hpp:958
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: OrgName_.cpp:111
void ResetLineage(void)
Reset Lineage data member.
Definition: OrgName_.cpp:274
list< CRef< COrgMod > > m_Mod
Definition: OrgName_.hpp:668
THybrid & SetHybrid(void)
Select the variant.
Definition: OrgName_.cpp:155
TName & SetName(void)
Assign a value to Name data member.
Definition: OrgName_.cpp:255
TNamedhybrid & SetNamedhybrid(void)
Select the variant.
Definition: OrgName_.cpp:177
TVirus & SetVirus(void)
Select the variant.
Definition: OrgName_.hpp:734
const THybrid & GetHybrid(void) const
Get the variant data.
Definition: OrgName_.cpp:149
void Reset(void)
Reset the whole object.
Definition: OrgName_.cpp:54
virtual void Reset(void)
Reset the whole object.
Definition: OrgName_.cpp:286
virtual ~COrgName_Base(void)
Definition: OrgName_.cpp:323
Uint4 m_set_State[1]
Definition: OrgName_.hpp:665
CRef< TName > m_Name
Definition: OrgName_.hpp:666
void ResetGcode(void)
Reset Gcode data member.
Definition: OrgName_.hpp:911
const TBinomial & GetBinomial(void) const
Get the variant data.
Definition: OrgName_.cpp:121
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: OrgName_.cpp:60
void ResetPgcode(void)
Reset Pgcode data member.
Definition: OrgName_.hpp:1052
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: OrgName_.cpp:116
E_Choice
Choice variants.
Definition: OrgName_.hpp:111
C_Name TName
Definition: OrgName_.hpp:330
COrgName_Base(void)
Definition: OrgName_.cpp:316
void ResetName(void)
Reset Name data member.
Definition: OrgName_.cpp:245
string m_Attrib
Definition: OrgName_.hpp:667
const TPartial & GetPartial(void) const
Get the variant data.
Definition: OrgName_.cpp:193
const TNamedhybrid & GetNamedhybrid(void) const
Get the variant data.
Definition: OrgName_.cpp:171
static const char *const sm_SelectionNames[]
Definition: OrgName_.hpp:322
TPartial & SetPartial(void)
Select the variant.
Definition: OrgName_.cpp:199
TBinomial & SetBinomial(void)
Select the variant.
Definition: OrgName_.cpp:127
string m_Div
Definition: OrgName_.hpp:672
@ e_not_set
No variant selected.
Definition: OrgName_.hpp:112
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define STD
Modified on Fri Sep 20 14:57:07 2024 by modify_doxy.py rev. 669887