NCBI C++ ToolKit
ID2_Reply_.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
54 
55 BEGIN_objects_SCOPE // namespace ncbi::objects::
56 
57 
58 // generated classes
59 
61 {
62  if ( m_choice != e_not_set )
64 }
65 
67 {
68  switch ( m_choice ) {
69  case e_Get_package:
70  case e_Get_seq_id:
71  case e_Get_blob_id:
72  case e_Get_blob_seq_ids:
73  case e_Get_blob:
74  case e_Reget_blob:
75  case e_Get_split_info:
76  case e_Get_chunk:
77  m_object->RemoveReference();
78  break;
79  default:
80  break;
81  }
82  m_choice = e_not_set;
83 }
84 
85 void CID2_Reply_Base::C_Reply::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
86 {
87  switch ( index ) {
88  case e_Get_package:
89  (m_object = new(pool) ncbi::objects::CID2_Reply_Get_Package())->AddReference();
90  break;
91  case e_Get_seq_id:
92  (m_object = new(pool) ncbi::objects::CID2_Reply_Get_Seq_id())->AddReference();
93  break;
94  case e_Get_blob_id:
95  (m_object = new(pool) ncbi::objects::CID2_Reply_Get_Blob_Id())->AddReference();
96  break;
97  case e_Get_blob_seq_ids:
98  (m_object = new(pool) ncbi::objects::CID2_Reply_Get_Blob_Seq_ids())->AddReference();
99  break;
100  case e_Get_blob:
101  (m_object = new(pool) ncbi::objects::CID2_Reply_Get_Blob())->AddReference();
102  break;
103  case e_Reget_blob:
104  (m_object = new(pool) ncbi::objects::CID2_Reply_ReGet_Blob())->AddReference();
105  break;
106  case e_Get_split_info:
107  (m_object = new(pool) ncbi::objects::CID2S_Reply_Get_Split_Info())->AddReference();
108  break;
109  case e_Get_chunk:
110  (m_object = new(pool) ncbi::objects::CID2S_Reply_Get_Chunk())->AddReference();
111  break;
112  default:
113  break;
114  }
115  m_choice = index;
116 }
117 
118 const char* const CID2_Reply_Base::C_Reply::sm_SelectionNames[] = {
119  "not set",
120  "init",
121  "empty",
122  "get-package",
123  "get-seq-id",
124  "get-blob-id",
125  "get-blob-seq-ids",
126  "get-blob",
127  "reget-blob",
128  "get-split-info",
129  "get-chunk"
130 };
131 
133 {
134  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
135 }
136 
138 {
139  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
140 }
141 
143 {
144  CheckSelected(e_Get_package);
145  return *static_cast<const TGet_package*>(m_object);
146 }
147 
149 {
150  Select(e_Get_package, NCBI_NS_NCBI::eDoNotResetVariant);
151  return *static_cast<TGet_package*>(m_object);
152 }
153 
155 {
156  TGet_package* ptr = &value;
157  if ( m_choice != e_Get_package || m_object != ptr ) {
158  ResetSelection();
159  (m_object = ptr)->AddReference();
160  m_choice = e_Get_package;
161  }
162 }
163 
165 {
166  CheckSelected(e_Get_seq_id);
167  return *static_cast<const TGet_seq_id*>(m_object);
168 }
169 
171 {
172  Select(e_Get_seq_id, NCBI_NS_NCBI::eDoNotResetVariant);
173  return *static_cast<TGet_seq_id*>(m_object);
174 }
175 
177 {
178  TGet_seq_id* ptr = &value;
179  if ( m_choice != e_Get_seq_id || m_object != ptr ) {
180  ResetSelection();
181  (m_object = ptr)->AddReference();
182  m_choice = e_Get_seq_id;
183  }
184 }
185 
187 {
188  CheckSelected(e_Get_blob_id);
189  return *static_cast<const TGet_blob_id*>(m_object);
190 }
191 
193 {
194  Select(e_Get_blob_id, NCBI_NS_NCBI::eDoNotResetVariant);
195  return *static_cast<TGet_blob_id*>(m_object);
196 }
197 
199 {
200  TGet_blob_id* ptr = &value;
201  if ( m_choice != e_Get_blob_id || m_object != ptr ) {
202  ResetSelection();
203  (m_object = ptr)->AddReference();
204  m_choice = e_Get_blob_id;
205  }
206 }
207 
209 {
210  CheckSelected(e_Get_blob_seq_ids);
211  return *static_cast<const TGet_blob_seq_ids*>(m_object);
212 }
213 
215 {
216  Select(e_Get_blob_seq_ids, NCBI_NS_NCBI::eDoNotResetVariant);
217  return *static_cast<TGet_blob_seq_ids*>(m_object);
218 }
219 
221 {
222  TGet_blob_seq_ids* ptr = &value;
223  if ( m_choice != e_Get_blob_seq_ids || m_object != ptr ) {
224  ResetSelection();
225  (m_object = ptr)->AddReference();
226  m_choice = e_Get_blob_seq_ids;
227  }
228 }
229 
231 {
232  CheckSelected(e_Get_blob);
233  return *static_cast<const TGet_blob*>(m_object);
234 }
235 
237 {
238  Select(e_Get_blob, NCBI_NS_NCBI::eDoNotResetVariant);
239  return *static_cast<TGet_blob*>(m_object);
240 }
241 
243 {
244  TGet_blob* ptr = &value;
245  if ( m_choice != e_Get_blob || m_object != ptr ) {
246  ResetSelection();
247  (m_object = ptr)->AddReference();
248  m_choice = e_Get_blob;
249  }
250 }
251 
253 {
254  CheckSelected(e_Reget_blob);
255  return *static_cast<const TReget_blob*>(m_object);
256 }
257 
259 {
260  Select(e_Reget_blob, NCBI_NS_NCBI::eDoNotResetVariant);
261  return *static_cast<TReget_blob*>(m_object);
262 }
263 
265 {
266  TReget_blob* ptr = &value;
267  if ( m_choice != e_Reget_blob || m_object != ptr ) {
268  ResetSelection();
269  (m_object = ptr)->AddReference();
270  m_choice = e_Reget_blob;
271  }
272 }
273 
275 {
276  CheckSelected(e_Get_split_info);
277  return *static_cast<const TGet_split_info*>(m_object);
278 }
279 
281 {
282  Select(e_Get_split_info, NCBI_NS_NCBI::eDoNotResetVariant);
283  return *static_cast<TGet_split_info*>(m_object);
284 }
285 
287 {
288  TGet_split_info* ptr = &value;
289  if ( m_choice != e_Get_split_info || m_object != ptr ) {
290  ResetSelection();
291  (m_object = ptr)->AddReference();
292  m_choice = e_Get_split_info;
293  }
294 }
295 
297 {
298  CheckSelected(e_Get_chunk);
299  return *static_cast<const TGet_chunk*>(m_object);
300 }
301 
303 {
304  Select(e_Get_chunk, NCBI_NS_NCBI::eDoNotResetVariant);
305  return *static_cast<TGet_chunk*>(m_object);
306 }
307 
309 {
310  TGet_chunk* ptr = &value;
311  if ( m_choice != e_Get_chunk || m_object != ptr ) {
312  ResetSelection();
313  (m_object = ptr)->AddReference();
314  m_choice = e_Get_chunk;
315  }
316 }
317 
318 // helper methods
319 
320 // type info
322 {
323  SET_INTERNAL_NAME("ID2-Reply", "reply");
324  SET_CHOICE_MODULE("NCBI-ID2Access");
325  ADD_NAMED_NULL_CHOICE_VARIANT("init", null, ());
326  ADD_NAMED_NULL_CHOICE_VARIANT("empty", null, ());
327  ADD_NAMED_REF_CHOICE_VARIANT("get-package", m_object, CID2_Reply_Get_Package);
328  ADD_NAMED_REF_CHOICE_VARIANT("get-seq-id", m_object, CID2_Reply_Get_Seq_id);
329  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-id", m_object, CID2_Reply_Get_Blob_Id);
330  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-seq-ids", m_object, CID2_Reply_Get_Blob_Seq_ids);
331  ADD_NAMED_REF_CHOICE_VARIANT("get-blob", m_object, CID2_Reply_Get_Blob);
332  ADD_NAMED_REF_CHOICE_VARIANT("reget-blob", m_object, CID2_Reply_ReGet_Blob);
333  ADD_NAMED_REF_CHOICE_VARIANT("get-split-info", m_object, CID2S_Reply_Get_Split_Info);
334  ADD_NAMED_REF_CHOICE_VARIANT("get-chunk", m_object, CID2S_Reply_Get_Chunk);
335  info->CodeVersion(22400);
336  info->DataSpec(ncbi::EDataSpec::eASN);
337 }
339 
340 // constructor
342  : m_choice(e_not_set)
343 {
344 }
345 
346 // destructor
348 {
349  Reset();
350 }
351 
352 
354 {
355  SET_ENUM_INTERNAL_NAME("ID2-Reply", "discard");
356  SET_ENUM_MODULE("NCBI-ID2Access");
357  ADD_ENUM_VALUE("reply", eDiscard_reply);
358  ADD_ENUM_VALUE("last-octet-string", eDiscard_last_octet_string);
359  ADD_ENUM_VALUE("nothing", eDiscard_nothing);
360 }
362 
364 {
365  m_Params.Reset();
366 }
367 
369 {
370  m_Params.Reset(&value);
371 }
372 
374 {
375  if ( !m_Params )
376  m_Params.Reset(new TParams());
377  return (*m_Params);
378 }
379 
381 {
382  m_Error.clear();
383  m_set_State[0] &= ~0x30;
384 }
385 
387 {
388  if ( !m_Reply ) {
389  m_Reply.Reset(new TReply());
390  return;
391  }
392  (*m_Reply).Reset();
393 }
394 
396 {
397  m_Reply.Reset(&value);
398 }
399 
401 {
403  ResetParams();
404  ResetError();
406  ResetReply();
407  ResetDiscard();
408 }
409 
411 {
412  SET_CLASS_MODULE("NCBI-ID2Access");
413  ADD_NAMED_STD_MEMBER("serial-number", m_Serial_number)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
414  ADD_NAMED_REF_MEMBER("params", m_Params, CID2_Params)->SetOptional();
415  ADD_NAMED_MEMBER("error", m_Error, STL_list, (STL_CRef, (CLASS, (CID2_Error))))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
416  ADD_NAMED_NULL_MEMBER("end-of-reply", null, ())->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
417  ADD_NAMED_REF_MEMBER("reply", m_Reply, C_Reply);
418  ADD_NAMED_ENUM_MEMBER("discard", m_Discard, EDiscard)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
419  info->RandomOrder();
420  info->CodeVersion(22400);
421  info->DataSpec(ncbi::EDataSpec::eASN);
422 }
424 
425 // constructor
428 {
429  memset(m_set_State,0,sizeof(m_set_State));
430  if ( !IsAllocatedInPool() ) {
431  ResetReply();
432  }
433 }
434 
435 // destructor
437 {
438 }
439 
440 
441 
442 END_objects_SCOPE // namespace ncbi::objects::
443 
445 
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.
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_ENUM_IN_INFO("", CID2_Reply_Base::, EDiscard, false)
Definition: ID2_Reply_.cpp:353
BEGIN_NAMED_CHOICE_INFO("", CID2_Reply_Base::C_Reply)
Definition: ID2_Reply_.cpp:321
BEGIN_NAMED_BASE_CLASS_INFO("ID2-Reply", CID2_Reply)
Definition: ID2_Reply_.cpp:410
END_ENUM_INFO
Definition: aln_errors.cpp:58
CID2S_Reply_Get_Chunk –.
CID2S_Reply_Get_Split_Info –.
CID2_Error –.
Definition: ID2_Error.hpp:66
CID2_Params –.
Definition: ID2_Params.hpp:66
reply data moved at the end to make it easier to construct the reply data manually from precalculated...
Definition: ID2_Reply_.hpp:108
********************************************************************* reply types *******************...
Definition: ID2_Reply_.hpp:89
CID2_Reply_Get_Blob_Id –.
CID2_Reply_Get_Blob_Seq_ids –.
CID2_Reply_Get_Blob –.
CID2_Reply_Get_Package –.
CID2_Reply_Get_Seq_id –.
CID2_Reply_ReGet_Blob –.
CID2_Reply –.
Definition: ID2_Reply.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 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_NULL_MEMBER(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:339
#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 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
const TGet_split_info & GetGet_split_info(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:274
TGet_seq_id & SetGet_seq_id(void)
Select the variant.
Definition: ID2_Reply_.cpp:170
void ResetSerial_number(void)
Reset Serial_number data member.
Definition: ID2_Reply_.hpp:823
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: ID2_Reply_.cpp:85
TParams & SetParams(void)
Assign a value to Params data member.
Definition: ID2_Reply_.cpp:373
void ResetEnd_of_reply(void)
Reset End_of_reply data member.
Definition: ID2_Reply_.hpp:916
TGet_blob_id & SetGet_blob_id(void)
Select the variant.
Definition: ID2_Reply_.cpp:192
TReget_blob & SetReget_blob(void)
Select the variant.
Definition: ID2_Reply_.cpp:258
virtual void Reset(void)
Reset the whole object.
Definition: ID2_Reply_.cpp:400
E_Choice
Choice variants.
Definition: ID2_Reply_.hpp:121
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: ID2_Reply_.cpp:132
const TGet_blob_id & GetGet_blob_id(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:186
TGet_chunk & SetGet_chunk(void)
Select the variant.
Definition: ID2_Reply_.cpp:302
void Reset(void)
Reset the whole object.
Definition: ID2_Reply_.cpp:60
void ResetParams(void)
Reset Params data member.
Definition: ID2_Reply_.cpp:363
const TGet_blob & GetGet_blob(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:230
EDiscard m_Discard
Definition: ID2_Reply_.hpp:697
void ResetReply(void)
Reset Reply data member.
Definition: ID2_Reply_.cpp:386
EDiscard
additional error flag if the reply is broken in the middle of transfer.
Definition: ID2_Reply_.hpp:449
TGet_blob_seq_ids & SetGet_blob_seq_ids(void)
Select the variant.
Definition: ID2_Reply_.cpp:214
TReply & SetReply(void)
Assign a value to Reply data member.
Definition: ID2_Reply_.hpp:949
const TGet_blob_seq_ids & GetGet_blob_seq_ids(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:208
list< CRef< CID2_Error > > m_Error
Definition: ID2_Reply_.hpp:695
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: ID2_Reply_.cpp:66
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: ID2_Reply_.cpp:137
CID2_Params TParams
Definition: ID2_Reply_.hpp:460
const TReget_blob & GetReget_blob(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:252
const TGet_package & GetGet_package(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:142
const TGet_chunk & GetGet_chunk(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:296
const TGet_seq_id & GetGet_seq_id(void) const
Get the variant data.
Definition: ID2_Reply_.cpp:164
TGet_package & SetGet_package(void)
Select the variant.
Definition: ID2_Reply_.cpp:148
void ResetError(void)
Reset Error data member.
Definition: ID2_Reply_.cpp:380
void ResetDiscard(void)
Reset Discard data member.
Definition: ID2_Reply_.hpp:970
TGet_blob & SetGet_blob(void)
Select the variant.
Definition: ID2_Reply_.cpp:236
CRef< TReply > m_Reply
Definition: ID2_Reply_.hpp:696
Uint4 m_set_State[1]
Definition: ID2_Reply_.hpp:692
static const char *const sm_SelectionNames[]
Definition: ID2_Reply_.hpp:439
CRef< TParams > m_Params
Definition: ID2_Reply_.hpp:694
virtual ~CID2_Reply_Base(void)
Definition: ID2_Reply_.cpp:436
TGet_split_info & SetGet_split_info(void)
Select the variant.
Definition: ID2_Reply_.cpp:280
@ e_not_set
No variant selected.
Definition: ID2_Reply_.hpp:122
@ eDiscard_nothing
all data in embedded ID2-Reply-Data is correct, but is incomplete
Definition: ID2_Reply_.hpp:452
@ eDiscard_last_octet_string
all data in embedded ID2-Reply-Data except last OCTET STRING is correct
Definition: ID2_Reply_.hpp:451
@ eDiscard_reply
whole reply should be discarded
Definition: ID2_Reply_.hpp:450
@ 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:34 2024 by modify_doxy.py rev. 669887