NCBI C++ ToolKit
SimpleVariant_.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  * 'varrep.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
52 #include <objects/varrep/NaSub.hpp>
57 
58 BEGIN_objects_SCOPE // namespace ncbi::objects::
59 
60 
61 // generated classes
62 
64 {
65  if ( m_choice != e_not_set )
67 }
68 
70 {
71  switch ( m_choice ) {
72  case e_Na_identity:
73  case e_Na_sub:
74  case e_Prot_sub:
75  case e_Prot_silent:
76  case e_Del:
77  case e_Dup:
78  case e_Inv:
79  case e_Ins:
80  case e_Conv:
81  case e_Delins:
82  case e_Repeat:
83  case e_Prot_ext:
84  case e_Frameshift:
85  m_object->RemoveReference();
86  break;
87  default:
88  break;
89  }
90  m_choice = e_not_set;
91 }
92 
93 void CSimpleVariant_Base::C_Type::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
94 {
95  switch ( index ) {
96  case e_Na_identity:
97  (m_object = new(pool) ncbi::objects::CNaIdentity())->AddReference();
98  break;
99  case e_Na_sub:
100  (m_object = new(pool) ncbi::objects::CNaSub())->AddReference();
101  break;
102  case e_Prot_sub:
103  (m_object = new(pool) ncbi::objects::CProteinSub())->AddReference();
104  break;
105  case e_Prot_silent:
106  (m_object = new(pool) ncbi::objects::CAaLocation())->AddReference();
107  break;
108  case e_Del:
109  (m_object = new(pool) ncbi::objects::CDeletion())->AddReference();
110  break;
111  case e_Dup:
112  (m_object = new(pool) ncbi::objects::CDuplication())->AddReference();
113  break;
114  case e_Inv:
115  (m_object = new(pool) ncbi::objects::CInversion())->AddReference();
116  break;
117  case e_Ins:
118  (m_object = new(pool) ncbi::objects::CInsertion())->AddReference();
119  break;
120  case e_Conv:
121  (m_object = new(pool) ncbi::objects::CConversion())->AddReference();
122  break;
123  case e_Delins:
124  (m_object = new(pool) ncbi::objects::CDelins())->AddReference();
125  break;
126  case e_Repeat:
127  (m_object = new(pool) ncbi::objects::CRepeat())->AddReference();
128  break;
129  case e_Prot_ext:
130  (m_object = new(pool) ncbi::objects::CProteinExtension())->AddReference();
131  break;
132  case e_Frameshift:
133  (m_object = new(pool) ncbi::objects::CFrameshift())->AddReference();
134  break;
135  default:
136  break;
137  }
138  m_choice = index;
139 }
140 
142  "not set",
143  "na-identity",
144  "na-sub",
145  "prot-sub",
146  "prot-silent",
147  "del",
148  "dup",
149  "inv",
150  "ins",
151  "conv",
152  "delins",
153  "repeat",
154  "prot-ext",
155  "frameshift"
156 };
157 
159 {
160  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
161 }
162 
164 {
165  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
166 }
167 
169 {
170  CheckSelected(e_Na_identity);
171  return *static_cast<const TNa_identity*>(m_object);
172 }
173 
175 {
176  Select(e_Na_identity, NCBI_NS_NCBI::eDoNotResetVariant);
177  return *static_cast<TNa_identity*>(m_object);
178 }
179 
181 {
182  TNa_identity* ptr = &value;
183  if ( m_choice != e_Na_identity || m_object != ptr ) {
184  ResetSelection();
185  (m_object = ptr)->AddReference();
186  m_choice = e_Na_identity;
187  }
188 }
189 
191 {
192  CheckSelected(e_Na_sub);
193  return *static_cast<const TNa_sub*>(m_object);
194 }
195 
197 {
198  Select(e_Na_sub, NCBI_NS_NCBI::eDoNotResetVariant);
199  return *static_cast<TNa_sub*>(m_object);
200 }
201 
203 {
204  TNa_sub* ptr = &value;
205  if ( m_choice != e_Na_sub || m_object != ptr ) {
206  ResetSelection();
207  (m_object = ptr)->AddReference();
208  m_choice = e_Na_sub;
209  }
210 }
211 
213 {
214  CheckSelected(e_Prot_sub);
215  return *static_cast<const TProt_sub*>(m_object);
216 }
217 
219 {
220  Select(e_Prot_sub, NCBI_NS_NCBI::eDoNotResetVariant);
221  return *static_cast<TProt_sub*>(m_object);
222 }
223 
225 {
226  TProt_sub* ptr = &value;
227  if ( m_choice != e_Prot_sub || m_object != ptr ) {
228  ResetSelection();
229  (m_object = ptr)->AddReference();
230  m_choice = e_Prot_sub;
231  }
232 }
233 
235 {
236  CheckSelected(e_Prot_silent);
237  return *static_cast<const TProt_silent*>(m_object);
238 }
239 
241 {
242  Select(e_Prot_silent, NCBI_NS_NCBI::eDoNotResetVariant);
243  return *static_cast<TProt_silent*>(m_object);
244 }
245 
247 {
248  TProt_silent* ptr = &value;
249  if ( m_choice != e_Prot_silent || m_object != ptr ) {
250  ResetSelection();
251  (m_object = ptr)->AddReference();
252  m_choice = e_Prot_silent;
253  }
254 }
255 
257 {
258  CheckSelected(e_Del);
259  return *static_cast<const TDel*>(m_object);
260 }
261 
263 {
264  Select(e_Del, NCBI_NS_NCBI::eDoNotResetVariant);
265  return *static_cast<TDel*>(m_object);
266 }
267 
269 {
270  TDel* ptr = &value;
271  if ( m_choice != e_Del || m_object != ptr ) {
272  ResetSelection();
273  (m_object = ptr)->AddReference();
274  m_choice = e_Del;
275  }
276 }
277 
279 {
280  CheckSelected(e_Dup);
281  return *static_cast<const TDup*>(m_object);
282 }
283 
285 {
286  Select(e_Dup, NCBI_NS_NCBI::eDoNotResetVariant);
287  return *static_cast<TDup*>(m_object);
288 }
289 
291 {
292  TDup* ptr = &value;
293  if ( m_choice != e_Dup || m_object != ptr ) {
294  ResetSelection();
295  (m_object = ptr)->AddReference();
296  m_choice = e_Dup;
297  }
298 }
299 
301 {
302  CheckSelected(e_Inv);
303  return *static_cast<const TInv*>(m_object);
304 }
305 
307 {
308  Select(e_Inv, NCBI_NS_NCBI::eDoNotResetVariant);
309  return *static_cast<TInv*>(m_object);
310 }
311 
313 {
314  TInv* ptr = &value;
315  if ( m_choice != e_Inv || m_object != ptr ) {
316  ResetSelection();
317  (m_object = ptr)->AddReference();
318  m_choice = e_Inv;
319  }
320 }
321 
323 {
324  CheckSelected(e_Ins);
325  return *static_cast<const TIns*>(m_object);
326 }
327 
329 {
330  Select(e_Ins, NCBI_NS_NCBI::eDoNotResetVariant);
331  return *static_cast<TIns*>(m_object);
332 }
333 
335 {
336  TIns* ptr = &value;
337  if ( m_choice != e_Ins || m_object != ptr ) {
338  ResetSelection();
339  (m_object = ptr)->AddReference();
340  m_choice = e_Ins;
341  }
342 }
343 
345 {
346  CheckSelected(e_Conv);
347  return *static_cast<const TConv*>(m_object);
348 }
349 
351 {
352  Select(e_Conv, NCBI_NS_NCBI::eDoNotResetVariant);
353  return *static_cast<TConv*>(m_object);
354 }
355 
357 {
358  TConv* ptr = &value;
359  if ( m_choice != e_Conv || m_object != ptr ) {
360  ResetSelection();
361  (m_object = ptr)->AddReference();
362  m_choice = e_Conv;
363  }
364 }
365 
367 {
368  CheckSelected(e_Delins);
369  return *static_cast<const TDelins*>(m_object);
370 }
371 
373 {
374  Select(e_Delins, NCBI_NS_NCBI::eDoNotResetVariant);
375  return *static_cast<TDelins*>(m_object);
376 }
377 
379 {
380  TDelins* ptr = &value;
381  if ( m_choice != e_Delins || m_object != ptr ) {
382  ResetSelection();
383  (m_object = ptr)->AddReference();
384  m_choice = e_Delins;
385  }
386 }
387 
389 {
390  CheckSelected(e_Repeat);
391  return *static_cast<const TRepeat*>(m_object);
392 }
393 
395 {
396  Select(e_Repeat, NCBI_NS_NCBI::eDoNotResetVariant);
397  return *static_cast<TRepeat*>(m_object);
398 }
399 
401 {
402  TRepeat* ptr = &value;
403  if ( m_choice != e_Repeat || m_object != ptr ) {
404  ResetSelection();
405  (m_object = ptr)->AddReference();
406  m_choice = e_Repeat;
407  }
408 }
409 
411 {
412  CheckSelected(e_Prot_ext);
413  return *static_cast<const TProt_ext*>(m_object);
414 }
415 
417 {
418  Select(e_Prot_ext, NCBI_NS_NCBI::eDoNotResetVariant);
419  return *static_cast<TProt_ext*>(m_object);
420 }
421 
423 {
424  TProt_ext* ptr = &value;
425  if ( m_choice != e_Prot_ext || m_object != ptr ) {
426  ResetSelection();
427  (m_object = ptr)->AddReference();
428  m_choice = e_Prot_ext;
429  }
430 }
431 
433 {
434  CheckSelected(e_Frameshift);
435  return *static_cast<const TFrameshift*>(m_object);
436 }
437 
439 {
440  Select(e_Frameshift, NCBI_NS_NCBI::eDoNotResetVariant);
441  return *static_cast<TFrameshift*>(m_object);
442 }
443 
445 {
446  TFrameshift* ptr = &value;
447  if ( m_choice != e_Frameshift || m_object != ptr ) {
448  ResetSelection();
449  (m_object = ptr)->AddReference();
450  m_choice = e_Frameshift;
451  }
452 }
453 
454 // helper methods
455 
456 // type info
458 {
459  SET_INTERNAL_NAME("SimpleVariant", "type");
460  SET_CHOICE_MODULE("NCBI-VariationIRep");
461  ADD_NAMED_REF_CHOICE_VARIANT("na-identity", m_object, CNaIdentity);
462  ADD_NAMED_REF_CHOICE_VARIANT("na-sub", m_object, CNaSub);
463  ADD_NAMED_REF_CHOICE_VARIANT("prot-sub", m_object, CProteinSub);
464  ADD_NAMED_REF_CHOICE_VARIANT("prot-silent", m_object, CAaLocation);
465  ADD_NAMED_REF_CHOICE_VARIANT("del", m_object, CDeletion);
466  ADD_NAMED_REF_CHOICE_VARIANT("dup", m_object, CDuplication);
467  ADD_NAMED_REF_CHOICE_VARIANT("inv", m_object, CInversion);
468  ADD_NAMED_REF_CHOICE_VARIANT("ins", m_object, CInsertion);
469  ADD_NAMED_REF_CHOICE_VARIANT("conv", m_object, CConversion);
470  ADD_NAMED_REF_CHOICE_VARIANT("delins", m_object, CDelins);
471  ADD_NAMED_REF_CHOICE_VARIANT("repeat", m_object, CRepeat);
472  ADD_NAMED_REF_CHOICE_VARIANT("prot-ext", m_object, CProteinExtension);
473  ADD_NAMED_REF_CHOICE_VARIANT("frameshift", m_object, CFrameshift);
474  info->CodeVersion(22301);
475  info->DataSpec(ncbi::EDataSpec::eASN);
476 }
478 
479 // constructor
481  : m_choice(e_not_set)
482 {
483 }
484 
485 // destructor
487 {
488  Reset();
489 }
490 
491 
493 {
494  if ( !m_Type ) {
495  m_Type.Reset(new TType());
496  return;
497  }
498  (*m_Type).Reset();
499 }
500 
502 {
503  m_Type.Reset(&value);
504 }
505 
507 {
508  ResetType();
509  ResetFuzzy();
510 }
511 
513 {
514  SET_CLASS_MODULE("NCBI-VariationIRep");
515  ADD_NAMED_REF_MEMBER("type", m_Type, C_Type);
516  ADD_NAMED_STD_MEMBER("fuzzy", m_Fuzzy)->SetDefault(new TFuzzy(false))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
517  info->RandomOrder();
518  info->CodeVersion(22301);
519  info->DataSpec(ncbi::EDataSpec::eASN);
520 }
522 
523 // constructor
525  : m_Fuzzy(false)
526 {
527  memset(m_set_State,0,sizeof(m_set_State));
528  if ( !IsAllocatedInPool() ) {
529  ResetType();
530  }
531 }
532 
533 // destructor
535 {
536 }
537 
538 
539 
540 END_objects_SCOPE // namespace ncbi::objects::
541 
543 
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.
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.
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("SimpleVariant", CSimpleVariant)
BEGIN_NAMED_CHOICE_INFO("", CSimpleVariant_Base::C_Type)
#define false
Definition: bool.h:36
CConversion –.
Definition: Conversion.hpp:66
CDeletion –.
Definition: Deletion.hpp:66
CDelins –.
Definition: Delins.hpp:66
CDuplication –.
Definition: Duplication.hpp:66
CFrameshift –.
Definition: Frameshift.hpp:66
CInsertion –.
Definition: Insertion.hpp:66
CInversion –.
Definition: Inversion.hpp:66
CNaIdentity –.
Definition: NaIdentity.hpp:66
CNaSub –.
Definition: NaSub.hpp:66
CProteinExtension –.
CProteinSub –.
Definition: ProteinSub.hpp:66
CRepeat –.
Definition: Repeat.hpp:66
CSimpleVariant –.
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_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
@ 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
TType & SetType(void)
Assign a value to Type data member.
void Reset(void)
Reset the whole object.
const TProt_sub & GetProt_sub(void) const
Get the variant data.
TDelins & SetDelins(void)
Select the variant.
const TDup & GetDup(void) const
Get the variant data.
const TDelins & GetDelins(void) const
Get the variant data.
const TInv & GetInv(void) const
Get the variant data.
TDup & SetDup(void)
Select the variant.
void ResetType(void)
Reset Type data member.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void ResetSelection(void)
Reset the selection (set it to e_not_set).
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
const TDel & GetDel(void) const
Get the variant data.
const TNa_sub & GetNa_sub(void) const
Get the variant data.
TFrameshift & SetFrameshift(void)
Select the variant.
virtual ~CSimpleVariant_Base(void)
TConv & SetConv(void)
Select the variant.
TRepeat & SetRepeat(void)
Select the variant.
virtual void Reset(void)
Reset the whole object.
TNa_identity & SetNa_identity(void)
Select the variant.
const TFrameshift & GetFrameshift(void) const
Get the variant data.
TInv & SetInv(void)
Select the variant.
TDel & SetDel(void)
Select the variant.
const TProt_silent & GetProt_silent(void) const
Get the variant data.
TProt_ext & SetProt_ext(void)
Select the variant.
const TIns & GetIns(void) const
Get the variant data.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
static const char *const sm_SelectionNames[]
TProt_sub & SetProt_sub(void)
Select the variant.
TProt_silent & SetProt_silent(void)
Select the variant.
TNa_sub & SetNa_sub(void)
Select the variant.
TIns & SetIns(void)
Select the variant.
void ResetFuzzy(void)
Reset Fuzzy data member.
const TNa_identity & GetNa_identity(void) const
Get the variant data.
const TConv & GetConv(void) const
Get the variant data.
const TRepeat & GetRepeat(void) const
Get the variant data.
const TProt_ext & GetProt_ext(void) const
Get the variant data.
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Thu Dec 07 10:10:26 2023 by modify_doxy.py rev. 669887