NCBI C++ ToolKit
Seq_ext_.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  * 'seq.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
42 #include <objects/seq/Seq_ext.hpp>
44 #include <objects/seq/Map_ext.hpp>
45 #include <objects/seq/Ref_ext.hpp>
46 #include <objects/seq/Seg_ext.hpp>
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 
52 // generated classes
53 
55 {
56  if ( m_choice != e_not_set )
58 }
59 
61 {
62  switch ( m_choice ) {
63  case e_Seg:
64  case e_Ref:
65  case e_Map:
66  case e_Delta:
67  m_object->RemoveReference();
68  break;
69  default:
70  break;
71  }
73 }
74 
75 void CSeq_ext_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
76 {
77  switch ( index ) {
78  case e_Seg:
79  (m_object = new(pool) ncbi::objects::CSeg_ext())->AddReference();
80  break;
81  case e_Ref:
82  (m_object = new(pool) ncbi::objects::CRef_ext())->AddReference();
83  break;
84  case e_Map:
85  (m_object = new(pool) ncbi::objects::CMap_ext())->AddReference();
86  break;
87  case e_Delta:
88  (m_object = new(pool) ncbi::objects::CDelta_ext())->AddReference();
89  break;
90  default:
91  break;
92  }
93  m_choice = index;
94 }
95 
96 const char* const CSeq_ext_Base::sm_SelectionNames[] = {
97  "not set",
98  "seg",
99  "ref",
100  "map",
101  "delta"
102 };
103 
105 {
106  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
107 }
108 
110 {
111  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
112 }
113 
115 {
117  return *static_cast<const TSeg*>(m_object);
118 }
119 
121 {
123  return *static_cast<TSeg*>(m_object);
124 }
125 
127 {
128  TSeg* ptr = &value;
129  if ( m_choice != e_Seg || m_object != ptr ) {
130  ResetSelection();
131  (m_object = ptr)->AddReference();
132  m_choice = e_Seg;
133  }
134 }
135 
137 {
139  return *static_cast<const TRef*>(m_object);
140 }
141 
143 {
145  return *static_cast<TRef*>(m_object);
146 }
147 
149 {
150  TRef* ptr = &value;
151  if ( m_choice != e_Ref || m_object != ptr ) {
152  ResetSelection();
153  (m_object = ptr)->AddReference();
154  m_choice = e_Ref;
155  }
156 }
157 
159 {
161  return *static_cast<const TMap*>(m_object);
162 }
163 
165 {
167  return *static_cast<TMap*>(m_object);
168 }
169 
171 {
172  TMap* ptr = &value;
173  if ( m_choice != e_Map || m_object != ptr ) {
174  ResetSelection();
175  (m_object = ptr)->AddReference();
176  m_choice = e_Map;
177  }
178 }
179 
181 {
183  return *static_cast<const TDelta*>(m_object);
184 }
185 
187 {
189  return *static_cast<TDelta*>(m_object);
190 }
191 
193 {
194  TDelta* ptr = &value;
195  if ( m_choice != e_Delta || m_object != ptr ) {
196  ResetSelection();
197  (m_object = ptr)->AddReference();
198  m_choice = e_Delta;
199  }
200 }
201 
202 // helper methods
203 
204 // type info
206 {
207  SET_CHOICE_MODULE("NCBI-Sequence");
208  ADD_NAMED_REF_CHOICE_VARIANT("seg", m_object, CSeg_ext);
209  ADD_NAMED_REF_CHOICE_VARIANT("ref", m_object, CRef_ext);
210  ADD_NAMED_REF_CHOICE_VARIANT("map", m_object, CMap_ext);
211  ADD_NAMED_REF_CHOICE_VARIANT("delta", m_object, CDelta_ext);
212  info->CodeVersion(21600);
213 }
215 
216 // constructor
218  : m_choice(e_not_set)
219 {
220 }
221 
222 // destructor
224 {
225  Reset();
226 }
227 
228 
229 
230 END_objects_SCOPE // namespace ncbi::objects::
231 
233 
TDelta & SetDelta(void)
Select the variant.
Definition: Seq_ext_.cpp:186
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:392
static const char *const sm_SelectionNames[]
Definition: Seq_ext_.hpp:274
User-defined methods of the data storage class.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
BEGIN_NAMED_BASE_CHOICE_INFO("Seq-ext", CSeq_ext)
Definition: Seq_ext_.cpp:205
segmented sequences
Definition: Seq_ext_.hpp:94
string
Definition: cgiapp.hpp:437
virtual ~CSeq_ext_Base(void)
Definition: Seq_ext_.cpp:223
const TDelta & GetDelta(void) const
Get the variant data.
Definition: Seq_ext_.cpp:180
TSeg & SetSeg(void)
Select the variant.
Definition: Seq_ext_.cpp:120
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:169
User-defined methods of the data storage class.
const TRef & GetRef(void) const
Get the variant data.
Definition: Seq_ext_.cpp:136
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_ext_.cpp:60
const TSeg & GetSeg(void) const
Get the variant data.
Definition: Seq_ext_.cpp:114
CSeq_ext –.
Definition: Seq_ext.hpp:65
ordered map of markers
Definition: Seq_ext_.hpp:96
CSeg_ext –.
Definition: Seg_ext.hpp:65
User-defined methods of the data storage class.
CSeq_ext_Base(void)
Definition: Seq_ext_.cpp:217
char value[7]
Definition: config.c:428
NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_ext_.cpp:109
CRef_ext –.
Definition: Ref_ext.hpp:65
E_Choice
Choice variants.
Definition: Seq_ext_.hpp:92
CMap_ext –.
Definition: Map_ext.hpp:65
const TMap & GetMap(void) const
Get the variant data.
Definition: Seq_ext_.cpp:158
hot link to another sequence (a view)
Definition: Seq_ext_.hpp:95
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:492
No variant selected.
Definition: Seq_ext_.hpp:93
User-defined methods of the data storage class.
E_Choice m_choice
Definition: Seq_ext_.hpp:270
TRef & SetRef(void)
Select the variant.
Definition: Seq_ext_.cpp:142
TMap & SetMap(void)
Select the variant.
Definition: Seq_ext_.cpp:164
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Seq_ext_.hpp:295
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_ext_.cpp:104
#define END_CHOICE_INFO
Definition: serialimpl.hpp:498
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Seq_ext_.hpp:276
User-defined methods of the data storage class.
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:490
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
virtual void Reset(void)
Reset the whole object.
Definition: Seq_ext_.cpp:54
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_ext_.cpp:75
Modified on Thu Jul 28 20:10:33 2016 by modify_doxy.py rev. 506947