NCBI C++ ToolKit
CDD_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  * 'cdd_access.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_choice != e_not_set )
56 }
57 
59 {
60  switch ( m_choice ) {
61  case e_Get_blob_by_seq_ids:
62  m_Get_blob_by_seq_ids.Destruct();
63  break;
64  case e_Get_blob_id:
65  case e_Get_blob:
66  case e_Get_blob_by_seq_id:
67  m_object->RemoveReference();
68  break;
69  default:
70  break;
71  }
72  m_choice = e_not_set;
73 }
74 
75 void CCDD_Request_Base::C_Request::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
76 {
77  switch ( index ) {
78  case e_Get_blob_id:
79  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
80  break;
81  case e_Get_blob:
82  (m_object = new(pool) ncbi::objects::CID2_Blob_Id())->AddReference();
83  break;
84  case e_Get_blob_by_seq_id:
85  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
86  break;
87  case e_Get_blob_by_seq_ids:
88  m_Get_blob_by_seq_ids.Construct();
89  break;
90  default:
91  break;
92  }
93  m_choice = index;
94 }
95 
97  "not set",
98  "get-blob-id",
99  "get-blob",
100  "get-blob-by-seq-id",
101  "get-blob-by-seq-ids"
102 };
103 
105 {
106  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
107 }
108 
110 {
111  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
112 }
113 
115 {
116  CheckSelected(e_Get_blob_id);
117  return *static_cast<const TGet_blob_id*>(m_object);
118 }
119 
121 {
122  Select(e_Get_blob_id, NCBI_NS_NCBI::eDoNotResetVariant);
123  return *static_cast<TGet_blob_id*>(m_object);
124 }
125 
127 {
128  TGet_blob_id* ptr = &value;
129  if ( m_choice != e_Get_blob_id || m_object != ptr ) {
130  ResetSelection();
131  (m_object = ptr)->AddReference();
132  m_choice = e_Get_blob_id;
133  }
134 }
135 
137 {
138  CheckSelected(e_Get_blob);
139  return *static_cast<const TGet_blob*>(m_object);
140 }
141 
143 {
144  Select(e_Get_blob, NCBI_NS_NCBI::eDoNotResetVariant);
145  return *static_cast<TGet_blob*>(m_object);
146 }
147 
149 {
150  TGet_blob* ptr = &value;
151  if ( m_choice != e_Get_blob || m_object != ptr ) {
152  ResetSelection();
153  (m_object = ptr)->AddReference();
154  m_choice = e_Get_blob;
155  }
156 }
157 
159 {
160  CheckSelected(e_Get_blob_by_seq_id);
161  return *static_cast<const TGet_blob_by_seq_id*>(m_object);
162 }
163 
165 {
166  Select(e_Get_blob_by_seq_id, NCBI_NS_NCBI::eDoNotResetVariant);
167  return *static_cast<TGet_blob_by_seq_id*>(m_object);
168 }
169 
171 {
172  TGet_blob_by_seq_id* ptr = &value;
173  if ( m_choice != e_Get_blob_by_seq_id || m_object != ptr ) {
174  ResetSelection();
175  (m_object = ptr)->AddReference();
176  m_choice = e_Get_blob_by_seq_id;
177  }
178 }
179 
180 // helper methods
181 
182 // type info
184 {
185  SET_INTERNAL_NAME("CDD-Request", "request");
186  SET_CHOICE_MODULE("NCBI-CDDAccess");
187  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-id", m_object, CSeq_id);
188  ADD_NAMED_REF_CHOICE_VARIANT("get-blob", m_object, CID2_Blob_Id);
189  ADD_NAMED_REF_CHOICE_VARIANT("get-blob-by-seq-id", m_object, CSeq_id);
190  ADD_NAMED_BUF_CHOICE_VARIANT("get-blob-by-seq-ids", m_Get_blob_by_seq_ids, STL_list, (STL_CRef, (CLASS, (CSeq_id))));
191  info->CodeVersion(22400);
192  info->DataSpec(ncbi::EDataSpec::eASN);
193 }
195 
196 // constructor
198  : m_choice(e_not_set)
199 {
200 }
201 
202 // destructor
204 {
205  Reset();
206 }
207 
208 
210 {
211  if ( !m_Request ) {
212  m_Request.Reset(new TRequest());
213  return;
214  }
215  (*m_Request).Reset();
216 }
217 
219 {
220  m_Request.Reset(&value);
221 }
222 
224 {
226  ResetRequest();
227 }
228 
230 {
231  SET_CLASS_MODULE("NCBI-CDDAccess");
232  ADD_NAMED_STD_MEMBER("serial-number", m_Serial_number)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
233  ADD_NAMED_REF_MEMBER("request", m_Request, C_Request);
234  info->RandomOrder();
235  info->CodeVersion(22400);
236  info->DataSpec(ncbi::EDataSpec::eASN);
237 }
239 
240 // constructor
242  : m_Serial_number(0)
243 {
244  memset(m_set_State,0,sizeof(m_set_State));
245  if ( !IsAllocatedInPool() ) {
246  ResetRequest();
247  }
248 }
249 
250 // destructor
252 {
253 }
254 
255 
256 
257 END_objects_SCOPE // namespace ncbi::objects::
258 
260 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("CDD-Request", CCDD_Request)
BEGIN_NAMED_CHOICE_INFO("", CCDD_Request_Base::C_Request)
User-defined methods of the data storage class.
CCDD_Request –.
Definition: CDD_Request.hpp:66
CID2_Blob_Id –.
Definition: ID2_Blob_Id.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_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
const TGet_blob & GetGet_blob(void) const
Get the variant data.
const TGet_blob_id & GetGet_blob_id(void) const
Get the variant data.
TGet_blob_by_seq_id & SetGet_blob_by_seq_id(void)
Select the variant.
CRef< TRequest > m_Request
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
static const char *const sm_SelectionNames[]
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void ResetSerial_number(void)
Reset Serial_number data member.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TRequest & SetRequest(void)
Assign a value to Request data member.
virtual ~CCDD_Request_Base(void)
void ResetSelection(void)
Reset the selection (set it to e_not_set).
void Reset(void)
Reset the whole object.
TGet_blob_id & SetGet_blob_id(void)
Select the variant.
void ResetRequest(void)
Reset Request data member.
TGet_blob & SetGet_blob(void)
Select the variant.
const TGet_blob_by_seq_id & GetGet_blob_by_seq_id(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
@ 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 Sat Jun 08 14:23:29 2024 by modify_doxy.py rev. 669887