NCBI C++ ToolKit
ID2_Request_.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  * 'id2.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
51 
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 
55 // generated classes
56 
58 {
59  if ( m_choice != e_not_set )
61 }
62 
64 {
65  switch ( m_choice ) {
66  case e_Get_packages:
67  case e_Get_seq_id:
68  case e_Get_blob_id:
69  case e_Get_blob_info:
70  case e_Reget_blob:
71  case e_Get_chunks:
72  m_object->RemoveReference();
73  break;
74  default:
75  break;
76  }
77  m_choice = e_not_set;
78 }
79 
80 void CID2_Request_Base::C_Request::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
81 {
82  switch ( index ) {
83  case e_Get_packages:
84  (m_object = new(pool) ncbi::objects::CID2_Request_Get_Packages())->AddReference();
85  break;
86  case e_Get_seq_id:
87  (m_object = new(pool) ncbi::objects::CID2_Request_Get_Seq_id())->AddReference();
88  break;
89  case e_Get_blob_id:
90  (m_object = new(pool) ncbi::objects::CID2_Request_Get_Blob_Id())->AddReference();
91  break;
92  case e_Get_blob_info:
93  (m_object = new(pool) ncbi::objects::CID2_Request_Get_Blob_Info())->AddReference();
94  break;
95  case e_Reget_blob:
96  (m_object = new(pool) ncbi::objects::CID2_Request_ReGet_Blob())->AddReference();
97  break;
98  case e_Get_chunks:
99  (m_object = new(pool) ncbi::objects::CID2S_Request_Get_Chunks())->AddReference();
100  break;
101  default:
102  break;
103  }
104  m_choice = index;
105 }
106 
108  "not set",
109  "init",
110  "get-packages",
111  "get-seq-id",
112  "get-blob-id",
113  "get-blob-info",
114  "reget-blob",
115  "get-chunks"
116 };
117 
119 {
120  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
121 }
122 
124 {
125  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
126 }
127 
129 {
130  CheckSelected(e_Get_packages);
131  return *static_cast<const TGet_packages*>(m_object);
132 }
133 
135 {
136  Select(e_Get_packages, NCBI_NS_NCBI::eDoNotResetVariant);
137  return *static_cast<TGet_packages*>(m_object);
138 }
139 
141 {
142  TGet_packages* ptr = &value;
143  if ( m_choice != e_Get_packages || m_object != ptr ) {
144  ResetSelection();
145  (m_object = ptr)->AddReference();
146  m_choice = e_Get_packages;
147  }
148 }
149 
151 {
152  CheckSelected(e_Get_seq_id);
153  return *static_cast<const TGet_seq_id*>(m_object);
154 }
155 
157 {
158  Select(e_Get_seq_id, NCBI_NS_NCBI::eDoNotResetVariant);
159  return *static_cast<TGet_seq_id*>(m_object);
160 }
161 
163 {
164  TGet_seq_id* ptr = &value;
165  if ( m_choice != e_Get_seq_id || m_object != ptr ) {
166  ResetSelection();
167  (m_object = ptr)->AddReference();
168  m_choice = e_Get_seq_id;
169  }
170 }
171 
173 {
174  CheckSelected(e_Get_blob_id);
175  return *static_cast<const TGet_blob_id*>(m_object);
176 }
177 
179 {
180  Select(e_Get_blob_id, NCBI_NS_NCBI::eDoNotResetVariant);
181  return *static_cast<TGet_blob_id*>(m_object);
182 }
183 
185 {
186  TGet_blob_id* ptr = &value;
187  if ( m_choice != e_Get_blob_id || m_object != ptr ) {
188  ResetSelection();
189  (m_object = ptr)->AddReference();
190  m_choice = e_Get_blob_id;
191  }
192 }
193 
195 {
196  CheckSelected(e_Get_blob_info);
197  return *static_cast<const TGet_blob_info*>(m_object);
198 }
199 
201 {
202  Select(e_Get_blob_info, NCBI_NS_NCBI::eDoNotResetVariant);
203  return *static_cast<TGet_blob_info*>(m_object);
204 }
205 
207 {
208  TGet_blob_info* ptr = &value;
209  if ( m_choice != e_Get_blob_info || m_object != ptr ) {
210  ResetSelection();
211  (m_object = ptr)->AddReference();
212  m_choice = e_Get_blob_info;
213  }
214 }
215 
217 {
218  CheckSelected(e_Reget_blob);
219  return *static_cast<const TReget_blob*>(m_object);
220 }
221 
223 {
224  Select(e_Reget_blob, NCBI_NS_NCBI::eDoNotResetVariant);
225  return *static_cast<TReget_blob*>(m_object);
226 }
227 
229 {
230  TReget_blob* ptr = &value;
231  if ( m_choice != e_Reget_blob || m_object != ptr ) {
232  ResetSelection();
233  (m_object = ptr)->AddReference();
234  m_choice = e_Reget_blob;
235  }
236 }
237 
239 {
240  CheckSelected(e_Get_chunks);
241  return *static_cast<const TGet_chunks*>(m_object);
242 }
243 
245 {
246  Select(e_Get_chunks, NCBI_NS_NCBI::eDoNotResetVariant);
247  return *static_cast<TGet_chunks*>(m_object);
248 }
249 
251 {
252  TGet_chunks* ptr = &value;
253  if ( m_choice != e_Get_chunks || m_object != ptr ) {
254  ResetSelection();
255  (m_object = ptr)->AddReference();
256  m_choice = e_Get_chunks;
257  }
258 }
259 
260 // helper methods
261 
262 // type info
264 {
265  SET_INTERNAL_NAME("ID2-Request", "request");
266  SET_CHOICE_MODULE("NCBI-ID2Access");
267  ADD_NAMED_NULL_CHOICE_VARIANT("init", null, ());
268  ADD_NAMED_REF_CHOICE_VARIANT("get-packages", m_object, CID2_Request_Get_Packages);
269  ADD_NAMED_REF_CHOICE_VARIANT("get-seq-id", m_object, CID2_Request_Get_Seq_id);
270  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-id", m_object, CID2_Request_Get_Blob_Id);
271  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-info", m_object, CID2_Request_Get_Blob_Info);
272  ADD_NAMED_REF_CHOICE_VARIANT("reget-blob", m_object, CID2_Request_ReGet_Blob);
274  info->CodeVersion(22400);
275  info->DataSpec(ncbi::EDataSpec::eASN);
276 }
278 
279 // constructor
281  : m_choice(e_not_set)
282 {
283 }
284 
285 // destructor
287 {
288  Reset();
289 }
290 
291 
293 {
294  m_Params.Reset();
295 }
296 
298 {
299  m_Params.Reset(&value);
300 }
301 
303 {
304  if ( !m_Params )
305  m_Params.Reset(new TParams());
306  return (*m_Params);
307 }
308 
310 {
311  if ( !m_Request ) {
312  m_Request.Reset(new TRequest());
313  return;
314  }
315  (*m_Request).Reset();
316 }
317 
319 {
320  m_Request.Reset(&value);
321 }
322 
324 {
326  ResetParams();
327  ResetRequest();
328 }
329 
331 {
332  SET_CLASS_MODULE("NCBI-ID2Access");
333  ADD_NAMED_STD_MEMBER("serial-number", m_Serial_number)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
334  ADD_NAMED_REF_MEMBER("params", m_Params, CID2_Params)->SetOptional();
335  ADD_NAMED_REF_MEMBER("request", m_Request, C_Request);
336  info->RandomOrder();
337  info->CodeVersion(22400);
338  info->DataSpec(ncbi::EDataSpec::eASN);
339 }
341 
342 // constructor
344  : m_Serial_number(0)
345 {
346  memset(m_set_State,0,sizeof(m_set_State));
347  if ( !IsAllocatedInPool() ) {
348  ResetRequest();
349  }
350 }
351 
352 // destructor
354 {
355 }
356 
357 
358 
359 END_objects_SCOPE // namespace ncbi::objects::
360 
362 
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.
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_CHOICE_INFO("", CID2_Request_Base::C_Request)
BEGIN_NAMED_BASE_CLASS_INFO("ID2-Request", CID2_Request)
CID2S_Request_Get_Chunks –.
CID2_Params –.
Definition: ID2_Params.hpp:66
CID2_Request_Get_Blob_Id –.
CID2_Request_Get_Blob_Info –.
CID2_Request_Get_Packages –.
CID2_Request_Get_Seq_id –.
CID2_Request_ReGet_Blob –.
CID2_Request –.
Definition: ID2_Request.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_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_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:379
@ 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
TParams & SetParams(void)
Assign a value to Params data member.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
CID2_Params TParams
TGet_chunks & SetGet_chunks(void)
Select the variant.
CRef< TParams > m_Params
TRequest & SetRequest(void)
Assign a value to Request data member.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
static const char *const sm_SelectionNames[]
TGet_blob_id & SetGet_blob_id(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TGet_seq_id & SetGet_seq_id(void)
Select the variant.
const TReget_blob & GetReget_blob(void) const
Get the variant data.
void ResetRequest(void)
Reset Request data member.
void Reset(void)
Reset the whole object.
void ResetSerial_number(void)
Reset Serial_number data member.
TGet_packages & SetGet_packages(void)
Select the variant.
void ResetParams(void)
Reset Params data member.
virtual void Reset(void)
Reset the whole object.
CRef< TRequest > m_Request
TGet_blob_info & SetGet_blob_info(void)
Select the variant.
const TGet_packages & GetGet_packages(void) const
Get the variant data.
const TGet_seq_id & GetGet_seq_id(void) const
Get the variant data.
const TGet_chunks & GetGet_chunks(void) const
Get the variant data.
const TGet_blob_id & GetGet_blob_id(void) const
Get the variant data.
const TGet_blob_info & GetGet_blob_info(void) const
Get the variant data.
TReget_blob & SetReget_blob(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
virtual ~CID2_Request_Base(void)
@ e_not_set
No variant selected.
@ 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 Wed Jun 19 17:01:24 2024 by modify_doxy.py rev. 669887