NCBI C++ ToolKit
Seq_align_.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  * 'seqalign.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
55 
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // generated classes
60 
62 {
63  SET_ENUM_INTERNAL_NAME("Seq-align", "type");
64  SET_ENUM_MODULE("NCBI-Seqalign");
65  ADD_ENUM_VALUE("not-set", eType_not_set);
66  ADD_ENUM_VALUE("global", eType_global);
67  ADD_ENUM_VALUE("diags", eType_diags);
68  ADD_ENUM_VALUE("partial", eType_partial);
69  ADD_ENUM_VALUE("disc", eType_disc);
70  ADD_ENUM_VALUE("other", eType_other);
71 }
73 
75 {
76  if ( m_choice != e_not_set )
78 }
79 
81 {
82  switch ( m_choice ) {
83  case e_Dendiag:
84  m_Dendiag.Destruct();
85  break;
86  case e_Std:
87  m_Std.Destruct();
88  break;
89  case e_Denseg:
90  case e_Packed:
91  case e_Disc:
92  case e_Spliced:
93  case e_Sparse:
94  m_object->RemoveReference();
95  break;
96  default:
97  break;
98  }
99  m_choice = e_not_set;
100 }
101 
102 void CSeq_align_Base::C_Segs::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
103 {
104  switch ( index ) {
105  case e_Dendiag:
106  m_Dendiag.Construct();
107  break;
108  case e_Denseg:
109  (m_object = new(pool) ncbi::objects::CDense_seg())->AddReference();
110  break;
111  case e_Std:
112  m_Std.Construct();
113  break;
114  case e_Packed:
115  (m_object = new(pool) ncbi::objects::CPacked_seg())->AddReference();
116  break;
117  case e_Disc:
118  (m_object = new(pool) ncbi::objects::CSeq_align_set())->AddReference();
119  break;
120  case e_Spliced:
121  (m_object = new(pool) ncbi::objects::CSpliced_seg())->AddReference();
122  break;
123  case e_Sparse:
124  (m_object = new(pool) ncbi::objects::CSparse_seg())->AddReference();
125  break;
126  default:
127  break;
128  }
129  m_choice = index;
130 }
131 
132 const char* const CSeq_align_Base::C_Segs::sm_SelectionNames[] = {
133  "not set",
134  "dendiag",
135  "denseg",
136  "std",
137  "packed",
138  "disc",
139  "spliced",
140  "sparse"
141 };
142 
144 {
145  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
146 }
147 
149 {
150  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
151 }
152 
154 {
155  CheckSelected(e_Denseg);
156  return *static_cast<const TDenseg*>(m_object);
157 }
158 
160 {
161  Select(e_Denseg, NCBI_NS_NCBI::eDoNotResetVariant);
162  return *static_cast<TDenseg*>(m_object);
163 }
164 
166 {
167  TDenseg* ptr = &value;
168  if ( m_choice != e_Denseg || m_object != ptr ) {
169  ResetSelection();
170  (m_object = ptr)->AddReference();
171  m_choice = e_Denseg;
172  }
173 }
174 
176 {
177  CheckSelected(e_Packed);
178  return *static_cast<const TPacked*>(m_object);
179 }
180 
182 {
183  Select(e_Packed, NCBI_NS_NCBI::eDoNotResetVariant);
184  return *static_cast<TPacked*>(m_object);
185 }
186 
188 {
189  TPacked* ptr = &value;
190  if ( m_choice != e_Packed || m_object != ptr ) {
191  ResetSelection();
192  (m_object = ptr)->AddReference();
193  m_choice = e_Packed;
194  }
195 }
196 
198 {
199  CheckSelected(e_Disc);
200  return *static_cast<const TDisc*>(m_object);
201 }
202 
204 {
205  Select(e_Disc, NCBI_NS_NCBI::eDoNotResetVariant);
206  return *static_cast<TDisc*>(m_object);
207 }
208 
210 {
211  TDisc* ptr = &value;
212  if ( m_choice != e_Disc || m_object != ptr ) {
213  ResetSelection();
214  (m_object = ptr)->AddReference();
215  m_choice = e_Disc;
216  }
217 }
218 
220 {
221  CheckSelected(e_Spliced);
222  return *static_cast<const TSpliced*>(m_object);
223 }
224 
226 {
227  Select(e_Spliced, NCBI_NS_NCBI::eDoNotResetVariant);
228  return *static_cast<TSpliced*>(m_object);
229 }
230 
232 {
233  TSpliced* ptr = &value;
234  if ( m_choice != e_Spliced || m_object != ptr ) {
235  ResetSelection();
236  (m_object = ptr)->AddReference();
237  m_choice = e_Spliced;
238  }
239 }
240 
242 {
243  CheckSelected(e_Sparse);
244  return *static_cast<const TSparse*>(m_object);
245 }
246 
248 {
249  Select(e_Sparse, NCBI_NS_NCBI::eDoNotResetVariant);
250  return *static_cast<TSparse*>(m_object);
251 }
252 
254 {
255  TSparse* ptr = &value;
256  if ( m_choice != e_Sparse || m_object != ptr ) {
257  ResetSelection();
258  (m_object = ptr)->AddReference();
259  m_choice = e_Sparse;
260  }
261 }
262 
263 // helper methods
264 
265 // type info
267 {
268  SET_INTERNAL_NAME("Seq-align", "segs");
269  SET_CHOICE_MODULE("NCBI-Seqalign");
270  ADD_NAMED_BUF_CHOICE_VARIANT("dendiag", m_Dendiag, STL_list, (STL_CRef, (CLASS, (CDense_diag))));
271  ADD_NAMED_REF_CHOICE_VARIANT("denseg", m_object, CDense_seg);
272  ADD_NAMED_BUF_CHOICE_VARIANT("std", m_Std, STL_list, (STL_CRef, (CLASS, (CStd_seg))));
273  ADD_NAMED_REF_CHOICE_VARIANT("packed", m_object, CPacked_seg);
274  ADD_NAMED_REF_CHOICE_VARIANT("disc", m_object, CSeq_align_set);
275  ADD_NAMED_REF_CHOICE_VARIANT("spliced", m_object, CSpliced_seg);
276  ADD_NAMED_REF_CHOICE_VARIANT("sparse", m_object, CSparse_seg);
277  info->CodeVersion(22400);
278  info->DataSpec(ncbi::EDataSpec::eASN);
279 }
281 
282 // constructor
284  : m_choice(e_not_set)
285 {
286 }
287 
288 // destructor
290 {
291  Reset();
292 }
293 
294 
296 {
297  m_Score.clear();
298  m_set_State[0] &= ~0x30;
299 }
300 
302 {
303  if ( !m_Segs ) {
304  m_Segs.Reset(new TSegs());
305  return;
306  }
307  (*m_Segs).Reset();
308 }
309 
311 {
312  m_Segs.Reset(&value);
313 }
314 
316 {
317  m_Bounds.clear();
318  m_set_State[0] &= ~0x300;
319 }
320 
322 {
323  m_Id.clear();
324  m_set_State[0] &= ~0xc00;
325 }
326 
328 {
329  m_Ext.clear();
330  m_set_State[0] &= ~0x3000;
331 }
332 
334 {
335  ResetType();
336  ResetDim();
337  ResetScore();
338  ResetSegs();
339  ResetBounds();
340  ResetId();
341  ResetExt();
342 }
343 
345 {
346  SET_CLASS_MODULE("NCBI-Seqalign");
347  ADD_NAMED_ENUM_MEMBER("type", m_Type, EType)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
348  ADD_NAMED_STD_MEMBER("dim", m_Dim)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
349  ADD_NAMED_MEMBER("score", m_Score, STL_vector_set, (STL_CRef, (CLASS, (CScore))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
350  ADD_NAMED_REF_MEMBER("segs", m_Segs, C_Segs);
351  ADD_NAMED_MEMBER("bounds", m_Bounds, STL_list_set, (STL_CRef, (CLASS, (CSeq_loc))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
352  ADD_NAMED_MEMBER("id", m_Id, STL_list, (STL_CRef, (CLASS, (CObject_id))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
353  ADD_NAMED_MEMBER("ext", m_Ext, STL_list, (STL_CRef, (CLASS, (CUser_object))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
354  info->RandomOrder();
355  info->CodeVersion(22400);
356  info->DataSpec(ncbi::EDataSpec::eASN);
357 }
359 
360 // constructor
362  : m_Type((EType)(0)), m_Dim(0)
363 {
364  memset(m_set_State,0,sizeof(m_set_State));
365  if ( !IsAllocatedInPool() ) {
366  ResetSegs();
367  }
368 }
369 
370 // destructor
372 {
373 }
374 
375 
376 
377 END_objects_SCOPE // namespace ncbi::objects::
378 
380 
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_CLASS_INFO("Seq-align", CSeq_align)
Definition: Seq_align_.cpp:344
BEGIN_NAMED_CHOICE_INFO("", CSeq_align_Base::C_Segs)
Definition: Seq_align_.cpp:266
BEGIN_NAMED_ENUM_IN_INFO("", CSeq_align_Base::, EType, false)
Definition: Seq_align_.cpp:61
User-defined methods of the data storage class.
User-defined methods of the data storage class.
END_ENUM_INFO
Definition: aln_errors.cpp:58
CPacked_seg –.
Definition: Packed_seg.hpp:66
Definition: Score.hpp:57
CSeq_align_Base –.
Definition: Seq_align_.hpp:88
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 SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#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 SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#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 ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#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
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
const TDenseg & GetDenseg(void) const
Get the variant data.
Definition: Seq_align_.cpp:153
CRef< TSegs > m_Segs
Definition: Seq_align_.hpp:675
TSegs & SetSegs(void)
Assign a value to Segs data member.
Definition: Seq_align_.hpp:930
TDenseg & SetDenseg(void)
Select the variant.
Definition: Seq_align_.cpp:159
TPacked & SetPacked(void)
Select the variant.
Definition: Seq_align_.cpp:181
void ResetExt(void)
Reset Ext data member.
Definition: Seq_align_.cpp:327
E_Choice
Choice variants.
Definition: Seq_align_.hpp:131
void ResetSegs(void)
Reset Segs data member.
Definition: Seq_align_.cpp:301
void ResetDim(void)
Reset Dim data member.
Definition: Seq_align_.hpp:849
virtual ~CSeq_align_Base(void)
Definition: Seq_align_.cpp:371
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_align_.cpp:143
void ResetId(void)
Reset Id data member.
Definition: Seq_align_.cpp:321
list< CRef< CUser_object > > m_Ext
Definition: Seq_align_.hpp:678
void ResetScore(void)
Reset Score data member.
Definition: Seq_align_.cpp:295
TSparse & SetSparse(void)
Select the variant.
Definition: Seq_align_.cpp:247
void Reset(void)
Reset the whole object.
Definition: Seq_align_.cpp:74
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_align_.cpp:80
vector< CRef< CScore > > m_Score
Definition: Seq_align_.hpp:674
static const char *const sm_SelectionNames[]
Definition: Seq_align_.hpp:387
const TSpliced & GetSpliced(void) const
Get the variant data.
Definition: Seq_align_.cpp:219
const TPacked & GetPacked(void) const
Get the variant data.
Definition: Seq_align_.cpp:175
virtual void Reset(void)
Reset the whole object.
Definition: Seq_align_.cpp:333
void ResetBounds(void)
Reset Bounds data member.
Definition: Seq_align_.cpp:315
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_align_.cpp:148
TDisc & SetDisc(void)
Select the variant.
Definition: Seq_align_.cpp:203
TSpliced & SetSpliced(void)
Select the variant.
Definition: Seq_align_.cpp:225
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_align_.cpp:102
const TSparse & GetSparse(void) const
Get the variant data.
Definition: Seq_align_.cpp:241
const TDisc & GetDisc(void) const
Get the variant data.
Definition: Seq_align_.cpp:197
Uint4 m_set_State[1]
Definition: Seq_align_.hpp:671
list< CRef< CSeq_loc > > m_Bounds
Definition: Seq_align_.hpp:676
void ResetType(void)
Reset Type data member.
Definition: Seq_align_.hpp:802
list< CRef< CObject_id > > m_Id
Definition: Seq_align_.hpp:677
@ e_not_set
No variant selected.
Definition: Seq_align_.hpp:132
@ 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 Apr 26 16:22:36 2024 by modify_doxy.py rev. 669887