NCBI C++ ToolKit
Seq_id_.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  * 'seqloc.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
50 
51 BEGIN_objects_SCOPE // namespace ncbi::objects::
52 
53 
54 // generated classes
55 
57 {
58  if ( m_choice != e_not_set )
60 }
61 
63 {
64  switch ( m_choice ) {
65  case e_Local:
66  case e_Giim:
67  case e_Genbank:
68  case e_Embl:
69  case e_Pir:
70  case e_Swissprot:
71  case e_Patent:
72  case e_Other:
73  case e_General:
74  case e_Ddbj:
75  case e_Prf:
76  case e_Pdb:
77  case e_Tpg:
78  case e_Tpe:
79  case e_Tpd:
80  case e_Gpipe:
82  m_object->RemoveReference();
83  break;
84  default:
85  break;
86  }
88 }
89 
90 void CSeq_id_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
91 {
92  switch ( index ) {
93  case e_Local:
94  (m_object = new(pool) ncbi::objects::CObject_id())->AddReference();
95  break;
96  case e_Gibbsq:
97  m_Gibbsq = 0;
98  break;
99  case e_Gibbmt:
100  m_Gibbmt = 0;
101  break;
102  case e_Giim:
103  (m_object = new(pool) ncbi::objects::CGiimport_id())->AddReference();
104  break;
105  case e_Genbank:
106  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
107  break;
108  case e_Embl:
109  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
110  break;
111  case e_Pir:
112  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
113  break;
114  case e_Swissprot:
115  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
116  break;
117  case e_Patent:
118  (m_object = new(pool) ncbi::objects::CPatent_seq_id())->AddReference();
119  break;
120  case e_Other:
121  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
122  break;
123  case e_General:
124  (m_object = new(pool) ncbi::objects::CDbtag())->AddReference();
125  break;
126  case e_Gi:
127  m_Gi = 0;
128  break;
129  case e_Ddbj:
130  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
131  break;
132  case e_Prf:
133  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
134  break;
135  case e_Pdb:
136  (m_object = new(pool) ncbi::objects::CPDB_seq_id())->AddReference();
137  break;
138  case e_Tpg:
139  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
140  break;
141  case e_Tpe:
142  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
143  break;
144  case e_Tpd:
145  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
146  break;
147  case e_Gpipe:
148  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
149  break;
150  case e_Named_annot_track:
151  (m_object = new(pool) ncbi::objects::CTextseq_id())->AddReference();
152  break;
153  default:
154  break;
155  }
156  m_choice = index;
157 }
158 
159 const char* const CSeq_id_Base::sm_SelectionNames[] = {
160  "not set",
161  "local",
162  "gibbsq",
163  "gibbmt",
164  "giim",
165  "genbank",
166  "embl",
167  "pir",
168  "swissprot",
169  "patent",
170  "other",
171  "general",
172  "gi",
173  "ddbj",
174  "prf",
175  "pdb",
176  "tpg",
177  "tpe",
178  "tpd",
179  "gpipe",
180  "named-annot-track"
181 };
182 
184 {
185  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
186 }
187 
189 {
190  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
191 }
192 
194 {
196  return *static_cast<const TLocal*>(m_object);
197 }
198 
200 {
202  return *static_cast<TLocal*>(m_object);
203 }
204 
206 {
207  TLocal* ptr = &value;
208  if ( m_choice != e_Local || m_object != ptr ) {
209  ResetSelection();
210  (m_object = ptr)->AddReference();
211  m_choice = e_Local;
212  }
213 }
214 
216 {
218  return *static_cast<const TGiim*>(m_object);
219 }
220 
222 {
224  return *static_cast<TGiim*>(m_object);
225 }
226 
228 {
229  TGiim* ptr = &value;
230  if ( m_choice != e_Giim || m_object != ptr ) {
231  ResetSelection();
232  (m_object = ptr)->AddReference();
233  m_choice = e_Giim;
234  }
235 }
236 
238 {
240  return *static_cast<const TGenbank*>(m_object);
241 }
242 
244 {
246  return *static_cast<TGenbank*>(m_object);
247 }
248 
250 {
251  TGenbank* ptr = &value;
252  if ( m_choice != e_Genbank || m_object != ptr ) {
253  ResetSelection();
254  (m_object = ptr)->AddReference();
256  }
257 }
258 
260 {
262  return *static_cast<const TEmbl*>(m_object);
263 }
264 
266 {
268  return *static_cast<TEmbl*>(m_object);
269 }
270 
272 {
273  TEmbl* ptr = &value;
274  if ( m_choice != e_Embl || m_object != ptr ) {
275  ResetSelection();
276  (m_object = ptr)->AddReference();
277  m_choice = e_Embl;
278  }
279 }
280 
282 {
284  return *static_cast<const TPir*>(m_object);
285 }
286 
288 {
290  return *static_cast<TPir*>(m_object);
291 }
292 
294 {
295  TPir* ptr = &value;
296  if ( m_choice != e_Pir || m_object != ptr ) {
297  ResetSelection();
298  (m_object = ptr)->AddReference();
299  m_choice = e_Pir;
300  }
301 }
302 
304 {
306  return *static_cast<const TSwissprot*>(m_object);
307 }
308 
310 {
312  return *static_cast<TSwissprot*>(m_object);
313 }
314 
316 {
317  TSwissprot* ptr = &value;
318  if ( m_choice != e_Swissprot || m_object != ptr ) {
319  ResetSelection();
320  (m_object = ptr)->AddReference();
322  }
323 }
324 
326 {
328  return *static_cast<const TPatent*>(m_object);
329 }
330 
332 {
334  return *static_cast<TPatent*>(m_object);
335 }
336 
338 {
339  TPatent* ptr = &value;
340  if ( m_choice != e_Patent || m_object != ptr ) {
341  ResetSelection();
342  (m_object = ptr)->AddReference();
343  m_choice = e_Patent;
344  }
345 }
346 
348 {
350  return *static_cast<const TOther*>(m_object);
351 }
352 
354 {
356  return *static_cast<TOther*>(m_object);
357 }
358 
360 {
361  TOther* ptr = &value;
362  if ( m_choice != e_Other || m_object != ptr ) {
363  ResetSelection();
364  (m_object = ptr)->AddReference();
365  m_choice = e_Other;
366  }
367 }
368 
370 {
372  return *static_cast<const TGeneral*>(m_object);
373 }
374 
376 {
378  return *static_cast<TGeneral*>(m_object);
379 }
380 
382 {
383  TGeneral* ptr = &value;
384  if ( m_choice != e_General || m_object != ptr ) {
385  ResetSelection();
386  (m_object = ptr)->AddReference();
388  }
389 }
390 
392 {
394  return *static_cast<const TDdbj*>(m_object);
395 }
396 
398 {
400  return *static_cast<TDdbj*>(m_object);
401 }
402 
404 {
405  TDdbj* ptr = &value;
406  if ( m_choice != e_Ddbj || m_object != ptr ) {
407  ResetSelection();
408  (m_object = ptr)->AddReference();
409  m_choice = e_Ddbj;
410  }
411 }
412 
414 {
416  return *static_cast<const TPrf*>(m_object);
417 }
418 
420 {
422  return *static_cast<TPrf*>(m_object);
423 }
424 
426 {
427  TPrf* ptr = &value;
428  if ( m_choice != e_Prf || m_object != ptr ) {
429  ResetSelection();
430  (m_object = ptr)->AddReference();
431  m_choice = e_Prf;
432  }
433 }
434 
436 {
438  return *static_cast<const TPdb*>(m_object);
439 }
440 
442 {
444  return *static_cast<TPdb*>(m_object);
445 }
446 
448 {
449  TPdb* ptr = &value;
450  if ( m_choice != e_Pdb || m_object != ptr ) {
451  ResetSelection();
452  (m_object = ptr)->AddReference();
453  m_choice = e_Pdb;
454  }
455 }
456 
458 {
460  return *static_cast<const TTpg*>(m_object);
461 }
462 
464 {
466  return *static_cast<TTpg*>(m_object);
467 }
468 
470 {
471  TTpg* ptr = &value;
472  if ( m_choice != e_Tpg || m_object != ptr ) {
473  ResetSelection();
474  (m_object = ptr)->AddReference();
475  m_choice = e_Tpg;
476  }
477 }
478 
480 {
482  return *static_cast<const TTpe*>(m_object);
483 }
484 
486 {
488  return *static_cast<TTpe*>(m_object);
489 }
490 
492 {
493  TTpe* ptr = &value;
494  if ( m_choice != e_Tpe || m_object != ptr ) {
495  ResetSelection();
496  (m_object = ptr)->AddReference();
497  m_choice = e_Tpe;
498  }
499 }
500 
502 {
504  return *static_cast<const TTpd*>(m_object);
505 }
506 
508 {
510  return *static_cast<TTpd*>(m_object);
511 }
512 
514 {
515  TTpd* ptr = &value;
516  if ( m_choice != e_Tpd || m_object != ptr ) {
517  ResetSelection();
518  (m_object = ptr)->AddReference();
519  m_choice = e_Tpd;
520  }
521 }
522 
524 {
526  return *static_cast<const TGpipe*>(m_object);
527 }
528 
530 {
532  return *static_cast<TGpipe*>(m_object);
533 }
534 
536 {
537  TGpipe* ptr = &value;
538  if ( m_choice != e_Gpipe || m_object != ptr ) {
539  ResetSelection();
540  (m_object = ptr)->AddReference();
541  m_choice = e_Gpipe;
542  }
543 }
544 
546 {
548  return *static_cast<const TNamed_annot_track*>(m_object);
549 }
550 
552 {
554  return *static_cast<TNamed_annot_track*>(m_object);
555 }
556 
558 {
559  TNamed_annot_track* ptr = &value;
560  if ( m_choice != e_Named_annot_track || m_object != ptr ) {
561  ResetSelection();
562  (m_object = ptr)->AddReference();
564  }
565 }
566 
567 // helper methods
568 
569 // type info
571 {
572  SET_CHOICE_MODULE("NCBI-Seqloc");
573  ADD_NAMED_REF_CHOICE_VARIANT("local", m_object, CObject_id);
574  ADD_NAMED_STD_CHOICE_VARIANT("gibbsq", m_Gibbsq);
575  ADD_NAMED_STD_CHOICE_VARIANT("gibbmt", m_Gibbmt);
576  ADD_NAMED_REF_CHOICE_VARIANT("giim", m_object, CGiimport_id);
577  ADD_NAMED_REF_CHOICE_VARIANT("genbank", m_object, CTextseq_id);
578  ADD_NAMED_REF_CHOICE_VARIANT("embl", m_object, CTextseq_id);
579  ADD_NAMED_REF_CHOICE_VARIANT("pir", m_object, CTextseq_id);
580  ADD_NAMED_REF_CHOICE_VARIANT("swissprot", m_object, CTextseq_id);
581  ADD_NAMED_REF_CHOICE_VARIANT("patent", m_object, CPatent_seq_id);
582  ADD_NAMED_REF_CHOICE_VARIANT("other", m_object, CTextseq_id);
583  ADD_NAMED_REF_CHOICE_VARIANT("general", m_object, CDbtag);
584  ADD_NAMED_STD_CHOICE_VARIANT("gi", m_Gi);
585  ADD_NAMED_REF_CHOICE_VARIANT("ddbj", m_object, CTextseq_id);
586  ADD_NAMED_REF_CHOICE_VARIANT("prf", m_object, CTextseq_id);
587  ADD_NAMED_REF_CHOICE_VARIANT("pdb", m_object, CPDB_seq_id);
588  ADD_NAMED_REF_CHOICE_VARIANT("tpg", m_object, CTextseq_id);
589  ADD_NAMED_REF_CHOICE_VARIANT("tpe", m_object, CTextseq_id);
590  ADD_NAMED_REF_CHOICE_VARIANT("tpd", m_object, CTextseq_id);
591  ADD_NAMED_REF_CHOICE_VARIANT("gpipe", m_object, CTextseq_id);
592  ADD_NAMED_REF_CHOICE_VARIANT("named-annot-track", m_object, CTextseq_id);
593  info->CodeVersion(22400);
594  info->DataSpec(ncbi::EDataSpec::eASN);
595 }
597 
598 // constructor
600  : m_choice(e_not_set)
601 {
602 }
603 
604 // destructor
606 {
607  Reset();
608 }
609 
610 
611 
612 END_objects_SCOPE // namespace ncbi::objects::
613 
615 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Seq-id", CSeq_id)
Definition: Seq_id_.cpp:570
Definition: Dbtag.hpp:53
CGiimport_id –.
Definition: Giimport_id.hpp:66
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 ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TGeneral & SetGeneral(void)
Select the variant.
Definition: Seq_id_.cpp:375
TNamed_annot_track & SetNamed_annot_track(void)
Select the variant.
Definition: Seq_id_.cpp:551
const TEmbl & GetEmbl(void) const
Get the variant data.
Definition: Seq_id_.cpp:259
ncbi::TIntId m_Gi
Definition: Seq_id_.hpp:731
const TPdb & GetPdb(void) const
Get the variant data.
Definition: Seq_id_.cpp:435
TPatent & SetPatent(void)
Select the variant.
Definition: Seq_id_.cpp:331
TEmbl & SetEmbl(void)
Select the variant.
Definition: Seq_id_.cpp:265
const TTpe & GetTpe(void) const
Get the variant data.
Definition: Seq_id_.cpp:479
TOther & SetOther(void)
Select the variant.
Definition: Seq_id_.cpp:353
const TGenbank & GetGenbank(void) const
Get the variant data.
Definition: Seq_id_.cpp:237
const TTpd & GetTpd(void) const
Get the variant data.
Definition: Seq_id_.cpp:501
TTpe & SetTpe(void)
Select the variant.
Definition: Seq_id_.cpp:485
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_id_.cpp:62
const TTpg & GetTpg(void) const
Get the variant data.
Definition: Seq_id_.cpp:457
TTpg & SetTpg(void)
Select the variant.
Definition: Seq_id_.cpp:463
virtual ~CSeq_id_Base(void)
Definition: Seq_id_.cpp:605
virtual void Reset(void)
Reset the whole object.
Definition: Seq_id_.cpp:56
TPir & SetPir(void)
Select the variant.
Definition: Seq_id_.cpp:287
TTpd & SetTpd(void)
Select the variant.
Definition: Seq_id_.cpp:507
TGpipe & SetGpipe(void)
Select the variant.
Definition: Seq_id_.cpp:529
E_Choice
Choice variants.
Definition: Seq_id_.hpp:93
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_id_.cpp:90
TDdbj & SetDdbj(void)
Select the variant.
Definition: Seq_id_.cpp:397
TGibbmt m_Gibbmt
Definition: Seq_id_.hpp:730
const TOther & GetOther(void) const
Get the variant data.
Definition: Seq_id_.cpp:347
const TGiim & GetGiim(void) const
Get the variant data.
Definition: Seq_id_.cpp:215
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_id_.cpp:188
E_Choice m_choice
Definition: Seq_id_.hpp:722
const TSwissprot & GetSwissprot(void) const
Get the variant data.
Definition: Seq_id_.cpp:303
TGibbsq m_Gibbsq
Definition: Seq_id_.hpp:729
TLocal & SetLocal(void)
Select the variant.
Definition: Seq_id_.cpp:199
TGiim & SetGiim(void)
Select the variant.
Definition: Seq_id_.cpp:221
const TDdbj & GetDdbj(void) const
Get the variant data.
Definition: Seq_id_.cpp:391
const TLocal & GetLocal(void) const
Get the variant data.
Definition: Seq_id_.cpp:193
const TPir & GetPir(void) const
Get the variant data.
Definition: Seq_id_.cpp:281
static const char *const sm_SelectionNames[]
Definition: Seq_id_.hpp:726
const TGpipe & GetGpipe(void) const
Get the variant data.
Definition: Seq_id_.cpp:523
TPrf & SetPrf(void)
Select the variant.
Definition: Seq_id_.cpp:419
const TGeneral & GetGeneral(void) const
Get the variant data.
Definition: Seq_id_.cpp:369
TGenbank & SetGenbank(void)
Select the variant.
Definition: Seq_id_.cpp:243
const TPatent & GetPatent(void) const
Get the variant data.
Definition: Seq_id_.cpp:325
const TPrf & GetPrf(void) const
Get the variant data.
Definition: Seq_id_.cpp:413
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Seq_id_.hpp:732
TSwissprot & SetSwissprot(void)
Select the variant.
Definition: Seq_id_.cpp:309
CSeq_id_Base(void)
Definition: Seq_id_.cpp:599
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_id_.cpp:183
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Seq_id_.hpp:752
const TNamed_annot_track & GetNamed_annot_track(void) const
Get the variant data.
Definition: Seq_id_.cpp:545
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TPdb & SetPdb(void)
Select the variant.
Definition: Seq_id_.cpp:441
@ e_Gibbmt
Geninfo backbone moltype.
Definition: Seq_id_.hpp:97
@ e_Giim
Geninfo import id.
Definition: Seq_id_.hpp:98
@ e_Other
for historical reasons, 'other' = 'refseq'
Definition: Seq_id_.hpp:104
@ e_Gpipe
Internal NCBI genome pipeline processing ID.
Definition: Seq_id_.hpp:113
@ e_Tpe
Third Party Annot/Seq EMBL.
Definition: Seq_id_.hpp:111
@ e_Tpd
Third Party Annot/Seq DDBJ.
Definition: Seq_id_.hpp:112
@ e_Gibbsq
Geninfo backbone seqid.
Definition: Seq_id_.hpp:96
@ e_General
for other databases
Definition: Seq_id_.hpp:105
@ e_Ddbj
DDBJ.
Definition: Seq_id_.hpp:107
@ e_Gi
GenInfo Integrated Database.
Definition: Seq_id_.hpp:106
@ e_Prf
PRF SEQDB.
Definition: Seq_id_.hpp:108
@ e_Named_annot_track
Internal named annotation tracking ID.
Definition: Seq_id_.hpp:114
@ e_not_set
No variant selected.
Definition: Seq_id_.hpp:94
@ e_Tpg
Third Party Annot/Seq Genbank.
Definition: Seq_id_.hpp:110
@ e_Local
local use
Definition: Seq_id_.hpp:95
@ e_Pdb
PDB sequence.
Definition: Seq_id_.hpp:109
@ 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 Sep 04 15:03:51 2024 by modify_doxy.py rev. 669887