NCBI C++ ToolKit
GCClientRequest_.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  * 'gencoll_client.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 ) {
67  m_object->RemoveReference();
68  break;
69  default:
70  break;
71  }
73 }
74 
75 void CGCClientRequest_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
76 {
77  switch ( index ) {
79  (m_object = new(pool) ncbi::objects::CGCClient_ValidateChrTypeLocRequest())->AddReference();
80  break;
82  (m_object = new(pool) ncbi::objects::CGCClient_GetEquivalentAssembliesRequest())->AddReference();
83  break;
85  (m_object = new(pool) ncbi::objects::CGCClient_GetAssemblyBlobRequest())->AddReference();
86  break;
88  (m_object = new(pool) ncbi::objects::CGCClient_GetAssemblyBySequenceRequest())->AddReference();
89  break;
90  default:
91  break;
92  }
93  m_choice = index;
94 }
95 
96 const char* const CGCClientRequest_Base::sm_SelectionNames[] = {
97  "not set",
98  "get-chrtype-valid",
99  "get-equivalent-assemblies",
100  "get-assembly-blob",
101  "get-assembly-by-sequence"
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 {
117  return *static_cast<const TGet_chrtype_valid*>(m_object);
118 }
119 
121 {
123  return *static_cast<TGet_chrtype_valid*>(m_object);
124 }
125 
127 {
128  TGet_chrtype_valid* ptr = &value;
129  if ( m_choice != e_Get_chrtype_valid || m_object != ptr ) {
130  ResetSelection();
131  (m_object = ptr)->AddReference();
133  }
134 }
135 
137 {
139  return *static_cast<const TGet_equivalent_assemblies*>(m_object);
140 }
141 
143 {
145  return *static_cast<TGet_equivalent_assemblies*>(m_object);
146 }
147 
149 {
151  if ( m_choice != e_Get_equivalent_assemblies || m_object != ptr ) {
152  ResetSelection();
153  (m_object = ptr)->AddReference();
155  }
156 }
157 
159 {
161  return *static_cast<const TGet_assembly_blob*>(m_object);
162 }
163 
165 {
167  return *static_cast<TGet_assembly_blob*>(m_object);
168 }
169 
171 {
172  TGet_assembly_blob* ptr = &value;
173  if ( m_choice != e_Get_assembly_blob || m_object != ptr ) {
174  ResetSelection();
175  (m_object = ptr)->AddReference();
177  }
178 }
179 
181 {
183  return *static_cast<const TGet_assembly_by_sequence*>(m_object);
184 }
185 
187 {
189  return *static_cast<TGet_assembly_by_sequence*>(m_object);
190 }
191 
193 {
195  if ( m_choice != e_Get_assembly_by_sequence || m_object != ptr ) {
196  ResetSelection();
197  (m_object = ptr)->AddReference();
199  }
200 }
201 
202 // helper methods
203 
204 // type info
206 {
207  SET_CHOICE_MODULE("NCBI-GencollClient");
209  ADD_NAMED_REF_CHOICE_VARIANT("get-equivalent-assemblies", m_object, CGCClient_GetEquivalentAssembliesRequest);
210  ADD_NAMED_REF_CHOICE_VARIANT("get-assembly-blob", m_object, CGCClient_GetAssemblyBlobRequest);
211  ADD_NAMED_REF_CHOICE_VARIANT("get-assembly-by-sequence", m_object, CGCClient_GetAssemblyBySequenceRequest);
212  info->CodeVersion(22301);
213  info->DataSpec(ncbi::EDataSpec::eASN);
214 }
216 
217 // constructor
219  : m_choice(e_not_set)
220 {
221 }
222 
223 // destructor
225 {
226  Reset();
227 }
228 
229 
230 
231 END_objects_SCOPE // namespace ncbi::objects::
232 
234 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("GCClientRequest", CGCClientRequest)
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.
CGCClientRequest –.
CGCClient_GetAssemblyBlobRequest –.
CGCClient_GetEquivalentAssembliesRequest –.
CGCClient_ValidateChrTypeLocRequest –.
char value[7]
Definition: config.c:431
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 ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
virtual ~CGCClientRequest_Base(void)
const TGet_assembly_by_sequence & GetGet_assembly_by_sequence(void) const
Get the variant data.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
static const char *const sm_SelectionNames[]
NCBI_NS_NCBI::CSerialObject * m_object
const TGet_assembly_blob & GetGet_assembly_blob(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
E_Choice
Choice variants.
TGet_chrtype_valid & SetGet_chrtype_valid(void)
Select the variant.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
const TGet_chrtype_valid & GetGet_chrtype_valid(void) const
Get the variant data.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TGet_equivalent_assemblies & SetGet_equivalent_assemblies(void)
Select the variant.
TGet_assembly_by_sequence & SetGet_assembly_by_sequence(void)
Select the variant.
TGet_assembly_blob & SetGet_assembly_blob(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TGet_equivalent_assemblies & GetGet_equivalent_assemblies(void) const
Get the variant data.
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Thu Dec 07 10:09:41 2023 by modify_doxy.py rev. 669887