NCBI C++ ToolKit
ID2S_Chunk_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  * '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
43 #include <objects/seq/Bioseq.hpp>
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_Seq_id:
66  m_object->RemoveReference();
67  break;
68  default:
69  break;
70  }
71  m_choice = e_not_set;
72 }
73 
74 void CID2S_Chunk_Data_Base::C_Id::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
75 {
76  switch ( index ) {
77  case e_Bioseq_set:
78  m_Bioseq_set = 0;
79  break;
80  case e_Gi:
81  m_Gi = 0;
82  break;
83  case e_Seq_id:
84  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
85  break;
86  default:
87  break;
88  }
89  m_choice = index;
90 }
91 
93  "not set",
94  "bioseq-set",
95  "gi",
96  "seq-id"
97 };
98 
100 {
101  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
102 }
103 
105 {
106  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
107 }
108 
110 {
111  CheckSelected(e_Seq_id);
112  return *static_cast<const TSeq_id*>(m_object);
113 }
114 
116 {
117  Select(e_Seq_id, NCBI_NS_NCBI::eDoNotResetVariant);
118  return *static_cast<TSeq_id*>(m_object);
119 }
120 
122 {
123  TSeq_id* ptr = &value;
124  if ( m_choice != e_Seq_id || m_object != ptr ) {
125  ResetSelection();
126  (m_object = ptr)->AddReference();
127  m_choice = e_Seq_id;
128  }
129 }
130 
131 // helper methods
132 
133 // type info
135 {
136  SET_INTERNAL_NAME("ID2S-Chunk-Data", "id");
137  SET_CHOICE_MODULE("NCBI-Seq-split");
138  ADD_NAMED_STD_CHOICE_VARIANT("bioseq-set", m_Bioseq_set);
139  ADD_NAMED_STD_CHOICE_VARIANT("gi", m_Gi);
140  ADD_NAMED_REF_CHOICE_VARIANT("seq-id", m_object, CSeq_id);
141  info->CodeVersion(22400);
142  info->DataSpec(ncbi::EDataSpec::eASN);
143 }
145 
146 // constructor
148  : m_choice(e_not_set)
149 {
150 }
151 
152 // destructor
154 {
155  Reset();
156 }
157 
158 
160 {
161  if ( !m_Id ) {
162  m_Id.Reset(new TId());
163  return;
164  }
165  (*m_Id).Reset();
166 }
167 
169 {
170  m_Id.Reset(&value);
171 }
172 
174 {
175  m_Descr.Reset();
176 }
177 
179 {
180  m_Descr.Reset(&value);
181 }
182 
184 {
185  if ( !m_Descr )
186  m_Descr.Reset(new TDescr());
187  return (*m_Descr);
188 }
189 
191 {
192  m_Annots.clear();
193  m_set_State[0] &= ~0x30;
194 }
195 
197 {
198  m_Assembly.clear();
199  m_set_State[0] &= ~0xc0;
200 }
201 
203 {
204  m_Seq_map.clear();
205  m_set_State[0] &= ~0x300;
206 }
207 
209 {
210  m_Seq_data.clear();
211  m_set_State[0] &= ~0xc00;
212 }
213 
215 {
216  m_Bioseqs.clear();
217  m_set_State[0] &= ~0x3000;
218 }
219 
221 {
222  ResetId();
223  ResetDescr();
224  ResetAnnots();
225  ResetAssembly();
226  ResetSeq_map();
227  ResetSeq_data();
228  ResetBioseqs();
229 }
230 
232 {
233  SET_CLASS_MODULE("NCBI-Seq-split");
234  ADD_NAMED_REF_MEMBER("id", m_Id, C_Id);
235  ADD_NAMED_REF_MEMBER("descr", m_Descr, CSeq_descr)->SetOptional();
236  ADD_NAMED_MEMBER("annots", m_Annots, STL_list_set, (STL_CRef, (CLASS, (CSeq_annot))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
237  ADD_NAMED_MEMBER("assembly", m_Assembly, STL_list_set, (STL_CRef, (CLASS, (CSeq_align))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
238  ADD_NAMED_MEMBER("seq-map", m_Seq_map, STL_list, (STL_CRef, (CLASS, (CID2S_Sequence_Piece))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
239  ADD_NAMED_MEMBER("seq-data", m_Seq_data, STL_list, (STL_CRef, (CLASS, (CID2S_Sequence_Piece))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
240  ADD_NAMED_MEMBER("bioseqs", m_Bioseqs, STL_list_set, (STL_CRef, (CLASS, (CBioseq))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
241  info->RandomOrder();
242  info->CodeVersion(22400);
243  info->DataSpec(ncbi::EDataSpec::eASN);
244 }
246 
247 // constructor
249 {
250  memset(m_set_State,0,sizeof(m_set_State));
251  if ( !IsAllocatedInPool() ) {
252  ResetId();
253  }
254 }
255 
256 // destructor
258 {
259 }
260 
261 
262 
263 END_objects_SCOPE // namespace ncbi::objects::
264 
266 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("ID2S-Chunk-Data", CID2S_Chunk_Data)
BEGIN_NAMED_CHOICE_INFO("", CID2S_Chunk_Data_Base::C_Id)
User-defined methods of the data storage class.
place of data to insert
CID2S_Chunk_Data –.
CID2S_Sequence_Piece –.
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
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_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#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 ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#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
@ eDoNotResetVariant
Definition: serialbase.hpp:78
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
void ResetDescr(void)
Reset Descr data member.
list< CRef< CSeq_align > > m_Assembly
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
list< CRef< CID2S_Sequence_Piece > > m_Seq_data
virtual void Reset(void)
Reset the whole object.
static const char *const sm_SelectionNames[]
TId & SetId(void)
Assign a value to Id data member.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
TDescr & SetDescr(void)
Assign a value to Descr data member.
TSeq_id & SetSeq_id(void)
Select the variant.
list< CRef< CID2S_Sequence_Piece > > m_Seq_map
const TSeq_id & GetSeq_id(void) const
Get the variant data.
void ResetAnnots(void)
Reset Annots data member.
void ResetId(void)
Reset Id data member.
void Reset(void)
Reset the whole object.
void ResetBioseqs(void)
Reset Bioseqs data member.
void ResetAssembly(void)
Reset Assembly data member.
void ResetSeq_data(void)
Reset Seq_data data member.
void ResetSeq_map(void)
Reset Seq_map data member.
virtual ~CID2S_Chunk_Data_Base(void)
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
list< CRef< CSeq_annot > > m_Annots
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
list< CRef< CBioseq > > m_Bioseqs
@ 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 Wed Apr 17 13:10:40 2024 by modify_doxy.py rev. 669887