NCBI C++ ToolKit
Insertion_.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  * 'varrep.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
43 #include <objects/varrep/Count.hpp>
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_Identifier:
63  case e_Raw_seq:
64  m_string.Destruct();
65  break;
66  case e_Count:
67  case e_Subseq:
68  m_object->RemoveReference();
69  break;
70  default:
71  break;
72  }
73  m_choice = e_not_set;
74 }
75 
76 void CInsertion_Base::C_Seqinfo::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
77 {
78  switch ( index ) {
79  case e_Count:
80  (m_object = new(pool) ncbi::objects::CCount())->AddReference();
81  break;
82  case e_Subseq:
83  (m_object = new(pool) ncbi::objects::CSubsequence())->AddReference();
84  break;
85  case e_Identifier:
86  case e_Raw_seq:
87  m_string.Construct();
88  break;
89  default:
90  break;
91  }
92  m_choice = index;
93 }
94 
96  "not set",
97  "identifier",
98  "raw-seq",
99  "count",
100  "subseq"
101 };
102 
104 {
105  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
106 }
107 
109 {
110  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
111 }
112 
114 {
115  Select(e_Identifier, NCBI_NS_NCBI::eDoNotResetVariant);
116  *m_string = value;
117 }
118 
120 {
121  Select(e_Raw_seq, NCBI_NS_NCBI::eDoNotResetVariant);
122  *m_string = value;
123 }
124 
126 {
127  CheckSelected(e_Count);
128  return *static_cast<const TCount*>(m_object);
129 }
130 
132 {
133  Select(e_Count, NCBI_NS_NCBI::eDoNotResetVariant);
134  return *static_cast<TCount*>(m_object);
135 }
136 
138 {
139  TCount* ptr = &value;
140  if ( m_choice != e_Count || m_object != ptr ) {
141  ResetSelection();
142  (m_object = ptr)->AddReference();
143  m_choice = e_Count;
144  }
145 }
146 
148 {
149  CheckSelected(e_Subseq);
150  return *static_cast<const TSubseq*>(m_object);
151 }
152 
154 {
155  Select(e_Subseq, NCBI_NS_NCBI::eDoNotResetVariant);
156  return *static_cast<TSubseq*>(m_object);
157 }
158 
160 {
161  TSubseq* ptr = &value;
162  if ( m_choice != e_Subseq || m_object != ptr ) {
163  ResetSelection();
164  (m_object = ptr)->AddReference();
165  m_choice = e_Subseq;
166  }
167 }
168 
169 // helper methods
170 
171 // type info
173 {
174  SET_INTERNAL_NAME("Insertion", "seqinfo");
175  SET_CHOICE_MODULE("NCBI-VariationIRep");
176  ADD_NAMED_BUF_CHOICE_VARIANT("identifier", m_string, STD, (string));
177  ADD_NAMED_BUF_CHOICE_VARIANT("raw-seq", m_string, STD, (string));
178  ADD_NAMED_REF_CHOICE_VARIANT("count", m_object, CCount);
179  ADD_NAMED_REF_CHOICE_VARIANT("subseq", m_object, CSubsequence);
180  info->CodeVersion(22400);
181  info->DataSpec(ncbi::EDataSpec::eASN);
182 }
184 
185 // constructor
187  : m_choice(e_not_set)
188 {
189 }
190 
191 // destructor
193 {
194  Reset();
195 }
196 
197 
199 {
200  if ( !m_Int ) {
201  m_Int.Reset(new TInt());
202  return;
203  }
204  (*m_Int).Reset();
205 }
206 
208 {
209  m_Int.Reset(&value);
210 }
211 
213 {
214  if ( !m_Seqinfo ) {
215  m_Seqinfo.Reset(new TSeqinfo());
216  return;
217  }
218  (*m_Seqinfo).Reset();
219 }
220 
222 {
223  m_Seqinfo.Reset(&value);
224 }
225 
227 {
228  ResetInt();
229  ResetSeqinfo();
230 }
231 
233 {
234  SET_CLASS_MODULE("NCBI-VariationIRep");
236  ADD_NAMED_REF_MEMBER("seqinfo", m_Seqinfo, C_Seqinfo);
237  info->RandomOrder();
238  info->CodeVersion(22400);
239  info->DataSpec(ncbi::EDataSpec::eASN);
240 }
242 
243 // constructor
245 {
246  memset(m_set_State,0,sizeof(m_set_State));
247  if ( !IsAllocatedInPool() ) {
248  ResetInt();
249  ResetSeqinfo();
250  }
251 }
252 
253 // destructor
255 {
256 }
257 
258 
259 
260 END_objects_SCOPE // namespace ncbi::objects::
261 
263 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("Insertion", CInsertion)
Definition: Insertion_.cpp:232
BEGIN_NAMED_CHOICE_INFO("", CInsertion_Base::C_Seqinfo)
Definition: Insertion_.cpp:172
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CCount –.
Definition: Count.hpp:66
CInsertion –.
Definition: Insertion.hpp:66
CSeqInterval –.
Definition: SeqInterval.hpp:66
CSubsequence –.
Definition: Subsequence.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_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#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
Uint8 TCount
Alias for value type of counter.
Definition: ncbiobj.hpp:310
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
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
C_Seqinfo TSeqinfo
Definition: Insertion_.hpp:302
Uint4 m_set_State[1]
Definition: Insertion_.hpp:399
CRef< TSeqinfo > m_Seqinfo
Definition: Insertion_.hpp:401
TSeqinfo & SetSeqinfo(void)
Assign a value to Seqinfo data member.
Definition: Insertion_.hpp:546
void ResetSeqinfo(void)
Reset Seqinfo data member.
Definition: Insertion_.cpp:212
TRaw_seq & SetRaw_seq(void)
Select the variant.
Definition: Insertion_.hpp:476
TIdentifier & SetIdentifier(void)
Select the variant.
Definition: Insertion_.hpp:456
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Insertion_.cpp:103
virtual void Reset(void)
Reset the whole object.
Definition: Insertion_.cpp:226
const TCount & GetCount(void) const
Get the variant data.
Definition: Insertion_.cpp:125
CRef< TInt > m_Int
Definition: Insertion_.hpp:400
TCount & SetCount(void)
Select the variant.
Definition: Insertion_.cpp:131
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Insertion_.cpp:76
void ResetInt(void)
Reset Int data member.
Definition: Insertion_.cpp:198
void Reset(void)
Reset the whole object.
Definition: Insertion_.cpp:53
const TSubseq & GetSubseq(void) const
Get the variant data.
Definition: Insertion_.cpp:147
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Insertion_.cpp:108
static const char *const sm_SelectionNames[]
Definition: Insertion_.hpp:293
TInt & SetInt(void)
Assign a value to Int data member.
Definition: Insertion_.hpp:516
E_Choice
Choice variants.
Definition: Insertion_.hpp:109
TSubseq & SetSubseq(void)
Select the variant.
Definition: Insertion_.cpp:153
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Insertion_.cpp:59
CSeqInterval TInt
Definition: Insertion_.hpp:301
virtual ~CInsertion_Base(void)
Definition: Insertion_.cpp:254
@ e_not_set
No variant selected.
Definition: Insertion_.hpp:110
@ 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 Thu May 02 14:35:54 2024 by modify_doxy.py rev. 669887