NCBI C++ ToolKit
Seq_graph_.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  * 'seqres.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
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_Real:
64  case e_Int:
65  case e_Byte:
66  m_object->RemoveReference();
67  break;
68  default:
69  break;
70  }
71  m_choice = e_not_set;
72 }
73 
74 void CSeq_graph_Base::C_Graph::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
75 {
76  switch ( index ) {
77  case e_Real:
78  (m_object = new(pool) ncbi::objects::CReal_graph())->AddReference();
79  break;
80  case e_Int:
81  (m_object = new(pool) ncbi::objects::CInt_graph())->AddReference();
82  break;
83  case e_Byte:
84  (m_object = new(pool) ncbi::objects::CByte_graph())->AddReference();
85  break;
86  default:
87  break;
88  }
89  m_choice = index;
90 }
91 
92 const char* const CSeq_graph_Base::C_Graph::sm_SelectionNames[] = {
93  "not set",
94  "real",
95  "int",
96  "byte"
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_Real);
112  return *static_cast<const TReal*>(m_object);
113 }
114 
116 {
117  Select(e_Real, NCBI_NS_NCBI::eDoNotResetVariant);
118  return *static_cast<TReal*>(m_object);
119 }
120 
122 {
123  TReal* ptr = &value;
124  if ( m_choice != e_Real || m_object != ptr ) {
125  ResetSelection();
126  (m_object = ptr)->AddReference();
127  m_choice = e_Real;
128  }
129 }
130 
132 {
133  CheckSelected(e_Int);
134  return *static_cast<const TInt*>(m_object);
135 }
136 
138 {
139  Select(e_Int, NCBI_NS_NCBI::eDoNotResetVariant);
140  return *static_cast<TInt*>(m_object);
141 }
142 
144 {
145  TInt* ptr = &value;
146  if ( m_choice != e_Int || m_object != ptr ) {
147  ResetSelection();
148  (m_object = ptr)->AddReference();
149  m_choice = e_Int;
150  }
151 }
152 
154 {
155  CheckSelected(e_Byte);
156  return *static_cast<const TByte*>(m_object);
157 }
158 
160 {
161  Select(e_Byte, NCBI_NS_NCBI::eDoNotResetVariant);
162  return *static_cast<TByte*>(m_object);
163 }
164 
166 {
167  TByte* ptr = &value;
168  if ( m_choice != e_Byte || m_object != ptr ) {
169  ResetSelection();
170  (m_object = ptr)->AddReference();
171  m_choice = e_Byte;
172  }
173 }
174 
175 // helper methods
176 
177 // type info
179 {
180  SET_INTERNAL_NAME("Seq-graph", "graph");
181  SET_CHOICE_MODULE("NCBI-Seqres");
182  ADD_NAMED_REF_CHOICE_VARIANT("real", m_object, CReal_graph);
183  ADD_NAMED_REF_CHOICE_VARIANT("int", m_object, CInt_graph);
184  ADD_NAMED_REF_CHOICE_VARIANT("byte", m_object, CByte_graph);
185  info->CodeVersion(22400);
186  info->DataSpec(ncbi::EDataSpec::eASN);
187 }
189 
190 // constructor
192  : m_choice(e_not_set)
193 {
194 }
195 
196 // destructor
198 {
199  Reset();
200 }
201 
202 
204 {
205  m_Title.erase();
206  m_set_State[0] &= ~0x3;
207 }
208 
210 {
211  m_Comment.erase();
212  m_set_State[0] &= ~0xc;
213 }
214 
216 {
217  if ( !m_Loc ) {
218  m_Loc.Reset(new TLoc());
219  return;
220  }
221  (*m_Loc).Reset();
222 }
223 
225 {
226  m_Loc.Reset(&value);
227 }
228 
230 {
231  m_Title_x.erase();
232  m_set_State[0] &= ~0xc0;
233 }
234 
236 {
237  m_Title_y.erase();
238  m_set_State[0] &= ~0x300;
239 }
240 
242 {
243  if ( !m_Graph ) {
244  m_Graph.Reset(new TGraph());
245  return;
246  }
247  (*m_Graph).Reset();
248 }
249 
251 {
252  m_Graph.Reset(&value);
253 }
254 
256 {
257  ResetTitle();
258  ResetComment();
259  ResetLoc();
260  ResetTitle_x();
261  ResetTitle_y();
262  ResetComp();
263  ResetA();
264  ResetB();
265  ResetNumval();
266  ResetGraph();
267 }
268 
270 {
271  SET_CLASS_MODULE("NCBI-Seqres");
272  ADD_NAMED_STD_MEMBER("title", m_Title)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
273  ADD_NAMED_STD_MEMBER("comment", m_Comment)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
275  ADD_NAMED_STD_MEMBER("title-x", m_Title_x)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
276  ADD_NAMED_STD_MEMBER("title-y", m_Title_y)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
277  ADD_NAMED_STD_MEMBER("comp", m_Comp)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
278  ADD_NAMED_STD_MEMBER("a", m_A)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
279  ADD_NAMED_STD_MEMBER("b", m_B)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
280  ADD_NAMED_STD_MEMBER("numval", m_Numval)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
281  ADD_NAMED_REF_MEMBER("graph", m_Graph, C_Graph);
282  info->RandomOrder();
283  info->CodeVersion(22400);
284  info->DataSpec(ncbi::EDataSpec::eASN);
285 }
287 
288 // constructor
290  : m_Comp(0), m_A(0), m_B(0), m_Numval(0)
291 {
292  memset(m_set_State,0,sizeof(m_set_State));
293  if ( !IsAllocatedInPool() ) {
294  ResetLoc();
295  ResetGraph();
296  }
297 }
298 
299 // destructor
301 {
302 }
303 
304 
305 
306 END_objects_SCOPE // namespace ncbi::objects::
307 
309 
User-defined methods of the data storage class.
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-graph", CSeq_graph)
Definition: Seq_graph_.cpp:269
BEGIN_NAMED_CHOICE_INFO("", CSeq_graph_Base::C_Graph)
Definition: Seq_graph_.cpp:178
CByte_graph –.
Definition: Byte_graph.hpp:66
CInt_graph –.
Definition: Int_graph.hpp:66
CReal_graph –.
Definition: Real_graph.hpp:66
string
Definition: cgiapp.hpp:690
#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
@ 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 ResetTitle(void)
Reset Title data member.
Definition: Seq_graph_.cpp:203
void ResetTitle_y(void)
Reset Title_y data member.
Definition: Seq_graph_.cpp:235
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Seq_graph_.cpp:99
TLoc & SetLoc(void)
Assign a value to Loc data member.
Definition: Seq_graph_.hpp:878
E_Choice
Choice variants.
Definition: Seq_graph_.hpp:114
void ResetA(void)
Reset A data member.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_graph_.cpp:104
TByte & SetByte(void)
Select the variant.
Definition: Seq_graph_.cpp:159
virtual void Reset(void)
Reset the whole object.
Definition: Seq_graph_.cpp:255
CRef< TGraph > m_Graph
Definition: Seq_graph_.hpp:703
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_graph_.cpp:131
TReal & SetReal(void)
Select the variant.
Definition: Seq_graph_.cpp:115
TInt & SetInt(void)
Select the variant.
Definition: Seq_graph_.cpp:137
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_graph_.cpp:74
const TByte & GetByte(void) const
Get the variant data.
Definition: Seq_graph_.cpp:153
CRef< TLoc > m_Loc
Definition: Seq_graph_.hpp:696
const TReal & GetReal(void) const
Get the variant data.
Definition: Seq_graph_.cpp:109
virtual ~CSeq_graph_Base(void)
Definition: Seq_graph_.cpp:300
void ResetLoc(void)
Reset Loc data member.
Definition: Seq_graph_.cpp:215
Uint4 m_set_State[1]
Definition: Seq_graph_.hpp:693
void ResetTitle_x(void)
Reset Title_x data member.
Definition: Seq_graph_.cpp:229
void ResetNumval(void)
Reset Numval data member.
void ResetComp(void)
Reset Comp data member.
Definition: Seq_graph_.hpp:993
TGraph & SetGraph(void)
Assign a value to Graph data member.
void ResetComment(void)
Reset Comment data member.
Definition: Seq_graph_.cpp:209
void Reset(void)
Reset the whole object.
Definition: Seq_graph_.cpp:54
void ResetGraph(void)
Reset Graph data member.
Definition: Seq_graph_.cpp:241
void ResetB(void)
Reset B data member.
static const char *const sm_SelectionNames[]
Definition: Seq_graph_.hpp:268
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_graph_.cpp:60
@ e_not_set
No variant selected.
Definition: Seq_graph_.hpp:115
@ 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 Sep 20 14:57:06 2024 by modify_doxy.py rev. 669887