NCBI C++ ToolKit
SeqFeatData_.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
45 #include <objects/seq/Pubdesc.hpp>
59 
60 BEGIN_objects_SCOPE // namespace ncbi::objects::
61 
62 
63 // generated classes
64 
66 {
67  SET_ENUM_INTERNAL_NAME("SeqFeatData", "bond");
68  SET_ENUM_MODULE("NCBI-Seqfeat");
69  ADD_ENUM_VALUE("disulfide", eBond_disulfide);
70  ADD_ENUM_VALUE("thiolester", eBond_thiolester);
71  ADD_ENUM_VALUE("xlink", eBond_xlink);
72  ADD_ENUM_VALUE("thioether", eBond_thioether);
73  ADD_ENUM_VALUE("other", eBond_other);
74 }
76 
78 {
79  SET_ENUM_INTERNAL_NAME("SeqFeatData", "site");
80  SET_ENUM_MODULE("NCBI-Seqfeat");
81  ADD_ENUM_VALUE("active", eSite_active);
82  ADD_ENUM_VALUE("binding", eSite_binding);
83  ADD_ENUM_VALUE("cleavage", eSite_cleavage);
84  ADD_ENUM_VALUE("inhibit", eSite_inhibit);
85  ADD_ENUM_VALUE("modified", eSite_modified);
86  ADD_ENUM_VALUE("glycosylation", eSite_glycosylation);
87  ADD_ENUM_VALUE("myristoylation", eSite_myristoylation);
88  ADD_ENUM_VALUE("mutagenized", eSite_mutagenized);
89  ADD_ENUM_VALUE("metal-binding", eSite_metal_binding);
90  ADD_ENUM_VALUE("phosphorylation", eSite_phosphorylation);
91  ADD_ENUM_VALUE("acetylation", eSite_acetylation);
92  ADD_ENUM_VALUE("amidation", eSite_amidation);
93  ADD_ENUM_VALUE("methylation", eSite_methylation);
94  ADD_ENUM_VALUE("hydroxylation", eSite_hydroxylation);
95  ADD_ENUM_VALUE("sulfatation", eSite_sulfatation);
96  ADD_ENUM_VALUE("oxidative-deamination", eSite_oxidative_deamination);
97  ADD_ENUM_VALUE("pyrrolidone-carboxylic-acid", eSite_pyrrolidone_carboxylic_acid);
98  ADD_ENUM_VALUE("gamma-carboxyglutamic-acid", eSite_gamma_carboxyglutamic_acid);
99  ADD_ENUM_VALUE("blocked", eSite_blocked);
100  ADD_ENUM_VALUE("lipid-binding", eSite_lipid_binding);
101  ADD_ENUM_VALUE("np-binding", eSite_np_binding);
102  ADD_ENUM_VALUE("dna-binding", eSite_dna_binding);
103  ADD_ENUM_VALUE("signal-peptide", eSite_signal_peptide);
104  ADD_ENUM_VALUE("transit-peptide", eSite_transit_peptide);
105  ADD_ENUM_VALUE("transmembrane-region", eSite_transmembrane_region);
106  ADD_ENUM_VALUE("nitrosylation", eSite_nitrosylation);
107  ADD_ENUM_VALUE("other", eSite_other);
108 }
110 
112 {
113  SET_ENUM_INTERNAL_NAME("SeqFeatData", "psec-str");
114  SET_ENUM_MODULE("NCBI-Seqfeat");
115  ADD_ENUM_VALUE("helix", ePsec_str_helix);
116  ADD_ENUM_VALUE("sheet", ePsec_str_sheet);
117  ADD_ENUM_VALUE("turn", ePsec_str_turn);
118 }
120 
122 {
123  if ( m_choice != e_not_set )
124  ResetSelection();
125 }
126 
128 {
129  switch ( m_choice ) {
130  case e_Het:
131  m_Het.Destruct();
132  break;
133  case e_Region:
134  case e_Non_std_residue:
135  m_string.Destruct();
136  break;
137  case e_Gene:
138  case e_Org:
139  case e_Cdregion:
140  case e_Prot:
141  case e_Rna:
142  case e_Pub:
143  case e_Seq:
144  case e_Imp:
145  case e_Rsite:
146  case e_User:
147  case e_Txinit:
148  case e_Num:
149  case e_Biosrc:
150  case e_Clone:
151  case e_Variation:
152  m_object->RemoveReference();
153  break;
154  default:
155  break;
156  }
158 }
159 
160 void CSeqFeatData_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
161 {
162  switch ( index ) {
163  case e_Gene:
164  (m_object = new(pool) ncbi::objects::CGene_ref())->AddReference();
165  break;
166  case e_Org:
167  (m_object = new(pool) ncbi::objects::COrg_ref())->AddReference();
168  break;
169  case e_Cdregion:
170  (m_object = new(pool) ncbi::objects::CCdregion())->AddReference();
171  break;
172  case e_Prot:
173  (m_object = new(pool) ncbi::objects::CProt_ref())->AddReference();
174  break;
175  case e_Rna:
176  (m_object = new(pool) ncbi::objects::CRNA_ref())->AddReference();
177  break;
178  case e_Pub:
179  (m_object = new(pool) ncbi::objects::CPubdesc())->AddReference();
180  break;
181  case e_Seq:
182  (m_object = new(pool) ncbi::objects::CSeq_loc())->AddReference();
183  break;
184  case e_Imp:
185  (m_object = new(pool) ncbi::objects::CImp_feat())->AddReference();
186  break;
187  case e_Bond:
188  m_Bond = (EBond)(0);
189  break;
190  case e_Site:
191  m_Site = (ESite)(0);
192  break;
193  case e_Rsite:
194  (m_object = new(pool) ncbi::objects::CRsite_ref())->AddReference();
195  break;
196  case e_User:
197  (m_object = new(pool) ncbi::objects::CUser_object())->AddReference();
198  break;
199  case e_Txinit:
200  (m_object = new(pool) ncbi::objects::CTxinit())->AddReference();
201  break;
202  case e_Num:
203  (m_object = new(pool) ncbi::objects::CNumbering())->AddReference();
204  break;
205  case e_Psec_str:
206  m_Psec_str = (EPsec_str)(0);
207  break;
208  case e_Het:
209  m_Het.Construct();
210  break;
211  case e_Biosrc:
212  (m_object = new(pool) ncbi::objects::CBioSource())->AddReference();
213  break;
214  case e_Clone:
215  (m_object = new(pool) ncbi::objects::CClone_ref())->AddReference();
216  break;
217  case e_Variation:
218  (m_object = new(pool) ncbi::objects::CVariation_ref())->AddReference();
219  break;
220  case e_Region:
221  case e_Non_std_residue:
222  m_string.Construct();
223  break;
224  default:
225  break;
226  }
227  m_choice = index;
228 }
229 
230 const char* const CSeqFeatData_Base::sm_SelectionNames[] = {
231  "not set",
232  "gene",
233  "org",
234  "cdregion",
235  "prot",
236  "rna",
237  "pub",
238  "seq",
239  "imp",
240  "region",
241  "comment",
242  "bond",
243  "site",
244  "rsite",
245  "user",
246  "txinit",
247  "num",
248  "psec-str",
249  "non-std-residue",
250  "het",
251  "biosrc",
252  "clone",
253  "variation"
254 };
255 
257 {
258  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
259 }
260 
262 {
263  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
264 }
265 
267 {
269  return *static_cast<const TGene*>(m_object);
270 }
271 
273 {
275  return *static_cast<TGene*>(m_object);
276 }
277 
279 {
280  TGene* ptr = &value;
281  if ( m_choice != e_Gene || m_object != ptr ) {
282  ResetSelection();
283  (m_object = ptr)->AddReference();
284  m_choice = e_Gene;
285  }
286 }
287 
289 {
291  return *static_cast<const TOrg*>(m_object);
292 }
293 
295 {
297  return *static_cast<TOrg*>(m_object);
298 }
299 
301 {
302  TOrg* ptr = &value;
303  if ( m_choice != e_Org || m_object != ptr ) {
304  ResetSelection();
305  (m_object = ptr)->AddReference();
306  m_choice = e_Org;
307  }
308 }
309 
311 {
313  return *static_cast<const TCdregion*>(m_object);
314 }
315 
317 {
319  return *static_cast<TCdregion*>(m_object);
320 }
321 
323 {
324  TCdregion* ptr = &value;
325  if ( m_choice != e_Cdregion || m_object != ptr ) {
326  ResetSelection();
327  (m_object = ptr)->AddReference();
329  }
330 }
331 
333 {
335  return *static_cast<const TProt*>(m_object);
336 }
337 
339 {
341  return *static_cast<TProt*>(m_object);
342 }
343 
345 {
346  TProt* ptr = &value;
347  if ( m_choice != e_Prot || m_object != ptr ) {
348  ResetSelection();
349  (m_object = ptr)->AddReference();
350  m_choice = e_Prot;
351  }
352 }
353 
355 {
357  return *static_cast<const TRna*>(m_object);
358 }
359 
361 {
363  return *static_cast<TRna*>(m_object);
364 }
365 
367 {
368  TRna* ptr = &value;
369  if ( m_choice != e_Rna || m_object != ptr ) {
370  ResetSelection();
371  (m_object = ptr)->AddReference();
372  m_choice = e_Rna;
373  }
374 }
375 
377 {
379  return *static_cast<const TPub*>(m_object);
380 }
381 
383 {
385  return *static_cast<TPub*>(m_object);
386 }
387 
389 {
390  TPub* ptr = &value;
391  if ( m_choice != e_Pub || m_object != ptr ) {
392  ResetSelection();
393  (m_object = ptr)->AddReference();
394  m_choice = e_Pub;
395  }
396 }
397 
399 {
401  return *static_cast<const TSeq*>(m_object);
402 }
403 
405 {
407  return *static_cast<TSeq*>(m_object);
408 }
409 
411 {
412  TSeq* ptr = &value;
413  if ( m_choice != e_Seq || m_object != ptr ) {
414  ResetSelection();
415  (m_object = ptr)->AddReference();
416  m_choice = e_Seq;
417  }
418 }
419 
421 {
423  return *static_cast<const TImp*>(m_object);
424 }
425 
427 {
429  return *static_cast<TImp*>(m_object);
430 }
431 
433 {
434  TImp* ptr = &value;
435  if ( m_choice != e_Imp || m_object != ptr ) {
436  ResetSelection();
437  (m_object = ptr)->AddReference();
438  m_choice = e_Imp;
439  }
440 }
441 
443 {
445  *m_string = value;
446 }
447 
449 {
451  return *static_cast<const TRsite*>(m_object);
452 }
453 
455 {
457  return *static_cast<TRsite*>(m_object);
458 }
459 
461 {
462  TRsite* ptr = &value;
463  if ( m_choice != e_Rsite || m_object != ptr ) {
464  ResetSelection();
465  (m_object = ptr)->AddReference();
466  m_choice = e_Rsite;
467  }
468 }
469 
471 {
473  return *static_cast<const TUser*>(m_object);
474 }
475 
477 {
479  return *static_cast<TUser*>(m_object);
480 }
481 
483 {
484  TUser* ptr = &value;
485  if ( m_choice != e_User || m_object != ptr ) {
486  ResetSelection();
487  (m_object = ptr)->AddReference();
488  m_choice = e_User;
489  }
490 }
491 
493 {
495  return *static_cast<const TTxinit*>(m_object);
496 }
497 
499 {
501  return *static_cast<TTxinit*>(m_object);
502 }
503 
505 {
506  TTxinit* ptr = &value;
507  if ( m_choice != e_Txinit || m_object != ptr ) {
508  ResetSelection();
509  (m_object = ptr)->AddReference();
510  m_choice = e_Txinit;
511  }
512 }
513 
515 {
517  return *static_cast<const TNum*>(m_object);
518 }
519 
521 {
523  return *static_cast<TNum*>(m_object);
524 }
525 
527 {
528  TNum* ptr = &value;
529  if ( m_choice != e_Num || m_object != ptr ) {
530  ResetSelection();
531  (m_object = ptr)->AddReference();
532  m_choice = e_Num;
533  }
534 }
535 
537 {
539  *m_string = value;
540 }
541 
543 {
545  *m_Het = value;
546 }
547 
549 {
551  return *static_cast<const TBiosrc*>(m_object);
552 }
553 
555 {
557  return *static_cast<TBiosrc*>(m_object);
558 }
559 
561 {
562  TBiosrc* ptr = &value;
563  if ( m_choice != e_Biosrc || m_object != ptr ) {
564  ResetSelection();
565  (m_object = ptr)->AddReference();
566  m_choice = e_Biosrc;
567  }
568 }
569 
571 {
573  return *static_cast<const TClone*>(m_object);
574 }
575 
577 {
579  return *static_cast<TClone*>(m_object);
580 }
581 
583 {
584  TClone* ptr = &value;
585  if ( m_choice != e_Clone || m_object != ptr ) {
586  ResetSelection();
587  (m_object = ptr)->AddReference();
588  m_choice = e_Clone;
589  }
590 }
591 
593 {
595  return *static_cast<const TVariation*>(m_object);
596 }
597 
599 {
601  return *static_cast<TVariation*>(m_object);
602 }
603 
605 {
606  TVariation* ptr = &value;
607  if ( m_choice != e_Variation || m_object != ptr ) {
608  ResetSelection();
609  (m_object = ptr)->AddReference();
611  }
612 }
613 
614 // helper methods
615 
616 // type info
618 {
619  SET_CHOICE_MODULE("NCBI-Seqfeat");
620  ADD_NAMED_REF_CHOICE_VARIANT("gene", m_object, CGene_ref);
621  ADD_NAMED_REF_CHOICE_VARIANT("org", m_object, COrg_ref);
622  ADD_NAMED_REF_CHOICE_VARIANT("cdregion", m_object, CCdregion);
623  ADD_NAMED_REF_CHOICE_VARIANT("prot", m_object, CProt_ref);
624  ADD_NAMED_REF_CHOICE_VARIANT("rna", m_object, CRNA_ref);
625  ADD_NAMED_REF_CHOICE_VARIANT("pub", m_object, CPubdesc);
626  ADD_NAMED_REF_CHOICE_VARIANT("seq", m_object, CSeq_loc);
627  ADD_NAMED_REF_CHOICE_VARIANT("imp", m_object, CImp_feat);
628  ADD_NAMED_BUF_CHOICE_VARIANT("region", m_string, STD, (string));
629  ADD_NAMED_NULL_CHOICE_VARIANT("comment", null, ());
630  ADD_NAMED_ENUM_CHOICE_VARIANT("bond", m_Bond, EBond);
631  ADD_NAMED_ENUM_CHOICE_VARIANT("site", m_Site, ESite);
632  ADD_NAMED_REF_CHOICE_VARIANT("rsite", m_object, CRsite_ref);
633  ADD_NAMED_REF_CHOICE_VARIANT("user", m_object, CUser_object);
634  ADD_NAMED_REF_CHOICE_VARIANT("txinit", m_object, CTxinit);
635  ADD_NAMED_REF_CHOICE_VARIANT("num", m_object, CNumbering);
636  ADD_NAMED_ENUM_CHOICE_VARIANT("psec-str", m_Psec_str, EPsec_str);
637  ADD_NAMED_BUF_CHOICE_VARIANT("non-std-residue", m_string, STD, (string));
638  ADD_NAMED_BUF_CHOICE_VARIANT("het", m_Het, CLASS, (CHeterogen));
639  ADD_NAMED_REF_CHOICE_VARIANT("biosrc", m_object, CBioSource);
640  ADD_NAMED_REF_CHOICE_VARIANT("clone", m_object, CClone_ref);
641  ADD_NAMED_REF_CHOICE_VARIANT("variation", m_object, CVariation_ref);
642 }
644 
645 // constructor
647  : m_choice(e_not_set)
648 {
649 }
650 
651 // destructor
653 {
654  Reset();
655 }
656 
657 
658 
659 END_objects_SCOPE // namespace ncbi::objects::
660 
662 
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
#define SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:546
TTxinit & SetTxinit(void)
Select the variant.
const TVariation & GetVariation(void) const
Get the variant data.
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:388
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
static const char *const sm_SelectionNames[]
const TRsite & GetRsite(void) const
Get the variant data.
THet & SetHet(void)
Select the variant.
user defined structure
User-defined methods of the data storage class.
#define END_ENUM_INFO
Definition: serialimpl.hpp:556
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() ESite(void)
Access to ESite's attributes (values, names) as defined in spec.
CRsite_ref –.
Definition: Rsite_ref.hpp:65
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TRegion & SetRegion(void)
Select the variant.
const TOrg & GetOrg(void) const
Get the variant data.
#define ADD_NAMED_ENUM_CHOICE_VARIANT(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:379
NCBI_NS_NCBI::CSerialObject * m_object
string
Definition: cgiapp.hpp:407
virtual void Reset(void)
Reset the whole object.
TCdregion & SetCdregion(void)
Select the variant.
TOrg & SetOrg(void)
Select the variant.
TNum & SetNum(void)
Select the variant.
BEGIN_NAMED_BASE_CHOICE_INFO("SeqFeatData", CSeqFeatData)
non-standard residue here in seq
const TBiosrc & GetBiosrc(void) const
Get the variant data.
const TClone & GetClone(void) const
Get the variant data.
User-defined methods of the data storage class.
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:373
TRsite & SetRsite(void)
Select the variant.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
NCBI_NS_NCBI::CUnionBuffer< THet > m_Het
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:169
CClone_ref –.
Definition: Clone_ref.hpp:65
publication applies to this seq
const TCdregion & GetCdregion(void) const
Get the variant data.
CNumbering –.
Definition: Numbering.hpp:65
NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
CHeterogen –.
Definition: Heterogen.hpp:65
TBiosrc & SetBiosrc(void)
Select the variant.
.hpp User-defined methods of the data storage class.
Definition: RNA_ref.hpp:53
BEGIN_NAMED_ENUM_IN_INFO("", CSeqFeatData_Base::, EBond, false)
transcription initiation
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
const TNum & GetNum(void) const
Get the variant data.
const TRna & GetRna(void) const
Get the variant data.
TClone & SetClone(void)
Select the variant.
named region (globin locus)
.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:53
const TGene & GetGene(void) const
Get the variant data.
TGene & SetGene(void)
Select the variant.
TImp & SetImp(void)
Select the variant.
No variant selected.
E_Choice
Choice variants.
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() EPsec_str(void)
Access to EPsec_str's attributes (values, names) as defined in spec.
CTxinit –.
Definition: Txinit.hpp:65
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() EBond(void)
Access to EBond's attributes (values, names) as defined in spec.
TPub & SetPub(void)
Select the variant.
CSeqFeatData_Base –.
#define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:367
cofactor, prosthetic grp, etc, bound to seq
const TUser & GetUser(void) const
Get the variant data.
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:488
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1185
const TSeq & GetSeq(void) const
Get the variant data.
const TPub & GetPub(void) const
Get the variant data.
User-defined methods of the data storage class.
TNon_std_residue & SetNon_std_residue(void)
Select the variant.
TProt & SetProt(void)
Select the variant.
TRna & SetRna(void)
Select the variant.
const TTxinit & GetTxinit(void) const
Get the variant data.
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:540
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TUser & SetUser(void)
Select the variant.
to annotate origin from another seq
const TImp & GetImp(void) const
Get the variant data.
#define END_CHOICE_INFO
Definition: serialimpl.hpp:494
TSeq & SetSeq(void)
Select the variant.
User-defined methods of the data storage class.
TVariation & SetVariation(void)
Select the variant.
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:490
const TProt & GetProt(void) const
Get the variant data.
virtual ~CSeqFeatData_Base(void)
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
restriction site (for maps really)
a numbering system
User-defined methods of the data storage class.
CCdregion –.
Definition: Cdregion.hpp:65
.hpp User-defined methods of the data storage class.
Definition: Imp_feat.hpp:53
User-defined methods of the data storage class.
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:549
Modified on Tue Jul 28 11:18:57 2015 by modify_doxy.py rev. 426318