NCBI C++ ToolKit
Feat_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  * '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
47 
48 BEGIN_objects_SCOPE // namespace ncbi::objects::
49 
50 
51 // generated classes
52 
54 {
55  if ( m_choice != e_not_set )
57 }
58 
60 {
61  switch ( m_choice ) {
62  case e_Giim:
63  case e_Local:
64  case e_General:
65  m_object->RemoveReference();
66  break;
67  default:
68  break;
69  }
71 }
72 
73 void CFeat_id_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
74 {
75  switch ( index ) {
76  case e_Gibb:
77  m_Gibb = 0;
78  break;
79  case e_Giim:
80  (m_object = new(pool) ncbi::objects::CGiimport_id())->AddReference();
81  break;
82  case e_Local:
83  (m_object = new(pool) ncbi::objects::CObject_id())->AddReference();
84  break;
85  case e_General:
86  (m_object = new(pool) ncbi::objects::CDbtag())->AddReference();
87  break;
88  default:
89  break;
90  }
91  m_choice = index;
92 }
93 
94 const char* const CFeat_id_Base::sm_SelectionNames[] = {
95  "not set",
96  "gibb",
97  "giim",
98  "local",
99  "general"
100 };
101 
103 {
104  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
105 }
106 
108 {
109  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
110 }
111 
113 {
115  return *static_cast<const TGiim*>(m_object);
116 }
117 
119 {
121  return *static_cast<TGiim*>(m_object);
122 }
123 
125 {
126  TGiim* ptr = &value;
127  if ( m_choice != e_Giim || m_object != ptr ) {
128  ResetSelection();
129  (m_object = ptr)->AddReference();
130  m_choice = e_Giim;
131  }
132 }
133 
135 {
137  return *static_cast<const TLocal*>(m_object);
138 }
139 
141 {
143  return *static_cast<TLocal*>(m_object);
144 }
145 
147 {
148  TLocal* ptr = &value;
149  if ( m_choice != e_Local || m_object != ptr ) {
150  ResetSelection();
151  (m_object = ptr)->AddReference();
152  m_choice = e_Local;
153  }
154 }
155 
157 {
159  return *static_cast<const TGeneral*>(m_object);
160 }
161 
163 {
165  return *static_cast<TGeneral*>(m_object);
166 }
167 
169 {
170  TGeneral* ptr = &value;
171  if ( m_choice != e_General || m_object != ptr ) {
172  ResetSelection();
173  (m_object = ptr)->AddReference();
175  }
176 }
177 
178 // helper methods
179 
180 // type info
182 {
183  SET_CHOICE_MODULE("NCBI-Seqfeat");
184  ADD_NAMED_STD_CHOICE_VARIANT("gibb", m_Gibb);
185  ADD_NAMED_REF_CHOICE_VARIANT("giim", m_object, CGiimport_id);
186  ADD_NAMED_REF_CHOICE_VARIANT("local", m_object, CObject_id);
187  ADD_NAMED_REF_CHOICE_VARIANT("general", m_object, CDbtag);
188  info->CodeVersion(22400);
189  info->DataSpec(ncbi::EDataSpec::eASN);
190 }
192 
193 // constructor
195  : m_choice(e_not_set)
196 {
197 }
198 
199 // destructor
201 {
202  Reset();
203 }
204 
205 
206 
207 END_objects_SCOPE // namespace ncbi::objects::
208 
210 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Feat-id", CFeat_id)
Definition: Feat_id_.cpp:181
User-defined methods of the data storage class.
Definition: Dbtag.hpp:53
CFeat_id –.
Definition: Feat_id.hpp:66
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
CFeat_id_Base(void)
Definition: Feat_id_.cpp:194
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Feat_id_.hpp:297
TGeneral & SetGeneral(void)
Select the variant.
Definition: Feat_id_.cpp:162
const TLocal & GetLocal(void) const
Get the variant data.
Definition: Feat_id_.cpp:134
E_Choice m_choice
Definition: Feat_id_.hpp:269
virtual void Reset(void)
Reset the whole object.
Definition: Feat_id_.cpp:53
TLocal & SetLocal(void)
Select the variant.
Definition: Feat_id_.cpp:140
E_Choice
Choice variants.
Definition: Feat_id_.hpp:90
const TGeneral & GetGeneral(void) const
Get the variant data.
Definition: Feat_id_.cpp:156
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Feat_id_.hpp:277
const TGiim & GetGiim(void) const
Get the variant data.
Definition: Feat_id_.cpp:112
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Feat_id_.cpp:102
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Feat_id_.cpp:73
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Feat_id_.cpp:59
static const char *const sm_SelectionNames[]
Definition: Feat_id_.hpp:273
TGiim & SetGiim(void)
Select the variant.
Definition: Feat_id_.cpp:118
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Feat_id_.cpp:107
virtual ~CFeat_id_Base(void)
Definition: Feat_id_.cpp:200
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
@ e_Giim
geninfo import
Definition: Feat_id_.hpp:93
@ e_not_set
No variant selected.
Definition: Feat_id_.hpp:91
@ e_General
for use by various databases
Definition: Feat_id_.hpp:95
@ e_Gibb
geninfo backbone
Definition: Feat_id_.hpp:92
@ e_Local
for local software use
Definition: Feat_id_.hpp:94
@ 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 Sun Jul 21 04:19:05 2024 by modify_doxy.py rev. 669887