NCBI C++ ToolKit
Seq_annot_.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  * 'seq.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
44 #include <objects/seq/Annot_id.hpp>
52 
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54 
55 
56 // generated classes
57 
59 {
60  SET_ENUM_INTERNAL_NAME("Seq-annot", "db");
61  SET_ENUM_MODULE("NCBI-Sequence");
62  ADD_ENUM_VALUE("genbank", eDb_genbank);
63  ADD_ENUM_VALUE("embl", eDb_embl);
64  ADD_ENUM_VALUE("ddbj", eDb_ddbj);
65  ADD_ENUM_VALUE("pir", eDb_pir);
66  ADD_ENUM_VALUE("sp", eDb_sp);
67  ADD_ENUM_VALUE("bbone", eDb_bbone);
68  ADD_ENUM_VALUE("pdb", eDb_pdb);
69  ADD_ENUM_VALUE("other", eDb_other);
70 }
72 
74 {
75  if ( m_choice != e_not_set )
77 }
78 
80 {
81  switch ( m_choice ) {
82  case e_Ftable:
83  m_Ftable.Destruct();
84  break;
85  case e_Align:
86  m_Align.Destruct();
87  break;
88  case e_Graph:
89  m_Graph.Destruct();
90  break;
91  case e_Ids:
92  m_Ids.Destruct();
93  break;
94  case e_Locs:
95  m_Locs.Destruct();
96  break;
97  case e_Seq_table:
98  m_object->RemoveReference();
99  break;
100  default:
101  break;
102  }
103  m_choice = e_not_set;
104 }
105 
106 void CSeq_annot_Base::C_Data::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
107 {
108  switch ( index ) {
109  case e_Ftable:
110  m_Ftable.Construct();
111  break;
112  case e_Align:
113  m_Align.Construct();
114  break;
115  case e_Graph:
116  m_Graph.Construct();
117  break;
118  case e_Ids:
119  m_Ids.Construct();
120  break;
121  case e_Locs:
122  m_Locs.Construct();
123  break;
124  case e_Seq_table:
125  (m_object = new(pool) ncbi::objects::CSeq_table())->AddReference();
126  break;
127  default:
128  break;
129  }
130  m_choice = index;
131 }
132 
133 const char* const CSeq_annot_Base::C_Data::sm_SelectionNames[] = {
134  "not set",
135  "ftable",
136  "align",
137  "graph",
138  "ids",
139  "locs",
140  "seq-table"
141 };
142 
144 {
145  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
146 }
147 
149 {
150  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
151 }
152 
154 {
155  CheckSelected(e_Seq_table);
156  return *static_cast<const TSeq_table*>(m_object);
157 }
158 
160 {
161  Select(e_Seq_table, NCBI_NS_NCBI::eDoNotResetVariant);
162  return *static_cast<TSeq_table*>(m_object);
163 }
164 
166 {
167  TSeq_table* ptr = &value;
168  if ( m_choice != e_Seq_table || m_object != ptr ) {
169  ResetSelection();
170  (m_object = ptr)->AddReference();
171  m_choice = e_Seq_table;
172  }
173 }
174 
175 // helper methods
176 
177 // type info
179 {
180  SET_INTERNAL_NAME("Seq-annot", "data");
181  SET_CHOICE_MODULE("NCBI-Sequence");
182  ADD_NAMED_BUF_CHOICE_VARIANT("ftable", m_Ftable, STL_list_set, (STL_CRef, (CLASS, (CSeq_feat))));
183  ADD_NAMED_BUF_CHOICE_VARIANT("align", m_Align, STL_list_set, (STL_CRef, (CLASS, (CSeq_align))));
184  ADD_NAMED_BUF_CHOICE_VARIANT("graph", m_Graph, STL_list_set, (STL_CRef, (CLASS, (CSeq_graph))));
185  ADD_NAMED_BUF_CHOICE_VARIANT("ids", m_Ids, STL_list_set, (STL_CRef, (CLASS, (CSeq_id))));
186  ADD_NAMED_BUF_CHOICE_VARIANT("locs", m_Locs, STL_list_set, (STL_CRef, (CLASS, (CSeq_loc))));
187  ADD_NAMED_REF_CHOICE_VARIANT("seq-table", m_object, CSeq_table);
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 
207 {
208  m_Id.clear();
209  m_set_State[0] &= ~0x3;
210 }
211 
213 {
214  m_Name.erase();
215  m_set_State[0] &= ~0x30;
216 }
217 
219 {
220  m_Desc.Reset();
221 }
222 
224 {
225  m_Desc.Reset(&value);
226 }
227 
229 {
230  if ( !m_Desc )
231  m_Desc.Reset(new TDesc());
232  return (*m_Desc);
233 }
234 
236 {
237  if ( !m_Data ) {
238  m_Data.Reset(new TData());
239  return;
240  }
241  (*m_Data).Reset();
242 }
243 
245 {
246  m_Data.Reset(&value);
247 }
248 
250 {
251  ResetId();
252  ResetDb();
253  ResetName();
254  ResetDesc();
255  ResetData();
256 }
257 
259 {
260  SET_CLASS_MODULE("NCBI-Sequence");
261  ADD_NAMED_MEMBER("id", m_Id, STL_list_set, (STL_CRef, (CLASS, (CAnnot_id))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
262  ADD_NAMED_ENUM_MEMBER("db", m_Db, EDb)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
263  ADD_NAMED_STD_MEMBER("name", m_Name)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
264  ADD_NAMED_REF_MEMBER("desc", m_Desc, CAnnot_descr)->SetOptional();
265  ADD_NAMED_REF_MEMBER("data", m_Data, C_Data);
266  info->RandomOrder();
267  info->CodeVersion(22400);
268  info->DataSpec(ncbi::EDataSpec::eASN);
269 }
271 
272 // constructor
274  : m_Db((EDb)(0))
275 {
276  memset(m_set_State,0,sizeof(m_set_State));
277  if ( !IsAllocatedInPool() ) {
278  ResetData();
279  }
280 }
281 
282 // destructor
284 {
285 }
286 
287 
288 
289 END_objects_SCOPE // namespace ncbi::objects::
290 
292 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_ENUM_IN_INFO("", CSeq_annot_Base::, EDb, true)
Definition: Seq_annot_.cpp:58
BEGIN_NAMED_CHOICE_INFO("", CSeq_annot_Base::C_Data)
Definition: Seq_annot_.cpp:178
BEGIN_NAMED_BASE_CLASS_INFO("Seq-annot", CSeq_annot)
Definition: Seq_annot_.cpp:258
User-defined methods of the data storage class.
User-defined methods of the data storage class.
END_ENUM_INFO
Definition: aln_errors.cpp:58
CAnnot_descr –.
Definition: Annot_descr.hpp:66
CAnnot_id –.
Definition: Annot_id.hpp:66
features in table form
Definition: Seq_annot_.hpp:86
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
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 SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#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 SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#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 ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#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
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
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
TSeq_table & SetSeq_table(void)
Select the variant.
Definition: Seq_annot_.cpp:159
list< CRef< CAnnot_id > > m_Id
Definition: Seq_annot_.hpp:569
static const char *const sm_SelectionNames[]
Definition: Seq_annot_.hpp:344
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_annot_.cpp:79
EDb
source of annotation
Definition: Seq_annot_.hpp:98
void ResetDb(void)
Reset Db data member.
Definition: Seq_annot_.hpp:758
void Reset(void)
Reset the whole object.
Definition: Seq_annot_.cpp:73
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_annot_.cpp:148
void ResetData(void)
Reset Data data member.
Definition: Seq_annot_.cpp:235
CRef< TDesc > m_Desc
Definition: Seq_annot_.hpp:572
E_Choice
Choice variants.
Definition: Seq_annot_.hpp:131
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_annot_.cpp:106
void ResetName(void)
Reset Name data member.
Definition: Seq_annot_.cpp:212
Uint4 m_set_State[1]
Definition: Seq_annot_.hpp:568
CAnnot_descr TDesc
Definition: Seq_annot_.hpp:359
void ResetId(void)
Reset Id data member.
Definition: Seq_annot_.cpp:206
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_annot_.cpp:143
const TSeq_table & GetSeq_table(void) const
Get the variant data.
Definition: Seq_annot_.cpp:153
virtual void Reset(void)
Reset the whole object.
Definition: Seq_annot_.cpp:249
void ResetDesc(void)
Reset Desc data member.
Definition: Seq_annot_.cpp:218
TData & SetData(void)
Assign a value to Data data member.
Definition: Seq_annot_.hpp:882
CRef< TData > m_Data
Definition: Seq_annot_.hpp:573
TDesc & SetDesc(void)
Assign a value to Desc data member.
Definition: Seq_annot_.cpp:228
virtual ~CSeq_annot_Base(void)
Definition: Seq_annot_.cpp:283
@ e_not_set
No variant selected.
Definition: Seq_annot_.hpp:132
@ 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 May 12 05:01:33 2024 by modify_doxy.py rev. 669887