NCBI C++ ToolKit
ProjectItem_.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  * 'gbproj.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
53 
54 BEGIN_objects_SCOPE // namespace ncbi::objects::
55 
56 
57 // generated classes
58 
60 {
61  if ( m_choice != e_not_set )
63 }
64 
66 {
67  switch ( m_choice ) {
68  case e_Pmid:
69  m_Pmid.Destruct();
70  break;
71  case e_Taxid:
72  m_Taxid.Destruct();
73  break;
74  case e_Id:
75  case e_Entry:
76  case e_Annot:
77  case e_Submit:
78  case e_Seq_align:
79  case e_Seq_align_set:
80  case e_Obsolete_plugin:
81  case e_Other:
82  m_object->RemoveReference();
83  break;
84  default:
85  break;
86  }
87  m_choice = e_not_set;
88 }
89 
90 void CProjectItem_Base::C_Item::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
91 {
92  switch ( index ) {
93  case e_Id:
94  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
95  break;
96  case e_Entry:
97  (m_object = new(pool) ncbi::objects::CSeq_entry())->AddReference();
98  break;
99  case e_Annot:
100  (m_object = new(pool) ncbi::objects::CSeq_annot())->AddReference();
101  break;
102  case e_Submit:
103  (m_object = new(pool) ncbi::objects::CSeq_submit())->AddReference();
104  break;
105  case e_Seq_align:
106  (m_object = new(pool) ncbi::objects::CSeq_align())->AddReference();
107  break;
108  case e_Seq_align_set:
109  (m_object = new(pool) ncbi::objects::CSeq_align_set())->AddReference();
110  break;
111  case e_Obsolete_plugin:
112  (m_object = new(pool) ncbi::objects::CDummyObsoleteType())->AddReference();
113  break;
114  case e_Other:
115  (m_object = new(pool) ncbi::objects::CAbstractProjectItem())->AddReference();
116  break;
117  case e_Pmid:
118  m_Pmid.Construct();
119  break;
120  case e_Taxid:
121  m_Taxid.Construct();
122  break;
123  default:
124  break;
125  }
126  m_choice = index;
127 }
128 
129 const char* const CProjectItem_Base::C_Item::sm_SelectionNames[] = {
130  "not set",
131  "id",
132  "entry",
133  "annot",
134  "submit",
135  "seq-align",
136  "seq-align-set",
137  "obsolete-plugin",
138  "other",
139  "pmid",
140  "taxid"
141 };
142 
144 {
145  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
146 }
147 
149 {
150  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
151 }
152 
154 {
155  CheckSelected(e_Id);
156  return *static_cast<const TId*>(m_object);
157 }
158 
160 {
161  Select(e_Id, NCBI_NS_NCBI::eDoNotResetVariant);
162  return *static_cast<TId*>(m_object);
163 }
164 
166 {
167  TId* ptr = &value;
168  if ( m_choice != e_Id || m_object != ptr ) {
169  ResetSelection();
170  (m_object = ptr)->AddReference();
171  m_choice = e_Id;
172  }
173 }
174 
176 {
177  CheckSelected(e_Entry);
178  return *static_cast<const TEntry*>(m_object);
179 }
180 
182 {
183  Select(e_Entry, NCBI_NS_NCBI::eDoNotResetVariant);
184  return *static_cast<TEntry*>(m_object);
185 }
186 
188 {
189  TEntry* ptr = &value;
190  if ( m_choice != e_Entry || m_object != ptr ) {
191  ResetSelection();
192  (m_object = ptr)->AddReference();
193  m_choice = e_Entry;
194  }
195 }
196 
198 {
199  CheckSelected(e_Annot);
200  return *static_cast<const TAnnot*>(m_object);
201 }
202 
204 {
205  Select(e_Annot, NCBI_NS_NCBI::eDoNotResetVariant);
206  return *static_cast<TAnnot*>(m_object);
207 }
208 
210 {
211  TAnnot* ptr = &value;
212  if ( m_choice != e_Annot || m_object != ptr ) {
213  ResetSelection();
214  (m_object = ptr)->AddReference();
215  m_choice = e_Annot;
216  }
217 }
218 
220 {
221  CheckSelected(e_Submit);
222  return *static_cast<const TSubmit*>(m_object);
223 }
224 
226 {
227  Select(e_Submit, NCBI_NS_NCBI::eDoNotResetVariant);
228  return *static_cast<TSubmit*>(m_object);
229 }
230 
232 {
233  TSubmit* ptr = &value;
234  if ( m_choice != e_Submit || m_object != ptr ) {
235  ResetSelection();
236  (m_object = ptr)->AddReference();
237  m_choice = e_Submit;
238  }
239 }
240 
242 {
243  CheckSelected(e_Seq_align);
244  return *static_cast<const TSeq_align*>(m_object);
245 }
246 
248 {
249  Select(e_Seq_align, NCBI_NS_NCBI::eDoNotResetVariant);
250  return *static_cast<TSeq_align*>(m_object);
251 }
252 
254 {
255  TSeq_align* ptr = &value;
256  if ( m_choice != e_Seq_align || m_object != ptr ) {
257  ResetSelection();
258  (m_object = ptr)->AddReference();
259  m_choice = e_Seq_align;
260  }
261 }
262 
264 {
265  CheckSelected(e_Seq_align_set);
266  return *static_cast<const TSeq_align_set*>(m_object);
267 }
268 
270 {
271  Select(e_Seq_align_set, NCBI_NS_NCBI::eDoNotResetVariant);
272  return *static_cast<TSeq_align_set*>(m_object);
273 }
274 
276 {
277  TSeq_align_set* ptr = &value;
278  if ( m_choice != e_Seq_align_set || m_object != ptr ) {
279  ResetSelection();
280  (m_object = ptr)->AddReference();
281  m_choice = e_Seq_align_set;
282  }
283 }
284 
286 {
287  CheckSelected(e_Obsolete_plugin);
288  return *static_cast<const TObsolete_plugin*>(m_object);
289 }
290 
292 {
293  Select(e_Obsolete_plugin, NCBI_NS_NCBI::eDoNotResetVariant);
294  return *static_cast<TObsolete_plugin*>(m_object);
295 }
296 
298 {
299  TObsolete_plugin* ptr = &value;
300  if ( m_choice != e_Obsolete_plugin || m_object != ptr ) {
301  ResetSelection();
302  (m_object = ptr)->AddReference();
303  m_choice = e_Obsolete_plugin;
304  }
305 }
306 
308 {
309  CheckSelected(e_Other);
310  return *static_cast<const TOther*>(m_object);
311 }
312 
314 {
315  Select(e_Other, NCBI_NS_NCBI::eDoNotResetVariant);
316  return *static_cast<TOther*>(m_object);
317 }
318 
320 {
321  TOther* ptr = &value;
322  if ( m_choice != e_Other || m_object != ptr ) {
323  ResetSelection();
324  (m_object = ptr)->AddReference();
325  m_choice = e_Other;
326  }
327 }
328 
329 // helper methods
330 
331 // type info
333 {
334  SET_INTERNAL_NAME("ProjectItem", "item");
335  SET_CHOICE_MODULE("NCBI-GBProject");
336  ADD_NAMED_REF_CHOICE_VARIANT("id", m_object, CSeq_id);
337  ADD_NAMED_REF_CHOICE_VARIANT("entry", m_object, CSeq_entry);
338  ADD_NAMED_REF_CHOICE_VARIANT("annot", m_object, CSeq_annot);
339  ADD_NAMED_REF_CHOICE_VARIANT("submit", m_object, CSeq_submit);
340  ADD_NAMED_REF_CHOICE_VARIANT("seq-align", m_object, CSeq_align);
341  ADD_NAMED_REF_CHOICE_VARIANT("seq-align-set", m_object, CSeq_align_set);
342  ADD_NAMED_REF_CHOICE_VARIANT("obsolete-plugin", m_object, CDummyObsoleteType);
344  ADD_NAMED_BUF_CHOICE_VARIANT("pmid", m_Pmid, STL_list_set, (STD, (int)));
345  ADD_NAMED_BUF_CHOICE_VARIANT("taxid", m_Taxid, STL_list_set, (STD, (int)));
346  info->CodeVersion(22301);
347  info->DataSpec(ncbi::EDataSpec::eASN);
348 }
350 
351 // constructor
353  : m_choice(e_not_set)
354 {
355 }
356 
357 // destructor
359 {
360  Reset();
361 }
362 
363 
365 {
366  m_Label.erase();
367  m_set_State[0] &= ~0xc;
368 }
369 
371 {
372  m_Descr.clear();
373  m_set_State[0] &= ~0x30;
374 }
375 
377 {
378  if ( !m_Item ) {
379  m_Item.Reset(new TItem());
380  return;
381  }
382  (*m_Item).Reset();
383 }
384 
386 {
387  m_Item.Reset(&value);
388 }
389 
391 {
392  m_Data_plugin.erase();
393  m_set_State[0] &= ~0x300;
394 }
395 
397 {
398  ResetId();
399  ResetLabel();
400  ResetDescr();
401  ResetItem();
403  ResetDisabled();
404 }
405 
407 {
408  SET_CLASS_MODULE("NCBI-GBProject");
409  ADD_NAMED_STD_MEMBER("id", m_Id)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
410  ADD_NAMED_STD_MEMBER("label", m_Label)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
411  ADD_NAMED_MEMBER("descr", m_Descr, STL_list_set, (STL_CRef, (CLASS, (CAnnotdesc))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
412  ADD_NAMED_REF_MEMBER("item", m_Item, C_Item);
413  ADD_NAMED_STD_MEMBER("data-plugin", m_Data_plugin)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
414  ADD_NAMED_STD_MEMBER("disabled", m_Disabled)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
415  info->RandomOrder();
416  info->CodeVersion(22301);
417  info->DataSpec(ncbi::EDataSpec::eASN);
418 }
420 
421 // constructor
423  : m_Id(0), m_Disabled(0)
424 {
425  memset(m_set_State,0,sizeof(m_set_State));
426  if ( !IsAllocatedInPool() ) {
427  ResetItem();
428  }
429 }
430 
431 // destructor
433 {
434 }
435 
436 
437 
438 END_objects_SCOPE // namespace ncbi::objects::
439 
441 
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.
BEGIN_NAMED_BASE_CLASS_INFO("ProjectItem", CProjectItem)
BEGIN_NAMED_CHOICE_INFO("", CProjectItem_Base::C_Item)
User-defined methods of the data storage class.
CAnnotdesc –.
Definition: Annotdesc.hpp:66
CDummyObsoleteType –.
the item we represent
Definition: Seq_entry.hpp:56
char value[7]
Definition: config.c:431
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_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
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
virtual void Reset(void)
Reset the whole object.
TSeq_align & SetSeq_align(void)
Select the variant.
TSubmit & SetSubmit(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
const TObsolete_plugin & GetObsolete_plugin(void) const
Get the variant data.
virtual ~CProjectItem_Base(void)
void ResetData_plugin(void)
Reset Data_plugin data member.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
const TAnnot & GetAnnot(void) const
Get the variant data.
void ResetItem(void)
Reset Item data member.
TId & SetId(void)
Select the variant.
void ResetDisabled(void)
Reset Disabled data member.
TSeq_align_set & SetSeq_align_set(void)
Select the variant.
TOther & SetOther(void)
Select the variant.
static const char *const sm_SelectionNames[]
TEntry & SetEntry(void)
Select the variant.
TAnnot & SetAnnot(void)
Select the variant.
const TSeq_align & GetSeq_align(void) const
Get the variant data.
void Reset(void)
Reset the whole object.
const TOther & GetOther(void) const
Get the variant data.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
const TSeq_align_set & GetSeq_align_set(void) const
Get the variant data.
TObsolete_plugin & SetObsolete_plugin(void)
Select the variant.
void ResetLabel(void)
Reset Label data member.
list< CRef< CAnnotdesc > > m_Descr
const TId & GetId(void) const
Get the variant data.
const TEntry & GetEntry(void) const
Get the variant data.
void ResetDescr(void)
Reset Descr data member.
TItem & SetItem(void)
Assign a value to Item data member.
CRef< TItem > m_Item
const TSubmit & GetSubmit(void) const
Get the variant data.
void ResetId(void)
Reset Id data member.
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Fri Dec 01 04:47:36 2023 by modify_doxy.py rev. 669887