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(21600);
278 }
280 
281 // constructor
283  : m_choice(e_not_set)
284 {
285 }
286 
287 // destructor
289 {
290  Reset();
291 }
292 
293 
295 {
296  m_Score.clear();
297  m_set_State[0] &= ~0x30;
298 }
299 
301 {
302  if ( !m_Segs ) {
303  m_Segs.Reset(new TSegs());
304  return;
305  }
306  (*m_Segs).Reset();
307 }
308 
310 {
311  m_Segs.Reset(&value);
312 }
313 
315 {
316  m_Bounds.clear();
317  m_set_State[0] &= ~0x300;
318 }
319 
321 {
322  m_Id.clear();
323  m_set_State[0] &= ~0xc00;
324 }
325 
327 {
328  m_Ext.clear();
329  m_set_State[0] &= ~0x3000;
330 }
331 
333 {
334  ResetType();
335  ResetDim();
336  ResetScore();
337  ResetSegs();
338  ResetBounds();
339  ResetId();
340  ResetExt();
341 }
342 
344 {
345  SET_CLASS_MODULE("NCBI-Seqalign");
346  ADD_NAMED_ENUM_MEMBER("type", m_Type, EType)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
347  ADD_NAMED_STD_MEMBER("dim", m_Dim)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
348  ADD_NAMED_MEMBER("score", m_Score, STL_vector_set, (STL_CRef, (CLASS, (CScore))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
349  ADD_NAMED_REF_MEMBER("segs", m_Segs, C_Segs);
350  ADD_NAMED_MEMBER("bounds", m_Bounds, STL_list_set, (STL_CRef, (CLASS, (CSeq_loc))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
351  ADD_NAMED_MEMBER("id", m_Id, STL_list, (STL_CRef, (CLASS, (CObject_id))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
352  ADD_NAMED_MEMBER("ext", m_Ext, STL_list, (STL_CRef, (CLASS, (CUser_object))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
353  info->RandomOrder();
354  info->CodeVersion(21600);
355 }
357 
358 // constructor
360  : m_Type((EType)(0)), m_Dim(0)
361 {
362  memset(m_set_State,0,sizeof(m_set_State));
363  if ( !IsAllocatedInPool() ) {
364  ResetSegs();
365  }
366 }
367 
368 // destructor
370 {
371 }
372 
373 
374 
375 END_objects_SCOPE // namespace ncbi::objects::
376 
378 
void ResetExt(void)
Reset Ext data member.
Definition: Seq_align_.cpp:326
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:436
void ResetId(void)
Reset Id data member.
Definition: Seq_align_.cpp:320
#define SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:550
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:392
User-defined methods of the data storage class.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_align_.cpp:102
#define END_ENUM_INFO
Definition: serialimpl.hpp:560
TDisc & SetDisc(void)
Select the variant.
Definition: Seq_align_.cpp:203
TDenseg & SetDenseg(void)
Select the variant.
Definition: Seq_align_.cpp:159
#define MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:276
virtual ~CSeq_align_Base(void)
Definition: Seq_align_.cpp:369
#define SET_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:439
string
Definition: cgiapp.hpp:437
virtual void Reset(void)
Reset the whole object.
Definition: Seq_align_.cpp:332
Definition: Score.hpp:56
TSparse & SetSparse(void)
Select the variant.
Definition: Seq_align_.cpp:247
BEGIN_NAMED_CHOICE_INFO("", CSeq_align_Base::C_Segs)
Definition: Seq_align_.cpp:266
bool IsAllocatedInPool(void) const THROWS_NONE
Check if object is allocated in memory pool (not system heap)
Definition: ncbiobj.hpp:462
void Reset(void)
Reset the whole object.
Definition: Seq_align_.cpp:74
User-defined methods of the data storage class.
void ResetBounds(void)
Reset Bounds data member.
Definition: Seq_align_.cpp:314
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() EType(void)
Access to EType's attributes (values, names) as defined in spec.
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:377
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
BEGIN_NAMED_ENUM_IN_INFO("", CSeq_align_Base::, EType, false)
Definition: Seq_align_.cpp:61
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:169
CSeq_align_Base –.
Definition: Seq_align_.hpp:87
#define ADD_NAMED_STD_MEMBER(MemberAlias, MemberName)
Definition: serialimpl.hpp:337
#define ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:349
#define ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:343
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:334
#define END_CLASS_INFO
Definition: serialimpl.hpp:448
list< CRef< CUser_object > > m_Ext
Definition: Seq_align_.hpp:665
const TDenseg & GetDenseg(void) const
Get the variant data.
Definition: Seq_align_.cpp:153
const TSpliced & GetSpliced(void) const
Get the variant data.
Definition: Seq_align_.cpp:219
const TDisc & GetDisc(void) const
Get the variant data.
Definition: Seq_align_.cpp:197
BEGIN_NAMED_BASE_CLASS_INFO("Seq-align", CSeq_align)
Definition: Seq_align_.cpp:343
void ResetScore(void)
Reset Score data member.
Definition: Seq_align_.cpp:294
char value[7]
Definition: config.c:428
CPacked_seg –.
Definition: Packed_seg.hpp:65
const TPacked & GetPacked(void) const
Get the variant data.
Definition: Seq_align_.cpp:175
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_align_.cpp:80
TPacked & SetPacked(void)
Select the variant.
Definition: Seq_align_.cpp:181
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:492
TSegs & SetSegs(void)
Assign a value to Segs data member.
Definition: Seq_align_.hpp:917
list< CRef< CSeq_loc > > m_Bounds
Definition: Seq_align_.hpp:663
TSpliced & SetSpliced(void)
Select the variant.
Definition: Seq_align_.cpp:225
CRef< TSegs > m_Segs
Definition: Seq_align_.hpp:662
Uint4 m_set_State[1]
Definition: Seq_align_.hpp:658
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:544
vector< CRef< CScore > > m_Score
Definition: Seq_align_.hpp:661
User-defined methods of the data storage class.
list< CRef< CObject_id > > m_Id
Definition: Seq_align_.hpp:664
void ResetSegs(void)
Reset Segs data member.
Definition: Seq_align_.cpp:300
NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_align_.cpp:148
User-defined methods of the data storage class.
const TSparse & GetSparse(void) const
Get the variant data.
Definition: Seq_align_.cpp:241
E_Choice
Choice variants.
Definition: Seq_align_.hpp:131
void ResetDim(void)
Reset Dim data member.
Definition: Seq_align_.hpp:836
#define END_CHOICE_INFO
Definition: serialimpl.hpp:498
void ResetType(void)
Reset Type data member.
Definition: Seq_align_.hpp:789
User-defined methods of the data storage class.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_align_.cpp:143
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:490
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
static const char *const sm_SelectionNames[]
Definition: Seq_align_.hpp:387
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:553
Modified on Mon Sep 26 17:44:35 2016 by modify_doxy.py rev. 506947