NCBI C++ ToolKit
ID2S_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  * 'seqsplit.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_Loc_set:
66  m_Loc_set.Destruct();
67  break;
68  case e_Whole_seq_id:
69  case e_Whole_gi_range:
70  case e_Gi_interval:
71  case e_Seq_id_interval:
72  case e_Gi_ints:
73  case e_Seq_id_ints:
74  m_object->RemoveReference();
75  break;
76  default:
77  break;
78  }
80 }
81 
82 void CID2S_Seq_loc_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
83 {
84  switch ( index ) {
85  case e_Whole_gi:
86  m_Whole_gi = 0;
87  break;
88  case e_Whole_seq_id:
89  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
90  break;
91  case e_Whole_gi_range:
92  (m_object = new(pool) ncbi::objects::CID2S_Gi_Range())->AddReference();
93  break;
94  case e_Gi_interval:
95  (m_object = new(pool) ncbi::objects::CID2S_Gi_Interval())->AddReference();
96  break;
97  case e_Seq_id_interval:
98  (m_object = new(pool) ncbi::objects::CID2S_Seq_id_Interval())->AddReference();
99  break;
100  case e_Gi_ints:
101  (m_object = new(pool) ncbi::objects::CID2S_Gi_Ints())->AddReference();
102  break;
103  case e_Seq_id_ints:
104  (m_object = new(pool) ncbi::objects::CID2S_Seq_id_Ints())->AddReference();
105  break;
106  case e_Loc_set:
107  m_Loc_set.Construct();
108  break;
109  default:
110  break;
111  }
112  m_choice = index;
113 }
114 
115 const char* const CID2S_Seq_loc_Base::sm_SelectionNames[] = {
116  "not set",
117  "whole-gi",
118  "whole-seq-id",
119  "whole-gi-range",
120  "gi-interval",
121  "seq-id-interval",
122  "gi-ints",
123  "seq-id-ints",
124  "loc-set"
125 };
126 
128 {
129  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
130 }
131 
133 {
134  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
135 }
136 
138 {
140  return *static_cast<const TWhole_seq_id*>(m_object);
141 }
142 
144 {
146  return *static_cast<TWhole_seq_id*>(m_object);
147 }
148 
150 {
151  TWhole_seq_id* ptr = &value;
152  if ( m_choice != e_Whole_seq_id || m_object != ptr ) {
153  ResetSelection();
154  (m_object = ptr)->AddReference();
156  }
157 }
158 
160 {
162  return *static_cast<const TWhole_gi_range*>(m_object);
163 }
164 
166 {
168  return *static_cast<TWhole_gi_range*>(m_object);
169 }
170 
172 {
173  TWhole_gi_range* ptr = &value;
174  if ( m_choice != e_Whole_gi_range || m_object != ptr ) {
175  ResetSelection();
176  (m_object = ptr)->AddReference();
178  }
179 }
180 
182 {
184  return *static_cast<const TGi_interval*>(m_object);
185 }
186 
188 {
190  return *static_cast<TGi_interval*>(m_object);
191 }
192 
194 {
195  TGi_interval* ptr = &value;
196  if ( m_choice != e_Gi_interval || m_object != ptr ) {
197  ResetSelection();
198  (m_object = ptr)->AddReference();
200  }
201 }
202 
204 {
206  return *static_cast<const TSeq_id_interval*>(m_object);
207 }
208 
210 {
212  return *static_cast<TSeq_id_interval*>(m_object);
213 }
214 
216 {
217  TSeq_id_interval* ptr = &value;
218  if ( m_choice != e_Seq_id_interval || m_object != ptr ) {
219  ResetSelection();
220  (m_object = ptr)->AddReference();
222  }
223 }
224 
226 {
228  return *static_cast<const TGi_ints*>(m_object);
229 }
230 
232 {
234  return *static_cast<TGi_ints*>(m_object);
235 }
236 
238 {
239  TGi_ints* ptr = &value;
240  if ( m_choice != e_Gi_ints || m_object != ptr ) {
241  ResetSelection();
242  (m_object = ptr)->AddReference();
244  }
245 }
246 
248 {
250  return *static_cast<const TSeq_id_ints*>(m_object);
251 }
252 
254 {
256  return *static_cast<TSeq_id_ints*>(m_object);
257 }
258 
260 {
261  TSeq_id_ints* ptr = &value;
262  if ( m_choice != e_Seq_id_ints || m_object != ptr ) {
263  ResetSelection();
264  (m_object = ptr)->AddReference();
266  }
267 }
268 
269 // helper methods
270 
271 // type info
273 {
274  SET_CHOICE_MODULE("NCBI-Seq-split");
275  ADD_NAMED_STD_CHOICE_VARIANT("whole-gi", m_Whole_gi);
276  ADD_NAMED_REF_CHOICE_VARIANT("whole-seq-id", m_object, CSeq_id);
277  ADD_NAMED_REF_CHOICE_VARIANT("whole-gi-range", m_object, CID2S_Gi_Range);
278  ADD_NAMED_REF_CHOICE_VARIANT("gi-interval", m_object, CID2S_Gi_Interval);
279  ADD_NAMED_REF_CHOICE_VARIANT("seq-id-interval", m_object, CID2S_Seq_id_Interval);
280  ADD_NAMED_REF_CHOICE_VARIANT("gi-ints", m_object, CID2S_Gi_Ints);
281  ADD_NAMED_REF_CHOICE_VARIANT("seq-id-ints", m_object, CID2S_Seq_id_Ints);
282  ADD_NAMED_BUF_CHOICE_VARIANT("loc-set", m_Loc_set, STL_list_set, (STL_CRef, (CLASS, (CID2S_Seq_loc))));
283  info->CodeVersion(22400);
284  info->DataSpec(ncbi::EDataSpec::eASN);
285 }
287 
288 // constructor
290  : m_choice(e_not_set)
291 {
292 }
293 
294 // destructor
296 {
297  Reset();
298 }
299 
300 
301 
302 END_objects_SCOPE // namespace ncbi::objects::
303 
305 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("ID2S-Seq-loc", CID2S_Seq_loc)
CID2S_Gi_Interval –.
CID2S_Gi_Ints –.
CID2S_Gi_Range –.
CID2S_Seq_id_Interval –.
CID2S_Seq_id_Ints –.
CID2S_Seq_loc –.
string
Definition: cgiapp.hpp:690
#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
#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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
const TSeq_id_ints & GetSeq_id_ints(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
const TWhole_gi_range & GetWhole_gi_range(void) const
Get the variant data.
virtual ~CID2S_Seq_loc_Base(void)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
E_Choice
Choice variants.
TGi_ints & SetGi_ints(void)
Select the variant.
TSeq_id_interval & SetSeq_id_interval(void)
Select the variant.
const TGi_interval & GetGi_interval(void) const
Get the variant data.
ncbi::TIntId m_Whole_gi
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TWhole_gi_range & SetWhole_gi_range(void)
Select the variant.
TGi_interval & SetGi_interval(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
static const char *const sm_SelectionNames[]
TSeq_id_ints & SetSeq_id_ints(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< TLoc_set > m_Loc_set
const TSeq_id_interval & GetSeq_id_interval(void) const
Get the variant data.
NCBI_NS_NCBI::CSerialObject * m_object
const TWhole_seq_id & GetWhole_seq_id(void) const
Get the variant data.
TWhole_seq_id & SetWhole_seq_id(void)
Select the variant.
const TGi_ints & GetGi_ints(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
@ e_Whole_gi
whole sequence by gi
@ e_Loc_set
combination of locations
@ e_Seq_id_ints
set of intervals on the same id
@ e_Whole_seq_id
whole sequence by Seq-id
@ e_Seq_id_interval
interval on sequence by Seq-id
@ e_Gi_ints
set of intervals on the same gi
@ e_Whole_gi_range
set of whole sequences by gis
@ e_Gi_interval
interval on sequence by gi
@ e_not_set
No variant selected.
@ 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 Fri Sep 20 14:58:00 2024 by modify_doxy.py rev. 669887