NCBI C++ ToolKit
PC_Group_.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  * 'pcsubstance.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
45 
46 BEGIN_objects_SCOPE // namespace ncbi::objects::
47 
48 
49 // generated classes
50 
52 {
53  SET_ENUM_INTERNAL_NAME("PC-Group", "type");
54  SET_ENUM_MODULE("NCBI-PCSubstance");
55  ADD_ENUM_VALUE("sup", eType_sup);
56  ADD_ENUM_VALUE("mul", eType_mul);
57  ADD_ENUM_VALUE("sru", eType_sru);
58  ADD_ENUM_VALUE("mon", eType_mon);
59  ADD_ENUM_VALUE("mer", eType_mer);
60  ADD_ENUM_VALUE("cop", eType_cop);
61  ADD_ENUM_VALUE("cro", eType_cro);
62  ADD_ENUM_VALUE("mod", eType_mod);
63  ADD_ENUM_VALUE("gra", eType_gra);
64  ADD_ENUM_VALUE("com", eType_com);
65  ADD_ENUM_VALUE("mix", eType_mix);
66  ADD_ENUM_VALUE("for", eType_for);
67  ADD_ENUM_VALUE("dat", eType_dat);
68  ADD_ENUM_VALUE("any", eType_any);
69  ADD_ENUM_VALUE("gen", eType_gen);
70  ADD_ENUM_VALUE("unknown", eType_unknown);
71 }
73 
75 {
76  SET_ENUM_INTERNAL_NAME("PC-Group", "subtype");
77  SET_ENUM_MODULE("NCBI-PCSubstance");
78  ADD_ENUM_VALUE("alt", eSubtype_alt);
79  ADD_ENUM_VALUE("ran", eSubtype_ran);
80  ADD_ENUM_VALUE("blo", eSubtype_blo);
81  ADD_ENUM_VALUE("unknown", eSubtype_unknown);
82 }
84 
85 BEGIN_NAMED_ENUM_IN_INFO("", CPC_Group_Base::, EConnectivity, true)
86 {
87  SET_ENUM_INTERNAL_NAME("PC-Group", "connectivity");
88  SET_ENUM_MODULE("NCBI-PCSubstance");
89  ADD_ENUM_VALUE("hh", eConnectivity_hh);
90  ADD_ENUM_VALUE("ht", eConnectivity_ht);
91  ADD_ENUM_VALUE("eu", eConnectivity_eu);
92  ADD_ENUM_VALUE("unknown", eConnectivity_unknown);
93 }
95 
97 {
98  ResetLower();
99  ResetUpper();
100 }
101 
103 {
104  SET_INTERNAL_NAME("PC-Group.repeat-count", "range");
105  SET_CLASS_MODULE("NCBI-PCSubstance");
106  ADD_NAMED_STD_MEMBER("lower", m_Lower)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
107  ADD_NAMED_STD_MEMBER("upper", m_Upper)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
108  info->RandomOrder();
109  info->CodeVersion(22400);
110  info->DataSpec(ncbi::EDataSpec::eASN);
111 }
113 
114 // constructor
116  : m_Lower(0), m_Upper(0)
117 {
118  memset(m_set_State,0,sizeof(m_set_State));
119 }
120 
121 // destructor
123 {
124 }
125 
126 
128 {
129  if ( m_choice != e_not_set )
130  ResetSelection();
131 }
132 
134 {
135  switch ( m_choice ) {
136  case e_Range:
137  m_object->RemoveReference();
138  break;
139  default:
140  break;
141  }
143 }
144 
145 void CPC_Group_Base::C_Repeat_count::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
146 {
147  switch ( index ) {
148  case e_Exact:
149  m_Exact = 0;
150  break;
151  case e_Range:
152  (m_object = new(pool) C_Range())->AddReference();
153  break;
154  default:
155  break;
156  }
157  m_choice = index;
158 }
159 
161  "not set",
162  "exact",
163  "range"
164 };
165 
167 {
168  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
169 }
170 
172 {
173  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
174 }
175 
177 {
179  return *static_cast<const TRange*>(m_object);
180 }
181 
183 {
185  return *static_cast<TRange*>(m_object);
186 }
187 
189 {
190  TRange* ptr = &value;
191  if ( m_choice != e_Range || m_object != ptr ) {
192  ResetSelection();
193  (m_object = ptr)->AddReference();
194  m_choice = e_Range;
195  }
196 }
197 
198 // helper methods
199 
200 // type info
202 {
203  SET_INTERNAL_NAME("PC-Group", "repeat-count");
204  SET_CHOICE_MODULE("NCBI-PCSubstance");
206  ADD_NAMED_REF_CHOICE_VARIANT("range", m_object, C_Range);
207  info->CodeVersion(22400);
208  info->DataSpec(ncbi::EDataSpec::eASN);
209 }
211 
212 // constructor
215 {
216 }
217 
218 // destructor
220 {
221  Reset();
222 }
223 
224 
226 {
227  m_From.clear();
228  m_set_State[0] &= ~0x3;
229 }
230 
232 {
233  m_To.clear();
234  m_set_State[0] &= ~0xc;
235 }
236 
238 {
239  ResetFrom();
240  ResetTo();
241 }
242 
244 {
245  SET_INTERNAL_NAME("PC-Group", "bonds");
246  SET_CLASS_MODULE("NCBI-PCSubstance");
247  ADD_NAMED_MEMBER("from", m_From, STL_vector, (STD, (int)))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
248  ADD_NAMED_MEMBER("to", m_To, STL_vector, (STD, (int)))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
249  info->RandomOrder();
250  info->CodeVersion(22400);
251  info->DataSpec(ncbi::EDataSpec::eASN);
252 }
254 
255 // constructor
257 {
258  memset(m_set_State,0,sizeof(m_set_State));
259 }
260 
261 // destructor
263 {
264 }
265 
266 
268 {
269  if ( !m_Left ) {
270  m_Left.Reset(new TLeft());
271  return;
272  }
273  (*m_Left).Reset();
274 }
275 
277 {
278  m_Left.Reset(&value);
279 }
280 
282 {
283  if ( !m_Right ) {
284  m_Right.Reset(new TRight());
285  return;
286  }
287  (*m_Right).Reset();
288 }
289 
291 {
292  m_Right.Reset(&value);
293 }
294 
296 {
297  ResetLeft();
298  ResetRight();
299 }
300 
302 {
303  SET_INTERNAL_NAME("PC-Group", "brackets");
304  SET_CLASS_MODULE("NCBI-PCSubstance");
305  ADD_NAMED_REF_MEMBER("left", m_Left, CPC_Bracket);
306  ADD_NAMED_REF_MEMBER("right", m_Right, CPC_Bracket);
307  info->RandomOrder();
308  info->CodeVersion(22400);
309  info->DataSpec(ncbi::EDataSpec::eASN);
310 }
312 
313 // constructor
315 {
316  memset(m_set_State,0,sizeof(m_set_State));
317  if ( !IsAllocatedInPool() ) {
318  ResetLeft();
319  ResetRight();
320  }
321 }
322 
323 // destructor
325 {
326 }
327 
328 
330 {
331  m_Atoms.clear();
332  m_set_State[0] &= ~0x3;
333 }
334 
336 {
337  m_Subscript.erase();
338  m_set_State[0] &= ~0xc00;
339 }
340 
342 {
343  m_Repeat_count.Reset();
344 }
345 
347 {
348  m_Repeat_count.Reset(&value);
349 }
350 
352 {
353  if ( !m_Repeat_count )
354  m_Repeat_count.Reset(new TRepeat_count());
355  return (*m_Repeat_count);
356 }
357 
359 {
360  m_Bonds.Reset();
361 }
362 
364 {
365  m_Bonds.Reset(&value);
366 }
367 
369 {
370  if ( !m_Bonds )
371  m_Bonds.Reset(new TBonds());
372  return (*m_Bonds);
373 }
374 
376 {
377  m_Brackets.Reset();
378 }
379 
381 {
382  m_Brackets.Reset(&value);
383 }
384 
386 {
387  if ( !m_Brackets )
388  m_Brackets.Reset(new TBrackets());
389  return (*m_Brackets);
390 }
391 
393 {
394  ResetAtoms();
395  ResetType();
396  ResetSubtype();
398  ResetLabel();
399  ResetSubscript();
401  ResetBonds();
402  ResetBrackets();
403 }
404 
406 {
407  SET_CLASS_MODULE("NCBI-PCSubstance");
408  ADD_NAMED_MEMBER("atoms", m_Atoms, STL_vector, (STD, (int)))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
409  ADD_NAMED_ENUM_MEMBER("type", m_Type, EType)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
410  ADD_NAMED_ENUM_MEMBER("subtype", m_Subtype, ESubtype)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
411  ADD_NAMED_ENUM_MEMBER("connectivity", m_Connectivity, EConnectivity)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
412  ADD_NAMED_STD_MEMBER("label", m_Label)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
413  ADD_NAMED_STD_MEMBER("subscript", m_Subscript)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
414  ADD_NAMED_REF_MEMBER("repeat-count", m_Repeat_count, C_Repeat_count)->SetOptional();
415  ADD_NAMED_REF_MEMBER("bonds", m_Bonds, C_Bonds)->SetOptional();
416  ADD_NAMED_REF_MEMBER("brackets", m_Brackets, C_Brackets)->SetOptional();
417  info->RandomOrder();
418  info->CodeVersion(22400);
419  info->DataSpec(ncbi::EDataSpec::eASN);
420 }
422 
423 // constructor
426 {
427  memset(m_set_State,0,sizeof(m_set_State));
428 }
429 
430 // destructor
432 {
433 }
434 
435 
436 
437 END_objects_SCOPE // namespace ncbi::objects::
438 
440 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("PC-Group", CPC_Group)
Definition: PC_Group_.cpp:405
BEGIN_NAMED_ENUM_IN_INFO("", CPC_Group_Base::, EType, true)
Definition: PC_Group_.cpp:51
BEGIN_NAMED_CLASS_INFO("", CPC_Group_Base::C_Repeat_count::C_Range)
Definition: PC_Group_.cpp:102
BEGIN_NAMED_CHOICE_INFO("", CPC_Group_Base::C_Repeat_count)
Definition: PC_Group_.cpp:201
END_ENUM_INFO
Definition: aln_errors.cpp:58
CPC_Bracket –.
Definition: PC_Bracket.hpp:66
Special bonds in this group (typically capping/crossing bonds, e.g.
Definition: PC_Group_.hpp:418
Bracket display (e.g.
Definition: PC_Group_.hpp:527
Superatom group (e.g.
Definition: PC_Group_.hpp:79
CPC_Group –.
Definition: PC_Group.hpp:66
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 ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#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
const TRange & GetRange(void) const
Get the variant data.
Definition: PC_Group_.cpp:176
EConnectivity
Connectivity (e.g. from MOL field SCN)
Definition: PC_Group_.hpp:126
TBonds & SetBonds(void)
Assign a value to Bonds data member.
Definition: PC_Group_.cpp:368
virtual void Reset(void)
Reset the whole object.
Definition: PC_Bracket_.cpp:50
C_Bonds TBonds
Definition: PC_Group_.hpp:649
virtual void Reset(void)
Reset the whole object.
Definition: PC_Group_.cpp:392
CRef< TBrackets > m_Brackets
Definition: PC_Group_.hpp:1020
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: PC_Group_.cpp:145
void Reset(void)
Reset the whole object.
Definition: PC_Group_.cpp:96
TRange & SetRange(void)
Select the variant.
Definition: PC_Group_.cpp:182
virtual ~CPC_Group_Base(void)
Definition: PC_Group_.cpp:431
static const char *const sm_SelectionNames[]
Definition: PC_Group_.hpp:403
string m_Subscript
Definition: PC_Group_.hpp:1017
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
void Reset(void)
Reset the whole object.
Definition: PC_Group_.cpp:127
void Reset(void)
Reset the whole object.
Definition: PC_Group_.cpp:295
void ResetLabel(void)
Reset Label data member.
Definition: PC_Group_.hpp:1477
void ResetBonds(void)
Reset Bonds data member.
Definition: PC_Group_.cpp:358
vector< int > m_Atoms
Definition: PC_Group_.hpp:1012
void ResetType(void)
Reset Type data member.
Definition: PC_Group_.hpp:1336
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: PC_Group_.cpp:171
TLeft & SetLeft(void)
Assign a value to Left data member.
Definition: PC_Group_.hpp:1260
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: PC_Group_.cpp:133
void ResetLeft(void)
Reset Left data member.
Definition: PC_Group_.cpp:267
CRef< TRepeat_count > m_Repeat_count
Definition: PC_Group_.hpp:1018
void ResetRight(void)
Reset Right data member.
Definition: PC_Group_.cpp:281
ESubtype
Subtype (e.g. from MOL field SST)
Definition: PC_Group_.hpp:115
C_Brackets TBrackets
Definition: PC_Group_.hpp:650
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: PC_Group_.hpp:1133
void ResetTo(void)
Reset To data member.
Definition: PC_Group_.cpp:231
Uint4 m_set_State[1]
Definition: PC_Group_.hpp:1011
void ResetSubtype(void)
Reset Subtype data member.
Definition: PC_Group_.hpp:1383
void ResetLower(void)
Reset Lower data member.
Definition: PC_Group_.hpp:1045
CRef< TBonds > m_Bonds
Definition: PC_Group_.hpp:1019
NCBI_NS_NCBI::CSerialObject * m_object
Definition: PC_Group_.hpp:407
void Reset(void)
Reset the whole object.
Definition: PC_Group_.cpp:237
C_Repeat_count TRepeat_count
Definition: PC_Group_.hpp:648
void ResetRepeat_count(void)
Reset Repeat_count data member.
Definition: PC_Group_.cpp:341
TRepeat_count & SetRepeat_count(void)
Assign a value to Repeat_count data member.
Definition: PC_Group_.cpp:351
EType
These enumerated values are adapted from the ctfile format specification Type of group (e....
Definition: PC_Group_.hpp:92
void ResetAtoms(void)
Reset Atoms data member.
Definition: PC_Group_.cpp:329
void ResetSubscript(void)
Reset Subscript data member.
Definition: PC_Group_.cpp:335
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: PC_Group_.cpp:166
void ResetBrackets(void)
Reset Brackets data member.
Definition: PC_Group_.cpp:375
void ResetUpper(void)
Reset Upper data member.
Definition: PC_Group_.hpp:1092
CPC_Group_Base(void)
Definition: PC_Group_.cpp:424
TBrackets & SetBrackets(void)
Assign a value to Brackets data member.
Definition: PC_Group_.cpp:385
void ResetFrom(void)
Reset From data member.
Definition: PC_Group_.cpp:225
TRight & SetRight(void)
Assign a value to Right data member.
Definition: PC_Group_.hpp:1290
void ResetConnectivity(void)
Reset Connectivity data member.
Definition: PC_Group_.hpp:1430
@ e_not_set
No variant selected.
Definition: PC_Group_.hpp:277
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static const CSubSource::ESubtype eSubtype_unknown
Modified on Thu May 02 14:35:27 2024 by modify_doxy.py rev. 669887