NCBI C++ ToolKit
U_.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  * 'efetch.xsd'.
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
43 BEGIN_eutils_SCOPE // namespace eutils::
44 
45 
46 // generated classes
47 
49 {
50  if ( m_choice != e_not_set )
52 }
53 
55 {
56  switch ( m_choice ) {
57  case e__CharData:
58  m_string.Destruct();
59  break;
60  case e_Text:
61  m_object->RemoveReference();
62  break;
63  default:
64  break;
65  }
66  m_choice = e_not_set;
67 }
68 
69 void CU_Base::C_E::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
70 {
71  switch ( index ) {
72  case e_Text:
73  (m_object = new(pool) eutils::CText())->AddReference();
74  break;
75  case e__CharData:
76  m_string.Construct();
77  break;
78  default:
79  break;
80  }
81  m_choice = index;
82 }
83 
84 const char* const CU_Base::C_E::sm_SelectionNames[] = {
85  "not set",
86  "-CharData",
87  "text"
88 };
89 
91 {
92  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
93 }
94 
96 {
97  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
98 }
99 
101 {
102  Select(e__CharData, NCBI_NS_NCBI::eDoNotResetVariant);
103  *m_string = value;
104 }
105 
107 {
108  CheckSelected(e_Text);
109  return *static_cast<const TText*>(m_object);
110 }
111 
113 {
114  Select(e_Text, NCBI_NS_NCBI::eDoNotResetVariant);
115  return *static_cast<TText*>(m_object);
116 }
117 
119 {
120  TText* ptr = &value;
121  if ( m_choice != e_Text || m_object != ptr ) {
122  ResetSelection();
123  (m_object = ptr)->AddReference();
124  m_choice = e_Text;
125  }
126 }
127 
128 // helper methods
129 
130 // type info
132 {
133  SET_INTERNAL_NAME("u", "E");
134  SET_CHOICE_MODULE("efetch");
135  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
136  ADD_NAMED_BUF_CHOICE_VARIANT("-CharData", m_string, STD, (NCBI_NS_STD::string))->SetNotag();
137  ADD_NAMED_REF_CHOICE_VARIANT("text", m_object, C_Text)->SetNotag();
138  info->CodeVersion(22400);
139  info->DataSpec(ncbi::EDataSpec::eXSD);
140 }
142 
143 // constructor
145  : m_choice(e_not_set)
146 {
147 }
148 
149 // destructor
151 {
152  Reset();
153 }
154 
155 
156 void CU_Base::Reset(void)
157 {
158  m_data.clear();
159  m_set_State[0] &= ~0x3;
160 }
161 
163 {
164  SET_CLASS_MODULE("efetch");
165  SET_NAMESPACE("http://www.ncbi.nlm.nih.gov")->SetNsQualified(true);
166  ADD_NAMED_MEMBER("", m_data, STL_list, (STL_CRef, (CLASS, (C_E))))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
167  info->RandomOrder();
168  info->CodeVersion(22400);
169  info->DataSpec(ncbi::EDataSpec::eXSD);
170 }
172 
173 // constructor
175 {
176  memset(m_set_State,0,sizeof(m_set_State));
177 }
178 
179 // destructor
181 {
182 }
183 
184 
185 
186 END_eutils_SCOPE // namespace eutils::
187 
#define BEGIN_eutils_SCOPE
Definition: Abstract_.hpp:51
#define END_eutils_SCOPE
Definition: Abstract_.hpp:52
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_IMPLICIT_CLASS_INFO("u", CU)
Definition: U_.cpp:162
BEGIN_NAMED_CHOICE_INFO("", CU_Base::C_E)
Definition: U_.cpp:131
CText –.
Definition: Text.hpp:64
C_E –.
Definition: U_.hpp:91
CU –.
Definition: U.hpp:64
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_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define SET_NAMESPACE(name)
Definition: serialimpl.hpp:450
#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
NCBI_NS_STD::list< NCBI_NS_NCBI::CRef< C_E > > m_data
Definition: U_.hpp:290
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: U_.cpp:54
E_Choice
Choice variants.
Definition: U_.hpp:105
void Reset(void)
Reset data member.
Definition: U_.cpp:156
~C_E(void)
Definition: U_.cpp:150
static const char *const sm_SelectionNames[]
Definition: U_.hpp:232
void DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool *pool=0)
Definition: U_.cpp:69
Uint4 m_set_State[1]
Definition: U_.hpp:289
NCBI_NS_STD::string T_CharData
Definition: U_.hpp:163
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: U_.cpp:95
CU_Base(void)
Definition: U_.cpp:174
E_Choice m_choice
Definition: U_.hpp:228
static NCBI_NS_STD::string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: U_.cpp:90
C_E(void)
Definition: U_.cpp:144
virtual ~CU_Base(void)
Definition: U_.cpp:180
void Reset(void)
Reset the whole object.
Definition: U_.cpp:48
TText & SetText(void)
Select the variant.
Definition: U_.cpp:112
T_CharData & Set_CharData(void)
Select the variant.
Definition: U_.hpp:345
const TText & GetText(void) const
Get the variant data.
Definition: U_.cpp:106
@ e_not_set
No variant selected.
Definition: U_.hpp:106
@ 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 Tue Jun 25 13:30:59 2024 by modify_doxy.py rev. 669887