NCBI C++ ToolKit
Seq_loc_.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
53 
54 BEGIN_objects_SCOPE // namespace ncbi::objects::
55 
56 
57 // generated classes
58 
60 {
61  if ( m_choice != e_not_set )
63 }
64 
66 {
67  switch ( m_choice ) {
68  case e_Empty:
69  case e_Whole:
70  case e_Int:
71  case e_Packed_int:
72  case e_Pnt:
73  case e_Packed_pnt:
74  case e_Mix:
75  case e_Equiv:
76  case e_Bond:
77  case e_Feat:
78  m_object->RemoveReference();
79  break;
80  default:
81  break;
82  }
84 }
85 
86 void CSeq_loc_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
87 {
88  switch ( index ) {
89  case e_Empty:
90  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
91  break;
92  case e_Whole:
93  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
94  break;
95  case e_Int:
96  (m_object = new(pool) ncbi::objects::CSeq_interval())->AddReference();
97  break;
98  case e_Packed_int:
99  (m_object = new(pool) ncbi::objects::CPacked_seqint())->AddReference();
100  break;
101  case e_Pnt:
102  (m_object = new(pool) ncbi::objects::CSeq_point())->AddReference();
103  break;
104  case e_Packed_pnt:
105  (m_object = new(pool) ncbi::objects::CPacked_seqpnt())->AddReference();
106  break;
107  case e_Mix:
108  (m_object = new(pool) ncbi::objects::CSeq_loc_mix())->AddReference();
109  break;
110  case e_Equiv:
111  (m_object = new(pool) ncbi::objects::CSeq_loc_equiv())->AddReference();
112  break;
113  case e_Bond:
114  (m_object = new(pool) ncbi::objects::CSeq_bond())->AddReference();
115  break;
116  case e_Feat:
117  (m_object = new(pool) ncbi::objects::CFeat_id())->AddReference();
118  break;
119  default:
120  break;
121  }
122  m_choice = index;
123 }
124 
125 const char* const CSeq_loc_Base::sm_SelectionNames[] = {
126  "not set",
127  "null",
128  "empty",
129  "whole",
130  "int",
131  "packed-int",
132  "pnt",
133  "packed-pnt",
134  "mix",
135  "equiv",
136  "bond",
137  "feat"
138 };
139 
141 {
142  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
143 }
144 
146 {
147  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
148 }
149 
151 {
153  return *static_cast<const TEmpty*>(m_object);
154 }
155 
157 {
159  return *static_cast<TEmpty*>(m_object);
160 }
161 
163 {
164  TEmpty* ptr = &value;
165  if ( m_choice != e_Empty || m_object != ptr ) {
166  ResetSelection();
167  (m_object = ptr)->AddReference();
168  m_choice = e_Empty;
169  }
170 }
171 
173 {
175  return *static_cast<const TWhole*>(m_object);
176 }
177 
179 {
181  return *static_cast<TWhole*>(m_object);
182 }
183 
185 {
186  TWhole* ptr = &value;
187  if ( m_choice != e_Whole || m_object != ptr ) {
188  ResetSelection();
189  (m_object = ptr)->AddReference();
190  m_choice = e_Whole;
191  }
192 }
193 
195 {
197  return *static_cast<const TInt*>(m_object);
198 }
199 
201 {
203  return *static_cast<TInt*>(m_object);
204 }
205 
207 {
208  TInt* ptr = &value;
209  if ( m_choice != e_Int || m_object != ptr ) {
210  ResetSelection();
211  (m_object = ptr)->AddReference();
212  m_choice = e_Int;
213  }
214 }
215 
217 {
219  return *static_cast<const TPacked_int*>(m_object);
220 }
221 
223 {
225  return *static_cast<TPacked_int*>(m_object);
226 }
227 
229 {
230  TPacked_int* ptr = &value;
231  if ( m_choice != e_Packed_int || m_object != ptr ) {
232  ResetSelection();
233  (m_object = ptr)->AddReference();
235  }
236 }
237 
239 {
241  return *static_cast<const TPnt*>(m_object);
242 }
243 
245 {
247  return *static_cast<TPnt*>(m_object);
248 }
249 
251 {
252  TPnt* ptr = &value;
253  if ( m_choice != e_Pnt || m_object != ptr ) {
254  ResetSelection();
255  (m_object = ptr)->AddReference();
256  m_choice = e_Pnt;
257  }
258 }
259 
261 {
263  return *static_cast<const TPacked_pnt*>(m_object);
264 }
265 
267 {
269  return *static_cast<TPacked_pnt*>(m_object);
270 }
271 
273 {
274  TPacked_pnt* ptr = &value;
275  if ( m_choice != e_Packed_pnt || m_object != ptr ) {
276  ResetSelection();
277  (m_object = ptr)->AddReference();
279  }
280 }
281 
283 {
285  return *static_cast<const TMix*>(m_object);
286 }
287 
289 {
291  return *static_cast<TMix*>(m_object);
292 }
293 
295 {
296  TMix* ptr = &value;
297  if ( m_choice != e_Mix || m_object != ptr ) {
298  ResetSelection();
299  (m_object = ptr)->AddReference();
300  m_choice = e_Mix;
301  }
302 }
303 
305 {
307  return *static_cast<const TEquiv*>(m_object);
308 }
309 
311 {
313  return *static_cast<TEquiv*>(m_object);
314 }
315 
317 {
318  TEquiv* ptr = &value;
319  if ( m_choice != e_Equiv || m_object != ptr ) {
320  ResetSelection();
321  (m_object = ptr)->AddReference();
322  m_choice = e_Equiv;
323  }
324 }
325 
327 {
329  return *static_cast<const TBond*>(m_object);
330 }
331 
333 {
335  return *static_cast<TBond*>(m_object);
336 }
337 
339 {
340  TBond* ptr = &value;
341  if ( m_choice != e_Bond || m_object != ptr ) {
342  ResetSelection();
343  (m_object = ptr)->AddReference();
344  m_choice = e_Bond;
345  }
346 }
347 
349 {
351  return *static_cast<const TFeat*>(m_object);
352 }
353 
355 {
357  return *static_cast<TFeat*>(m_object);
358 }
359 
361 {
362  TFeat* ptr = &value;
363  if ( m_choice != e_Feat || m_object != ptr ) {
364  ResetSelection();
365  (m_object = ptr)->AddReference();
366  m_choice = e_Feat;
367  }
368 }
369 
370 // helper methods
371 
372 // type info
374 {
375  SET_CHOICE_MODULE("NCBI-Seqloc");
376  ADD_NAMED_NULL_CHOICE_VARIANT("null", null, ());
377  ADD_NAMED_REF_CHOICE_VARIANT("empty", m_object, CSeq_id);
378  ADD_NAMED_REF_CHOICE_VARIANT("whole", m_object, CSeq_id);
380  ADD_NAMED_REF_CHOICE_VARIANT("packed-int", m_object, CPacked_seqint);
381  ADD_NAMED_REF_CHOICE_VARIANT("pnt", m_object, CSeq_point);
382  ADD_NAMED_REF_CHOICE_VARIANT("packed-pnt", m_object, CPacked_seqpnt);
383  ADD_NAMED_REF_CHOICE_VARIANT("mix", m_object, CSeq_loc_mix);
384  ADD_NAMED_REF_CHOICE_VARIANT("equiv", m_object, CSeq_loc_equiv);
385  ADD_NAMED_REF_CHOICE_VARIANT("bond", m_object, CSeq_bond);
386  ADD_NAMED_REF_CHOICE_VARIANT("feat", m_object, CFeat_id);
387  info->CodeVersion(22400);
388  info->DataSpec(ncbi::EDataSpec::eASN);
389 }
391 
392 // constructor
394  : m_choice(e_not_set)
395 {
396 }
397 
398 // destructor
400 {
401  Reset();
402 }
403 
404 
405 
406 END_objects_SCOPE // namespace ncbi::objects::
407 
409 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Seq-loc", CSeq_loc)
Definition: Seq_loc_.cpp:373
CFeat_id –.
Definition: Feat_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 END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:379
@ 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
TWhole & SetWhole(void)
Select the variant.
Definition: Seq_loc_.cpp:178
static const char *const sm_SelectionNames[]
Definition: Seq_loc_.hpp:458
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TEquiv & SetEquiv(void)
Select the variant.
Definition: Seq_loc_.cpp:310
const TFeat & GetFeat(void) const
Get the variant data.
Definition: Seq_loc_.cpp:348
TFeat & SetFeat(void)
Select the variant.
Definition: Seq_loc_.cpp:354
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_loc_.cpp:65
TPacked_pnt & SetPacked_pnt(void)
Select the variant.
Definition: Seq_loc_.cpp:266
const TPnt & GetPnt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:238
const TWhole & GetWhole(void) const
Get the variant data.
Definition: Seq_loc_.cpp:172
TMix & SetMix(void)
Select the variant.
Definition: Seq_loc_.cpp:288
TBond & SetBond(void)
Select the variant.
Definition: Seq_loc_.cpp:332
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:260
TPnt & SetPnt(void)
Select the variant.
Definition: Seq_loc_.cpp:244
TEmpty & SetEmpty(void)
Select the variant.
Definition: Seq_loc_.cpp:156
const TEquiv & GetEquiv(void) const
Get the variant data.
Definition: Seq_loc_.cpp:304
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_loc_.cpp:86
virtual void Reset(void)
Reset the whole object.
Definition: Seq_loc_.cpp:59
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_loc_.cpp:140
TInt & SetInt(void)
Select the variant.
Definition: Seq_loc_.cpp:200
const TEmpty & GetEmpty(void) const
Get the variant data.
Definition: Seq_loc_.cpp:150
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Seq_loc_.hpp:461
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:194
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_loc_.cpp:145
E_Choice
Choice variants.
Definition: Seq_loc_.hpp:96
const TMix & GetMix(void) const
Get the variant data.
Definition: Seq_loc_.cpp:282
virtual ~CSeq_loc_Base(void)
Definition: Seq_loc_.cpp:399
CSeq_loc_Base(void)
Definition: Seq_loc_.cpp:393
const TPacked_int & GetPacked_int(void) const
Get the variant data.
Definition: Seq_loc_.cpp:216
TPacked_int & SetPacked_int(void)
Select the variant.
Definition: Seq_loc_.cpp:222
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Seq_loc_.hpp:481
E_Choice m_choice
Definition: Seq_loc_.hpp:454
const TBond & GetBond(void) const
Get the variant data.
Definition: Seq_loc_.cpp:326
@ e_not_set
No variant selected.
Definition: Seq_loc_.hpp:97
@ e_Equiv
equivalent sets of locations
Definition: Seq_loc_.hpp:106
@ e_Empty
to NULL one Seq-id in a collection
Definition: Seq_loc_.hpp:99
@ e_Feat
indirect, through a Seq-feat
Definition: Seq_loc_.hpp:108
@ e_Int
from to
Definition: Seq_loc_.hpp:101
@ e_Whole
whole sequence
Definition: Seq_loc_.hpp:100
@ 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 Sat Apr 20 12:20:48 2024 by modify_doxy.py rev. 669887