NCBI C++ ToolKit
Delins_.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 CDelins_Base::C_Inserted_seq_info::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("Delins", "inserted-seq-info");
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(22301);
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_Loc ) {
201  m_Loc.Reset(new TLoc());
202  return;
203  }
204  (*m_Loc).Reset();
205 }
206 
208 {
209  m_Loc.Reset(&value);
210 }
211 
213 {
214  m_Deleted_raw_seq.erase();
215  m_set_State[0] &= ~0xc;
216 }
217 
219 {
220  if ( !m_Inserted_seq_info ) {
222  return;
223  }
224  (*m_Inserted_seq_info).Reset();
225 }
226 
228 {
229  m_Inserted_seq_info.Reset(&value);
230 }
231 
233 {
234  ResetLoc();
237 }
238 
240 {
241  SET_CLASS_MODULE("NCBI-VariationIRep");
243  ADD_NAMED_STD_MEMBER("deleted-raw-seq", m_Deleted_raw_seq)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
244  ADD_NAMED_REF_MEMBER("inserted-seq-info", m_Inserted_seq_info, C_Inserted_seq_info);
245  info->RandomOrder();
246  info->CodeVersion(22301);
247  info->DataSpec(ncbi::EDataSpec::eASN);
248 }
250 
251 // constructor
253 {
254  memset(m_set_State,0,sizeof(m_set_State));
255  if ( !IsAllocatedInPool() ) {
256  ResetLoc();
258  }
259 }
260 
261 // destructor
263 {
264 }
265 
266 
267 
268 END_objects_SCOPE // namespace ncbi::objects::
269 
271 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("Delins", CDelins)
Definition: Delins_.cpp:239
BEGIN_NAMED_CHOICE_INFO("", CDelins_Base::C_Inserted_seq_info)
Definition: Delins_.cpp:172
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CCount –.
Definition: Count.hpp:66
C_Inserted_seq_info –.
Definition: Delins_.hpp:96
CDelins –.
Definition: Delins.hpp:66
CSeqLocation –.
Definition: SeqLocation.hpp:66
CSubsequence –.
Definition: Subsequence.hpp:66
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 MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#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 ADD_NAMED_STD_MEMBER(MemberAlias, MemberName)
Definition: serialimpl.hpp:345
#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
TLoc & SetLoc(void)
Assign a value to Loc data member.
Definition: Delins_.hpp:558
TCount & SetCount(void)
Select the variant.
Definition: Delins_.cpp:131
CRef< TLoc > m_Loc
Definition: Delins_.hpp:441
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Delins_.cpp:108
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Delins_.cpp:59
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Delins_.cpp:103
const TCount & GetCount(void) const
Get the variant data.
Definition: Delins_.cpp:125
string m_Deleted_raw_seq
Definition: Delins_.hpp:442
virtual ~CDelins_Base(void)
Definition: Delins_.cpp:262
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Delins_.cpp:76
TSubseq & SetSubseq(void)
Select the variant.
Definition: Delins_.cpp:153
TIdentifier & SetIdentifier(void)
Select the variant.
Definition: Delins_.hpp:498
CRef< TInserted_seq_info > m_Inserted_seq_info
Definition: Delins_.hpp:443
void Reset(void)
Reset the whole object.
Definition: Delins_.cpp:53
void ResetLoc(void)
Reset Loc data member.
Definition: Delins_.cpp:198
C_Inserted_seq_info TInserted_seq_info
Definition: Delins_.hpp:303
TInserted_seq_info & SetInserted_seq_info(void)
Assign a value to Inserted_seq_info data member.
Definition: Delins_.hpp:635
void ResetDeleted_raw_seq(void)
Reset Deleted_raw_seq data member.
Definition: Delins_.cpp:212
virtual void Reset(void)
Reset the whole object.
Definition: Delins_.cpp:232
Uint4 m_set_State[1]
Definition: Delins_.hpp:440
void ResetInserted_seq_info(void)
Reset Inserted_seq_info data member.
Definition: Delins_.cpp:218
CSeqLocation TLoc
Definition: Delins_.hpp:301
TRaw_seq & SetRaw_seq(void)
Select the variant.
Definition: Delins_.hpp:518
static const char *const sm_SelectionNames[]
Definition: Delins_.hpp:293
const TSubseq & GetSubseq(void) const
Get the variant data.
Definition: Delins_.cpp:147
CDelins_Base(void)
Definition: Delins_.cpp:252
@ e_not_set
No variant selected.
Definition: Delins_.hpp:110
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Mon Dec 11 02:40:10 2023 by modify_doxy.py rev. 669887