NCBI C++ ToolKit
SeqTree_node_.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  * 'cdd.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
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 
50 // generated classes
51 
53 {
54  if ( !m_SeqRange ) {
55  m_SeqRange.Reset(new TSeqRange());
56  return;
57  }
58  (*m_SeqRange).Reset();
59 }
60 
62 {
63  m_SeqRange.Reset(&value);
64 }
65 
67 {
68  ResetSeqRange();
69  ResetRowId();
70 }
71 
73 {
74  SET_INTERNAL_NAME("SeqTree-node.children", "footprint");
75  SET_CLASS_MODULE("NCBI-Cdd");
76  ADD_NAMED_REF_MEMBER("seqRange", m_SeqRange, CSeq_interval);
77  ADD_NAMED_STD_MEMBER("rowId", m_RowId)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
78  info->RandomOrder();
79  info->CodeVersion(22301);
80  info->DataSpec(ncbi::EDataSpec::eASN);
81 }
83 
84 // constructor
86  : m_RowId(0)
87 {
88  memset(m_set_State,0,sizeof(m_set_State));
89  if ( !IsAllocatedInPool() ) {
90  ResetSeqRange();
91  }
92 }
93 
94 // destructor
96 {
97 }
98 
99 
101 {
102  if ( m_choice != e_not_set )
103  ResetSelection();
104 }
105 
107 {
108  switch ( m_choice ) {
109  case e_Children:
110  m_Children.Destruct();
111  break;
112  case e_Footprint:
113  m_object->RemoveReference();
114  break;
115  default:
116  break;
117  }
119 }
120 
121 void CSeqTree_node_Base::C_Children::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
122 {
123  switch ( index ) {
124  case e_Children:
125  m_Children.Construct();
126  break;
127  case e_Footprint:
128  (m_object = new(pool) C_Footprint())->AddReference();
129  break;
130  default:
131  break;
132  }
133  m_choice = index;
134 }
135 
137  "not set",
138  "children",
139  "footprint"
140 };
141 
143 {
144  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
145 }
146 
148 {
149  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
150 }
151 
153 {
155  return *static_cast<const TFootprint*>(m_object);
156 }
157 
159 {
161  return *static_cast<TFootprint*>(m_object);
162 }
163 
165 {
166  TFootprint* ptr = &value;
167  if ( m_choice != e_Footprint || m_object != ptr ) {
168  ResetSelection();
169  (m_object = ptr)->AddReference();
171  }
172 }
173 
174 // helper methods
175 
176 // type info
178 {
179  SET_INTERNAL_NAME("SeqTree-node", "children");
180  SET_CHOICE_MODULE("NCBI-Cdd");
181  ADD_NAMED_BUF_CHOICE_VARIANT("children", m_Children, STL_list, (STL_CRef, (CLASS, (CSeqTree_node))));
182  ADD_NAMED_REF_CHOICE_VARIANT("footprint", m_object, C_Footprint);
183  info->CodeVersion(22301);
184  info->DataSpec(ncbi::EDataSpec::eASN);
185 }
187 
188 // constructor
191 {
192 }
193 
194 // destructor
196 {
197  Reset();
198 }
199 
200 
202 {
203  m_Name.erase();
204  m_set_State[0] &= ~0xc;
205 }
206 
208 {
209  if ( !m_Children ) {
210  m_Children.Reset(new TChildren());
211  return;
212  }
213  (*m_Children).Reset();
214 }
215 
217 {
218  m_Children.Reset(&value);
219 }
220 
222 {
223  m_Annotation.Reset();
224 }
225 
227 {
228  m_Annotation.Reset(&value);
229 }
230 
232 {
233  if ( !m_Annotation )
234  m_Annotation.Reset(new TAnnotation());
235  return (*m_Annotation);
236 }
237 
239 {
241  ResetName();
242  ResetDistance();
243  ResetChildren();
244  ResetAnnotation();
245 }
246 
248 {
249  SET_CLASS_MODULE("NCBI-Cdd");
250  ADD_NAMED_STD_MEMBER("isAnnotated", m_IsAnnotated)->SetDefault(new TIsAnnotated(false))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
251  ADD_NAMED_STD_MEMBER("name", m_Name)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
252  ADD_NAMED_STD_MEMBER("distance", m_Distance)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
253  ADD_NAMED_REF_MEMBER("children", m_Children, C_Children);
254  ADD_NAMED_REF_MEMBER("annotation", m_Annotation, CNode_annotation)->SetOptional();
255  info->RandomOrder();
256  info->CodeVersion(22301);
257  info->DataSpec(ncbi::EDataSpec::eASN);
258 }
260 
261 // constructor
264 {
265  memset(m_set_State,0,sizeof(m_set_State));
266  if ( !IsAllocatedInPool() ) {
267  ResetChildren();
268  }
269 }
270 
271 // destructor
273 {
274 }
275 
276 
277 
278 END_objects_SCOPE // namespace ncbi::objects::
279 
281 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("SeqTree-node", CSeqTree_node)
BEGIN_NAMED_CHOICE_INFO("", CSeqTree_node_Base::C_Children)
BEGIN_NAMED_CLASS_INFO("", CSeqTree_node_Base::C_Children::C_Footprint)
#define false
Definition: bool.h:36
CNode_annotation –.
CSeqTree_node –.
char value[7]
Definition: config.c:431
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_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
#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
void Reset(void)
Reset the whole object.
TFootprint & SetFootprint(void)
Select the variant.
CNode_annotation TAnnotation
static const char *const sm_SelectionNames[]
TAnnotation & SetAnnotation(void)
Assign a value to Annotation data member.
NCBI_NS_NCBI::CSerialObject * m_object
NCBI_NS_NCBI::CUnionBuffer< TChildren > m_Children
TSeqRange & SetSeqRange(void)
Assign a value to SeqRange data member.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
void ResetSeqRange(void)
Reset SeqRange data member.
void Reset(void)
Reset the whole object.
TChildren & SetChildren(void)
Assign a value to Children data member.
CRef< TAnnotation > m_Annotation
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
virtual void Reset(void)
Reset the whole object.
CRef< TChildren > m_Children
void ResetChildren(void)
Reset Children data member.
void ResetDistance(void)
Reset Distance data member.
const TFootprint & GetFootprint(void) const
Get the variant data.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void ResetSelection(void)
Reset the selection (set it to e_not_set).
void ResetIsAnnotated(void)
Reset IsAnnotated data member.
virtual ~CSeqTree_node_Base(void)
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void ResetName(void)
Reset Name data member.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
void ResetAnnotation(void)
Reset Annotation data member.
@ e_not_set
No variant selected.
virtual void Reset(void)
Reset the whole object.
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Wed Dec 06 07:13:54 2023 by modify_doxy.py rev. 669887