NCBI C++ ToolKit
Entrez_general_.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  * 'ncbimime.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_Ml:
64  case e_Prot:
65  case e_Nuc:
66  case e_Genome:
67  case e_Structure:
68  case e_StrucAnnot:
69  m_object->RemoveReference();
70  break;
71  default:
72  break;
73  }
74  m_choice = e_not_set;
75 }
76 
77 void CEntrez_general_Base::C_Data::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
78 {
79  switch ( index ) {
80  case e_Ml:
81  (m_object = new(pool) ncbi::objects::CMedline_entry())->AddReference();
82  break;
83  case e_Prot:
84  (m_object = new(pool) ncbi::objects::CSeq_entry())->AddReference();
85  break;
86  case e_Nuc:
87  (m_object = new(pool) ncbi::objects::CSeq_entry())->AddReference();
88  break;
89  case e_Genome:
90  (m_object = new(pool) ncbi::objects::CSeq_entry())->AddReference();
91  break;
92  case e_Structure:
93  (m_object = new(pool) ncbi::objects::CBiostruc())->AddReference();
94  break;
95  case e_StrucAnnot:
96  (m_object = new(pool) ncbi::objects::CBiostruc_annot_set())->AddReference();
97  break;
98  default:
99  break;
100  }
101  m_choice = index;
102 }
103 
105  "not set",
106  "ml",
107  "prot",
108  "nuc",
109  "genome",
110  "structure",
111  "strucAnnot"
112 };
113 
115 {
116  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
117 }
118 
120 {
121  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
122 }
123 
125 {
126  CheckSelected(e_Ml);
127  return *static_cast<const TMl*>(m_object);
128 }
129 
131 {
132  Select(e_Ml, NCBI_NS_NCBI::eDoNotResetVariant);
133  return *static_cast<TMl*>(m_object);
134 }
135 
137 {
138  TMl* ptr = &value;
139  if ( m_choice != e_Ml || m_object != ptr ) {
140  ResetSelection();
141  (m_object = ptr)->AddReference();
142  m_choice = e_Ml;
143  }
144 }
145 
147 {
148  CheckSelected(e_Prot);
149  return *static_cast<const TProt*>(m_object);
150 }
151 
153 {
154  Select(e_Prot, NCBI_NS_NCBI::eDoNotResetVariant);
155  return *static_cast<TProt*>(m_object);
156 }
157 
159 {
160  TProt* ptr = &value;
161  if ( m_choice != e_Prot || m_object != ptr ) {
162  ResetSelection();
163  (m_object = ptr)->AddReference();
164  m_choice = e_Prot;
165  }
166 }
167 
169 {
170  CheckSelected(e_Nuc);
171  return *static_cast<const TNuc*>(m_object);
172 }
173 
175 {
176  Select(e_Nuc, NCBI_NS_NCBI::eDoNotResetVariant);
177  return *static_cast<TNuc*>(m_object);
178 }
179 
181 {
182  TNuc* ptr = &value;
183  if ( m_choice != e_Nuc || m_object != ptr ) {
184  ResetSelection();
185  (m_object = ptr)->AddReference();
186  m_choice = e_Nuc;
187  }
188 }
189 
191 {
192  CheckSelected(e_Genome);
193  return *static_cast<const TGenome*>(m_object);
194 }
195 
197 {
198  Select(e_Genome, NCBI_NS_NCBI::eDoNotResetVariant);
199  return *static_cast<TGenome*>(m_object);
200 }
201 
203 {
204  TGenome* ptr = &value;
205  if ( m_choice != e_Genome || m_object != ptr ) {
206  ResetSelection();
207  (m_object = ptr)->AddReference();
208  m_choice = e_Genome;
209  }
210 }
211 
213 {
214  CheckSelected(e_Structure);
215  return *static_cast<const TStructure*>(m_object);
216 }
217 
219 {
220  Select(e_Structure, NCBI_NS_NCBI::eDoNotResetVariant);
221  return *static_cast<TStructure*>(m_object);
222 }
223 
225 {
226  TStructure* ptr = &value;
227  if ( m_choice != e_Structure || m_object != ptr ) {
228  ResetSelection();
229  (m_object = ptr)->AddReference();
230  m_choice = e_Structure;
231  }
232 }
233 
235 {
236  CheckSelected(e_StrucAnnot);
237  return *static_cast<const TStrucAnnot*>(m_object);
238 }
239 
241 {
242  Select(e_StrucAnnot, NCBI_NS_NCBI::eDoNotResetVariant);
243  return *static_cast<TStrucAnnot*>(m_object);
244 }
245 
247 {
248  TStrucAnnot* ptr = &value;
249  if ( m_choice != e_StrucAnnot || m_object != ptr ) {
250  ResetSelection();
251  (m_object = ptr)->AddReference();
252  m_choice = e_StrucAnnot;
253  }
254 }
255 
256 // helper methods
257 
258 // type info
260 {
261  SET_INTERNAL_NAME("Entrez-general", "data");
262  SET_CHOICE_MODULE("NCBI-Mime");
264  ADD_NAMED_REF_CHOICE_VARIANT("prot", m_object, CSeq_entry);
265  ADD_NAMED_REF_CHOICE_VARIANT("nuc", m_object, CSeq_entry);
266  ADD_NAMED_REF_CHOICE_VARIANT("genome", m_object, CSeq_entry);
267  ADD_NAMED_REF_CHOICE_VARIANT("structure", m_object, CBiostruc);
268  ADD_NAMED_REF_CHOICE_VARIANT("strucAnnot", m_object, CBiostruc_annot_set);
269  info->CodeVersion(22400);
270  info->DataSpec(ncbi::EDataSpec::eASN);
271 }
273 
274 // constructor
276  : m_choice(e_not_set)
277 {
278 }
279 
280 // destructor
282 {
283  Reset();
284 }
285 
286 
288 {
289  m_Title.erase();
290  m_set_State[0] &= ~0x3;
291 }
292 
294 {
295  if ( !m_Data ) {
296  m_Data.Reset(new TData());
297  return;
298  }
299  (*m_Data).Reset();
300 }
301 
303 {
304  m_Data.Reset(&value);
305 }
306 
308 {
309  m_Location.erase();
310  m_set_State[0] &= ~0xc0;
311 }
312 
314 {
315  ResetTitle();
316  ResetData();
317  ResetStyle();
318  ResetLocation();
319 }
320 
322 {
323  SET_CLASS_MODULE("NCBI-Mime");
324  ADD_NAMED_STD_MEMBER("title", m_Title)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
325  ADD_NAMED_REF_MEMBER("data", m_Data, C_Data);
327  ADD_NAMED_STD_MEMBER("location", m_Location)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
328  info->RandomOrder();
329  info->CodeVersion(22400);
330  info->DataSpec(ncbi::EDataSpec::eASN);
331 }
333 
334 // constructor
337 {
338  memset(m_set_State,0,sizeof(m_set_State));
339  if ( !IsAllocatedInPool() ) {
340  ResetData();
341  }
342 }
343 
344 // destructor
346 {
347 }
348 
349 
350 
351 END_objects_SCOPE // namespace ncbi::objects::
352 
354 
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_BASE_CLASS_INFO("Entrez-general", CEntrez_general)
BEGIN_NAMED_CHOICE_INFO("", CEntrez_general_Base::C_Data)
CBiostruc_annot_set –.
CEntrez_general –.
Definition: Seq_entry.hpp:56
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 MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#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 ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#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 AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool IsAllocatedInPool(void) const THROWS_NONE
Check if object is allocated in memory pool (not system heap)
Definition: ncbiobj.hpp:461
#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 ResetStyle(void)
Reset Style data member.
virtual void Reset(void)
Reset the whole object.
TMl & SetMl(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void ResetSelection(void)
Reset the selection (set it to e_not_set).
TStructure & SetStructure(void)
Select the variant.
const TMl & GetMl(void) const
Get the variant data.
void ResetTitle(void)
Reset Title data member.
void ResetLocation(void)
Reset Location data member.
void Reset(void)
Reset the whole object.
const TStrucAnnot & GetStrucAnnot(void) const
Get the variant data.
EEntrez_style
Access to EEntrez_style's attributes (values, names) as defined in spec.
static const char *const sm_SelectionNames[]
TGenome & SetGenome(void)
Select the variant.
TStrucAnnot & SetStrucAnnot(void)
Select the variant.
const TStructure & GetStructure(void) const
Get the variant data.
const TProt & GetProt(void) const
Get the variant data.
const TGenome & GetGenome(void) const
Get the variant data.
TData & SetData(void)
Assign a value to Data data member.
const TNuc & GetNuc(void) const
Get the variant data.
TNuc & SetNuc(void)
Select the variant.
TProt & SetProt(void)
Select the variant.
void ResetData(void)
Reset Data data member.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
virtual ~CEntrez_general_Base(void)
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Magic spell ;-) needed for some weird compilers... very empiric.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri May 24 14:55:09 2024 by modify_doxy.py rev. 669887