NCBI C++ ToolKit
T3Request_.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  * 'taxon3.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_Name:
62  m_string.Destruct();
63  break;
64  case e_Org:
65  case e_Join:
66  m_object->RemoveReference();
67  break;
68  default:
69  break;
70  }
72 }
73 
74 void CT3Request_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
75 {
76  switch ( index ) {
77  case e_Taxid:
78  m_Taxid = 0;
79  break;
80  case e_Org:
81  (m_object = new(pool) ncbi::objects::COrg_ref())->AddReference();
82  break;
83  case e_Join:
84  (m_object = new(pool) ncbi::objects::CSequenceOfInt())->AddReference();
85  break;
86  case e_Name:
87  m_string.Construct();
88  break;
89  default:
90  break;
91  }
92  m_choice = index;
93 }
94 
95 const char* const CT3Request_Base::sm_SelectionNames[] = {
96  "not set",
97  "taxid",
98  "name",
99  "org",
100  "join"
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 {
116  *m_string = value;
117 }
118 
120 {
122  return *static_cast<const TOrg*>(m_object);
123 }
124 
126 {
128  return *static_cast<TOrg*>(m_object);
129 }
130 
132 {
133  TOrg* ptr = &value;
134  if ( m_choice != e_Org || m_object != ptr ) {
135  ResetSelection();
136  (m_object = ptr)->AddReference();
137  m_choice = e_Org;
138  }
139 }
140 
142 {
144  return *static_cast<const TJoin*>(m_object);
145 }
146 
148 {
150  return *static_cast<TJoin*>(m_object);
151 }
152 
154 {
155  TJoin* ptr = &value;
156  if ( m_choice != e_Join || m_object != ptr ) {
157  ResetSelection();
158  (m_object = ptr)->AddReference();
159  m_choice = e_Join;
160  }
161 }
162 
163 // helper methods
164 
165 // type info
167 {
168  SET_CHOICE_MODULE("NCBI-Taxon3");
169  ADD_NAMED_STD_CHOICE_VARIANT("taxid", m_Taxid);
170  ADD_NAMED_BUF_CHOICE_VARIANT("name", m_string, STD, (string));
171  ADD_NAMED_REF_CHOICE_VARIANT("org", m_object, COrg_ref);
172  ADD_NAMED_REF_CHOICE_VARIANT("join", m_object, CSequenceOfInt);
173  info->CodeVersion(22400);
174  info->DataSpec(ncbi::EDataSpec::eASN);
175 }
177 
178 // constructor
180  : m_choice(e_not_set)
181 {
182 }
183 
184 // destructor
186 {
187  Reset();
188 }
189 
190 
191 
192 END_objects_SCOPE // namespace ncbi::objects::
193 
195 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("T3Request", CT3Request)
Definition: T3Request_.cpp:166
CSequenceOfInt –.
CT3Request –.
Definition: T3Request.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 ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#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
#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 CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: T3Request_.hpp:300
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: T3Request_.cpp:74
E_Choice m_choice
Definition: T3Request_.hpp:271
TName & SetName(void)
Select the variant.
Definition: T3Request_.hpp:363
TJoin & SetJoin(void)
Select the variant.
Definition: T3Request_.cpp:147
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
NCBI_NS_NCBI::CSerialObject * m_object
Definition: T3Request_.hpp:280
TOrg & SetOrg(void)
Select the variant.
Definition: T3Request_.cpp:125
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: T3Request_.hpp:279
virtual ~CT3Request_Base(void)
Definition: T3Request_.cpp:185
const TOrg & GetOrg(void) const
Get the variant data.
Definition: T3Request_.cpp:119
static const char *const sm_SelectionNames[]
Definition: T3Request_.hpp:275
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: T3Request_.cpp:58
virtual void Reset(void)
Reset the whole object.
Definition: T3Request_.cpp:52
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: T3Request_.cpp:103
E_Choice
Choice variants.
Definition: T3Request_.hpp:91
const TJoin & GetJoin(void) const
Get the variant data.
Definition: T3Request_.cpp:141
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: T3Request_.cpp:108
@ e_not_set
No variant selected.
Definition: T3Request_.hpp:92
@ 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 Mon May 20 05:06:12 2024 by modify_doxy.py rev. 669887