NCBI C++ ToolKit
SeqTable_multi_data_.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  * 'seqtable.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
52 
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54 
55 
56 // generated classes
57 
59 {
60  if ( m_choice != e_not_set )
62 }
63 
65 {
66  switch ( m_choice ) {
67  case e_Int:
68  m_Int.Destruct();
69  break;
70  case e_Real:
71  m_Real.Destruct();
72  break;
73  case e_String:
74  m_String.Destruct();
75  break;
76  case e_Bytes:
77  {
78  for ( std::vector< std::vector< char >* >::iterator listIter1 = (*m_Bytes).begin(); listIter1 != (*m_Bytes).end(); ++listIter1 ) {
79  delete (*listIter1);
80  }
81  }
82  m_Bytes.Destruct();
83  break;
84  case e_Bit:
85  m_Bit.Destruct();
86  break;
87  case e_Loc:
88  m_Loc.Destruct();
89  break;
90  case e_Id:
91  m_Id.Destruct();
92  break;
93  case e_Interval:
94  m_Interval.Destruct();
95  break;
96  case e_Int1:
97  m_Int1.Destruct();
98  break;
99  case e_Int2:
100  m_Int2.Destruct();
101  break;
102  case e_Int8:
103  m_Int8.Destruct();
104  break;
105  case e_Common_string:
106  case e_Common_bytes:
107  case e_Int_delta:
108  case e_Int_scaled:
109  case e_Real_scaled:
110  case e_Bit_bvector:
111  m_object->RemoveReference();
112  break;
113  default:
114  break;
115  }
117 }
118 
119 void CSeqTable_multi_data_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
120 {
121  switch ( index ) {
122  case e_Int:
123  m_Int.Construct();
124  break;
125  case e_Real:
126  m_Real.Construct();
127  break;
128  case e_String:
129  m_String.Construct();
130  break;
131  case e_Bytes:
132  m_Bytes.Construct();
133  break;
134  case e_Common_string:
135  (m_object = new(pool) ncbi::objects::CCommonString_table())->AddReference();
136  break;
137  case e_Common_bytes:
138  (m_object = new(pool) ncbi::objects::CCommonBytes_table())->AddReference();
139  break;
140  case e_Bit:
141  m_Bit.Construct();
142  break;
143  case e_Loc:
144  m_Loc.Construct();
145  break;
146  case e_Id:
147  m_Id.Construct();
148  break;
149  case e_Interval:
150  m_Interval.Construct();
151  break;
152  case e_Int_delta:
153  (m_object = new(pool) ncbi::objects::CSeqTable_multi_data())->AddReference();
154  break;
155  case e_Int_scaled:
156  (m_object = new(pool) ncbi::objects::CScaled_int_multi_data())->AddReference();
157  break;
158  case e_Real_scaled:
159  (m_object = new(pool) ncbi::objects::CScaled_real_multi_data())->AddReference();
160  break;
161  case e_Bit_bvector:
162  (m_object = new(pool) ncbi::objects::CBVector_data())->AddReference();
163  break;
164  case e_Int1:
165  m_Int1.Construct();
166  break;
167  case e_Int2:
168  m_Int2.Construct();
169  break;
170  case e_Int8:
171  m_Int8.Construct();
172  break;
173  default:
174  break;
175  }
176  m_choice = index;
177 }
178 
179 const char* const CSeqTable_multi_data_Base::sm_SelectionNames[] = {
180  "not set",
181  "int",
182  "real",
183  "string",
184  "bytes",
185  "common-string",
186  "common-bytes",
187  "bit",
188  "loc",
189  "id",
190  "interval",
191  "int-delta",
192  "int-scaled",
193  "real-scaled",
194  "bit-bvector",
195  "int1",
196  "int2",
197  "int8"
198 };
199 
201 {
202  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
203 }
204 
206 {
207  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
208 }
209 
211 {
213  return *static_cast<const TCommon_string*>(m_object);
214 }
215 
217 {
219  return *static_cast<TCommon_string*>(m_object);
220 }
221 
223 {
224  TCommon_string* ptr = &value;
225  if ( m_choice != e_Common_string || m_object != ptr ) {
226  ResetSelection();
227  (m_object = ptr)->AddReference();
229  }
230 }
231 
233 {
235  return *static_cast<const TCommon_bytes*>(m_object);
236 }
237 
239 {
241  return *static_cast<TCommon_bytes*>(m_object);
242 }
243 
245 {
246  TCommon_bytes* ptr = &value;
247  if ( m_choice != e_Common_bytes || m_object != ptr ) {
248  ResetSelection();
249  (m_object = ptr)->AddReference();
251  }
252 }
253 
255 {
257  return *static_cast<const TInt_delta*>(m_object);
258 }
259 
261 {
263  return *static_cast<TInt_delta*>(m_object);
264 }
265 
267 {
268  TInt_delta* ptr = &value;
269  if ( m_choice != e_Int_delta || m_object != ptr ) {
270  ResetSelection();
271  (m_object = ptr)->AddReference();
273  }
274 }
275 
277 {
279  return *static_cast<const TInt_scaled*>(m_object);
280 }
281 
283 {
285  return *static_cast<TInt_scaled*>(m_object);
286 }
287 
289 {
290  TInt_scaled* ptr = &value;
291  if ( m_choice != e_Int_scaled || m_object != ptr ) {
292  ResetSelection();
293  (m_object = ptr)->AddReference();
295  }
296 }
297 
299 {
301  return *static_cast<const TReal_scaled*>(m_object);
302 }
303 
305 {
307  return *static_cast<TReal_scaled*>(m_object);
308 }
309 
311 {
312  TReal_scaled* ptr = &value;
313  if ( m_choice != e_Real_scaled || m_object != ptr ) {
314  ResetSelection();
315  (m_object = ptr)->AddReference();
317  }
318 }
319 
321 {
323  return *static_cast<const TBit_bvector*>(m_object);
324 }
325 
327 {
329  return *static_cast<TBit_bvector*>(m_object);
330 }
331 
333 {
334  TBit_bvector* ptr = &value;
335  if ( m_choice != e_Bit_bvector || m_object != ptr ) {
336  ResetSelection();
337  (m_object = ptr)->AddReference();
339  }
340 }
341 
342 // helper methods
343 
344 // type info
346 {
347  SET_CHOICE_MODULE("NCBI-SeqTable");
348  ADD_NAMED_BUF_CHOICE_VARIANT("int", m_Int, STL_vector, (STD, (int)));
349  ADD_NAMED_BUF_CHOICE_VARIANT("real", m_Real, STL_vector, (STD, (double)));
350  ADD_NAMED_BUF_CHOICE_VARIANT("string", m_String, STL_vector, (CStringUTF8, ()));
351  ADD_NAMED_BUF_CHOICE_VARIANT("bytes", m_Bytes, STL_vector, (POINTER, (STL_CHAR_vector, (char))));
352  ADD_NAMED_REF_CHOICE_VARIANT("common-string", m_object, CCommonString_table);
353  ADD_NAMED_REF_CHOICE_VARIANT("common-bytes", m_object, CCommonBytes_table);
354  ADD_NAMED_BUF_CHOICE_VARIANT("bit", m_Bit, STL_CHAR_vector, (char));
355  ADD_NAMED_BUF_CHOICE_VARIANT("loc", m_Loc, STL_vector, (STL_CRef, (CLASS, (CSeq_loc))));
356  ADD_NAMED_BUF_CHOICE_VARIANT("id", m_Id, STL_vector, (STL_CRef, (CLASS, (CSeq_id))));
357  ADD_NAMED_BUF_CHOICE_VARIANT("interval", m_Interval, STL_vector, (STL_CRef, (CLASS, (CSeq_interval))));
358  ADD_NAMED_REF_CHOICE_VARIANT("int-delta", m_object, CSeqTable_multi_data);
359  ADD_NAMED_REF_CHOICE_VARIANT("int-scaled", m_object, CScaled_int_multi_data);
360  ADD_NAMED_REF_CHOICE_VARIANT("real-scaled", m_object, CScaled_real_multi_data);
361  ADD_NAMED_REF_CHOICE_VARIANT("bit-bvector", m_object, CBVector_data);
362  ADD_NAMED_BUF_CHOICE_VARIANT("int1", m_Int1, STL_CHAR_vector, (char));
363  ADD_NAMED_BUF_CHOICE_VARIANT("int2", m_Int2, STL_vector, (STD, (Int2)));
364  ADD_NAMED_BUF_CHOICE_VARIANT("int8", m_Int8, STL_vector, (STD, (Int8)));
365  info->CodeVersion(22301);
366  info->DataSpec(ncbi::EDataSpec::eASN);
367 }
369 
370 // constructor
372  : m_choice(e_not_set)
373 {
374 }
375 
376 // destructor
378 {
379  Reset();
380 }
381 
382 
383 
384 END_objects_SCOPE // namespace ncbi::objects::
385 
387 
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("SeqTable-multi-data", CSeqTable_multi_data)
CCommonBytes_table –.
CCommonString_table –.
char value[7]
Definition: config.c:431
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_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
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
std::string CStringUTF8
Definition: ncbistl.hpp:254
NCBI_NS_NCBI::CUnionBuffer< TInt > m_Int
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
NCBI_NS_NCBI::CUnionBuffer< TReal > m_Real
NCBI_NS_NCBI::CUnionBuffer< TInt8 > m_Int8
const TReal_scaled & GetReal_scaled(void) const
Get the variant data.
static const char *const sm_SelectionNames[]
NCBI_NS_NCBI::CSerialObject * m_object
NCBI_NS_NCBI::CUnionBuffer< TInt2 > m_Int2
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
NCBI_NS_NCBI::CUnionBuffer< TInt1 > m_Int1
const TInt_delta & GetInt_delta(void) const
Get the variant data.
TBit_bvector & SetBit_bvector(void)
Select the variant.
const TCommon_string & GetCommon_string(void) const
Get the variant data.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
const TBit_bvector & GetBit_bvector(void) const
Get the variant data.
const TInt_scaled & GetInt_scaled(void) const
Get the variant data.
NCBI_NS_NCBI::CUnionBuffer< TBytes > m_Bytes
NCBI_NS_NCBI::CUnionBuffer< TLoc > m_Loc
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
NCBI_NS_NCBI::CUnionBuffer< TBit > m_Bit
TReal_scaled & SetReal_scaled(void)
Select the variant.
TInt_delta & SetInt_delta(void)
Select the variant.
virtual void Reset(void)
Reset the whole object.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TInt_scaled & SetInt_scaled(void)
Select the variant.
const TCommon_bytes & GetCommon_bytes(void) const
Get the variant data.
TCommon_string & SetCommon_string(void)
Select the variant.
TCommon_bytes & SetCommon_bytes(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< TInterval > m_Interval
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
NCBI_NS_NCBI::CUnionBuffer< TString > m_String
NCBI_NS_NCBI::CUnionBuffer< TId > m_Id
@ e_Int8
a set of signed 8-byte integers
@ e_Int_scaled
scaled data (int/bit -> int)
@ e_Real
a set of reals, one per row
@ e_Int1
a set of signed 1-byte integers encoded as sequential octets
@ e_Loc
a set of locations, one per row
@ e_not_set
No variant selected.
@ e_Common_bytes
a set of byte arrays with small set of possible values
@ e_Int_delta
delta-encoded data (int/bit -> int)
@ e_Bytes
a set of byte arrays, one per row
@ e_String
a set of strings, one per row
@ e_Bit
a set of bits, one per row Most-significant bit in each octet comes first.
@ e_Int2
a set of signed 2-byte integers
@ e_Int
a set of 4-byte integers, one per row
@ e_Common_string
a set of string with small set of possible values
@ e_Real_scaled
scaled data (int/bit -> real)
@ e_Bit_bvector
a set of bit, represented as serialized bvector, see include/util/bitset/bm.h
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Thu Mar 28 17:05:04 2024 by modify_doxy.py rev. 669887