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
54 
55 BEGIN_objects_SCOPE // namespace ncbi::objects::
56 
57 
58 // generated classes
59 
61 {
62  if ( m_choice != e_not_set )
64 }
65 
67 {
68  switch ( m_choice ) {
69  case e_Pmid:
70  m_Pmid.Destruct();
71  break;
72  case e_Taxid:
73  m_Taxid.Destruct();
74  break;
75  case e_Id:
76  case e_Entry:
77  case e_Annot:
78  case e_Submit:
79  case e_Seq_align:
80  case e_Seq_align_set:
81  case e_Obsolete_plugin:
82  case e_Other:
83  case e_Huge_file:
84  m_object->RemoveReference();
85  break;
86  default:
87  break;
88  }
89  m_choice = e_not_set;
90 }
91 
92 void CProjectItem_Base::C_Item::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
93 {
94  switch ( index ) {
95  case e_Id:
96  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
97  break;
98  case e_Entry:
99  (m_object = new(pool) ncbi::objects::CSeq_entry())->AddReference();
100  break;
101  case e_Annot:
102  (m_object = new(pool) ncbi::objects::CSeq_annot())->AddReference();
103  break;
104  case e_Submit:
105  (m_object = new(pool) ncbi::objects::CSeq_submit())->AddReference();
106  break;
107  case e_Seq_align:
108  (m_object = new(pool) ncbi::objects::CSeq_align())->AddReference();
109  break;
110  case e_Seq_align_set:
111  (m_object = new(pool) ncbi::objects::CSeq_align_set())->AddReference();
112  break;
113  case e_Obsolete_plugin:
114  (m_object = new(pool) ncbi::objects::CDummyObsoleteType())->AddReference();
115  break;
116  case e_Other:
117  (m_object = new(pool) ncbi::objects::CAbstractProjectItem())->AddReference();
118  break;
119  case e_Pmid:
120  m_Pmid.Construct();
121  break;
122  case e_Taxid:
123  m_Taxid.Construct();
124  break;
125  case e_Huge_file:
126  (m_object = new(pool) ncbi::objects::CHugeFileProjectItem())->AddReference();
127  break;
128  default:
129  break;
130  }
131  m_choice = index;
132 }
133 
134 const char* const CProjectItem_Base::C_Item::sm_SelectionNames[] = {
135  "not set",
136  "id",
137  "entry",
138  "annot",
139  "submit",
140  "seq-align",
141  "seq-align-set",
142  "obsolete-plugin",
143  "other",
144  "pmid",
145  "taxid",
146  "huge-file"
147 };
148 
150 {
151  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
152 }
153 
155 {
156  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
157 }
158 
160 {
161  CheckSelected(e_Id);
162  return *static_cast<const TId*>(m_object);
163 }
164 
166 {
167  Select(e_Id, NCBI_NS_NCBI::eDoNotResetVariant);
168  return *static_cast<TId*>(m_object);
169 }
170 
172 {
173  TId* ptr = &value;
174  if ( m_choice != e_Id || m_object != ptr ) {
175  ResetSelection();
176  (m_object = ptr)->AddReference();
177  m_choice = e_Id;
178  }
179 }
180 
182 {
183  CheckSelected(e_Entry);
184  return *static_cast<const TEntry*>(m_object);
185 }
186 
188 {
189  Select(e_Entry, NCBI_NS_NCBI::eDoNotResetVariant);
190  return *static_cast<TEntry*>(m_object);
191 }
192 
194 {
195  TEntry* ptr = &value;
196  if ( m_choice != e_Entry || m_object != ptr ) {
197  ResetSelection();
198  (m_object = ptr)->AddReference();
199  m_choice = e_Entry;
200  }
201 }
202 
204 {
205  CheckSelected(e_Annot);
206  return *static_cast<const TAnnot*>(m_object);
207 }
208 
210 {
211  Select(e_Annot, NCBI_NS_NCBI::eDoNotResetVariant);
212  return *static_cast<TAnnot*>(m_object);
213 }
214 
216 {
217  TAnnot* ptr = &value;
218  if ( m_choice != e_Annot || m_object != ptr ) {
219  ResetSelection();
220  (m_object = ptr)->AddReference();
221  m_choice = e_Annot;
222  }
223 }
224 
226 {
227  CheckSelected(e_Submit);
228  return *static_cast<const TSubmit*>(m_object);
229 }
230 
232 {
233  Select(e_Submit, NCBI_NS_NCBI::eDoNotResetVariant);
234  return *static_cast<TSubmit*>(m_object);
235 }
236 
238 {
239  TSubmit* ptr = &value;
240  if ( m_choice != e_Submit || m_object != ptr ) {
241  ResetSelection();
242  (m_object = ptr)->AddReference();
243  m_choice = e_Submit;
244  }
245 }
246 
248 {
249  CheckSelected(e_Seq_align);
250  return *static_cast<const TSeq_align*>(m_object);
251 }
252 
254 {
255  Select(e_Seq_align, NCBI_NS_NCBI::eDoNotResetVariant);
256  return *static_cast<TSeq_align*>(m_object);
257 }
258 
260 {
261  TSeq_align* ptr = &value;
262  if ( m_choice != e_Seq_align || m_object != ptr ) {
263  ResetSelection();
264  (m_object = ptr)->AddReference();
265  m_choice = e_Seq_align;
266  }
267 }
268 
270 {
271  CheckSelected(e_Seq_align_set);
272  return *static_cast<const TSeq_align_set*>(m_object);
273 }
274 
276 {
277  Select(e_Seq_align_set, NCBI_NS_NCBI::eDoNotResetVariant);
278  return *static_cast<TSeq_align_set*>(m_object);
279 }
280 
282 {
283  TSeq_align_set* ptr = &value;
284  if ( m_choice != e_Seq_align_set || m_object != ptr ) {
285  ResetSelection();
286  (m_object = ptr)->AddReference();
287  m_choice = e_Seq_align_set;
288  }
289 }
290 
292 {
293  CheckSelected(e_Obsolete_plugin);
294  return *static_cast<const TObsolete_plugin*>(m_object);
295 }
296 
298 {
299  Select(e_Obsolete_plugin, NCBI_NS_NCBI::eDoNotResetVariant);
300  return *static_cast<TObsolete_plugin*>(m_object);
301 }
302 
304 {
305  TObsolete_plugin* ptr = &value;
306  if ( m_choice != e_Obsolete_plugin || m_object != ptr ) {
307  ResetSelection();
308  (m_object = ptr)->AddReference();
309  m_choice = e_Obsolete_plugin;
310  }
311 }
312 
314 {
315  CheckSelected(e_Other);
316  return *static_cast<const TOther*>(m_object);
317 }
318 
320 {
321  Select(e_Other, NCBI_NS_NCBI::eDoNotResetVariant);
322  return *static_cast<TOther*>(m_object);
323 }
324 
326 {
327  TOther* ptr = &value;
328  if ( m_choice != e_Other || m_object != ptr ) {
329  ResetSelection();
330  (m_object = ptr)->AddReference();
331  m_choice = e_Other;
332  }
333 }
334 
336 {
337  CheckSelected(e_Huge_file);
338  return *static_cast<const THuge_file*>(m_object);
339 }
340 
342 {
343  Select(e_Huge_file, NCBI_NS_NCBI::eDoNotResetVariant);
344  return *static_cast<THuge_file*>(m_object);
345 }
346 
348 {
349  THuge_file* ptr = &value;
350  if ( m_choice != e_Huge_file || m_object != ptr ) {
351  ResetSelection();
352  (m_object = ptr)->AddReference();
353  m_choice = e_Huge_file;
354  }
355 }
356 
357 // helper methods
358 
359 // type info
361 {
362  SET_INTERNAL_NAME("ProjectItem", "item");
363  SET_CHOICE_MODULE("NCBI-GBProject");
364  ADD_NAMED_REF_CHOICE_VARIANT("id", m_object, CSeq_id);
365  ADD_NAMED_REF_CHOICE_VARIANT("entry", m_object, CSeq_entry);
366  ADD_NAMED_REF_CHOICE_VARIANT("annot", m_object, CSeq_annot);
367  ADD_NAMED_REF_CHOICE_VARIANT("submit", m_object, CSeq_submit);
368  ADD_NAMED_REF_CHOICE_VARIANT("seq-align", m_object, CSeq_align);
369  ADD_NAMED_REF_CHOICE_VARIANT("seq-align-set", m_object, CSeq_align_set);
370  ADD_NAMED_REF_CHOICE_VARIANT("obsolete-plugin", m_object, CDummyObsoleteType);
372  ADD_NAMED_BUF_CHOICE_VARIANT("pmid", m_Pmid, STL_list_set, (STD, (int)));
373  ADD_NAMED_BUF_CHOICE_VARIANT("taxid", m_Taxid, STL_list_set, (STD, (int)));
374  ADD_NAMED_REF_CHOICE_VARIANT("huge-file", m_object, CHugeFileProjectItem);
375  info->CodeVersion(22400);
376  info->DataSpec(ncbi::EDataSpec::eASN);
377 }
379 
380 // constructor
382  : m_choice(e_not_set)
383 {
384 }
385 
386 // destructor
388 {
389  Reset();
390 }
391 
392 
394 {
395  m_Label.erase();
396  m_set_State[0] &= ~0xc;
397 }
398 
400 {
401  m_Descr.clear();
402  m_set_State[0] &= ~0x30;
403 }
404 
406 {
407  if ( !m_Item ) {
408  m_Item.Reset(new TItem());
409  return;
410  }
411  (*m_Item).Reset();
412 }
413 
415 {
416  m_Item.Reset(&value);
417 }
418 
420 {
421  m_Data_plugin.erase();
422  m_set_State[0] &= ~0x300;
423 }
424 
426 {
427  ResetId();
428  ResetLabel();
429  ResetDescr();
430  ResetItem();
432  ResetDisabled();
433 }
434 
436 {
437  SET_CLASS_MODULE("NCBI-GBProject");
438  ADD_NAMED_STD_MEMBER("id", m_Id)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
439  ADD_NAMED_STD_MEMBER("label", m_Label)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
440  ADD_NAMED_MEMBER("descr", m_Descr, STL_list_set, (STL_CRef, (CLASS, (CAnnotdesc))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
441  ADD_NAMED_REF_MEMBER("item", m_Item, C_Item);
442  ADD_NAMED_STD_MEMBER("data-plugin", m_Data_plugin)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
443  ADD_NAMED_STD_MEMBER("disabled", m_Disabled)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
444  info->RandomOrder();
445  info->CodeVersion(22400);
446  info->DataSpec(ncbi::EDataSpec::eASN);
447 }
449 
450 // constructor
452  : m_Id(0), m_Disabled(0)
453 {
454  memset(m_set_State,0,sizeof(m_set_State));
455  if ( !IsAllocatedInPool() ) {
456  ResetItem();
457  }
458 }
459 
460 // destructor
462 {
463 }
464 
465 
466 
467 END_objects_SCOPE // namespace ncbi::objects::
468 
470 
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.
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 –.
CHugeFileProjectItem –.
the item we represent
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_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 THuge_file & GetHuge_file(void) const
Get the variant data.
const TSeq_align & GetSeq_align(void) const
Get the variant data.
THuge_file & SetHuge_file(void)
Select the variant.
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
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed May 22 11:31:14 2024 by modify_doxy.py rev. 669887