NCBI C++ ToolKit
PC_AssaySubmit_.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  * 'pcassay.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_Aid_source:
64  case e_Descr:
65  case e_Aidver:
66  m_object->RemoveReference();
67  break;
68  default:
69  break;
70  }
71  m_choice = e_not_set;
72 }
73 
74 void CPC_AssaySubmit_Base::C_Assay::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
75 {
76  switch ( index ) {
77  case e_Aid:
78  m_Aid = 0;
79  break;
80  case e_Aid_source:
81  (m_object = new(pool) ncbi::objects::CPC_Source())->AddReference();
82  break;
83  case e_Descr:
84  (m_object = new(pool) ncbi::objects::CPC_AssayDescription())->AddReference();
85  break;
86  case e_Aidver:
87  (m_object = new(pool) ncbi::objects::CPC_ID())->AddReference();
88  break;
89  default:
90  break;
91  }
92  m_choice = index;
93 }
94 
96  "not set",
97  "aid",
98  "aid-source",
99  "descr",
100  "aidver"
101 };
102 
104 {
105  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
106 }
107 
109 {
110  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
111 }
112 
114 {
115  CheckSelected(e_Aid_source);
116  return *static_cast<const TAid_source*>(m_object);
117 }
118 
120 {
121  Select(e_Aid_source, NCBI_NS_NCBI::eDoNotResetVariant);
122  return *static_cast<TAid_source*>(m_object);
123 }
124 
126 {
127  TAid_source* ptr = &value;
128  if ( m_choice != e_Aid_source || m_object != ptr ) {
129  ResetSelection();
130  (m_object = ptr)->AddReference();
131  m_choice = e_Aid_source;
132  }
133 }
134 
136 {
137  CheckSelected(e_Descr);
138  return *static_cast<const TDescr*>(m_object);
139 }
140 
142 {
143  Select(e_Descr, NCBI_NS_NCBI::eDoNotResetVariant);
144  return *static_cast<TDescr*>(m_object);
145 }
146 
148 {
149  TDescr* ptr = &value;
150  if ( m_choice != e_Descr || m_object != ptr ) {
151  ResetSelection();
152  (m_object = ptr)->AddReference();
153  m_choice = e_Descr;
154  }
155 }
156 
158 {
159  CheckSelected(e_Aidver);
160  return *static_cast<const TAidver*>(m_object);
161 }
162 
164 {
165  Select(e_Aidver, NCBI_NS_NCBI::eDoNotResetVariant);
166  return *static_cast<TAidver*>(m_object);
167 }
168 
170 {
171  TAidver* ptr = &value;
172  if ( m_choice != e_Aidver || m_object != ptr ) {
173  ResetSelection();
174  (m_object = ptr)->AddReference();
175  m_choice = e_Aidver;
176  }
177 }
178 
179 // helper methods
180 
181 // type info
183 {
184  SET_INTERNAL_NAME("PC-AssaySubmit", "assay");
185  SET_CHOICE_MODULE("NCBI-PCAssay");
186  ADD_NAMED_STD_CHOICE_VARIANT("aid", m_Aid);
187  ADD_NAMED_REF_CHOICE_VARIANT("aid-source", m_object, CPC_Source);
189  ADD_NAMED_REF_CHOICE_VARIANT("aidver", m_object, CPC_ID);
190  info->CodeVersion(22400);
191  info->DataSpec(ncbi::EDataSpec::eASN);
192 }
194 
195 // constructor
197  : m_choice(e_not_set)
198 {
199 }
200 
201 // destructor
203 {
204  Reset();
205 }
206 
207 
209 {
210  if ( !m_Assay ) {
211  m_Assay.Reset(new TAssay());
212  return;
213  }
214  (*m_Assay).Reset();
215 }
216 
218 {
219  m_Assay.Reset(&value);
220 }
221 
223 {
224  m_Data.clear();
225  m_set_State[0] &= ~0xc;
226 }
227 
229 {
230  m_Revoke.clear();
231  m_set_State[0] &= ~0x30;
232 }
233 
235 {
236  ResetAssay();
237  ResetData();
238  ResetRevoke();
239 }
240 
242 {
243  SET_CLASS_MODULE("NCBI-PCAssay");
244  ADD_NAMED_REF_MEMBER("assay", m_Assay, C_Assay);
245  ADD_NAMED_MEMBER("data", m_Data, STL_vector, (STL_CRef, (CLASS, (CPC_AssayResults))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
246  ADD_NAMED_MEMBER("revoke", m_Revoke, STL_vector, (STD, (int)))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
247  info->RandomOrder();
248  info->CodeVersion(22400);
249  info->DataSpec(ncbi::EDataSpec::eASN);
250 }
252 
253 // constructor
255 {
256  memset(m_set_State,0,sizeof(m_set_State));
257  if ( !IsAllocatedInPool() ) {
258  ResetAssay();
259  }
260 }
261 
262 // destructor
264 {
265 }
266 
267 
268 
269 END_objects_SCOPE // namespace ncbi::objects::
270 
272 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CPC_AssayDescription –.
CPC_AssayResults –.
Assay Description or pre-existing Identifier.
CPC_AssaySubmit –.
CPC_ID –.
Definition: PC_ID.hpp:66
CPC_Source –.
Definition: PC_Source.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 ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#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 SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#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
@ e_not_set
No variant selected.
static const char *const sm_SelectionNames[]
void ResetAssay(void)
Reset Assay data member.
void ResetRevoke(void)
Reset Revoke data member.
TDescr & SetDescr(void)
Select the variant.
TAidver & SetAidver(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
vector< CRef< CPC_AssayResults > > m_Data
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TDescr & GetDescr(void) const
Get the variant data.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
virtual void Reset(void)
Reset the whole object.
const TAidver & GetAidver(void) const
Get the variant data.
const TAid_source & GetAid_source(void) const
Get the variant data.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
virtual ~CPC_AssaySubmit_Base(void)
TAid_source & SetAid_source(void)
Select the variant.
void Reset(void)
Reset the whole object.
void ResetData(void)
Reset Data data member.
TAssay & SetAssay(void)
Assign a value to Assay data member.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
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_CHOICE_INFO("", CPC_AssaySubmit_Base::C_Assay)
BEGIN_NAMED_BASE_CLASS_INFO("PC-AssaySubmit", CPC_AssaySubmit)
#define STD
Modified on Wed Sep 04 15:01:29 2024 by modify_doxy.py rev. 669887