NCBI C++ ToolKit
Affil_.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  * 'biblio.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
42 #include <objects/biblio/Affil.hpp>
44 
45 BEGIN_objects_SCOPE // namespace ncbi::objects::
46 
47 
48 // generated classes
49 
51 {
52  m_Affil.erase();
53  m_set_State[0] &= ~0x3;
54 }
55 
57 {
58  m_Div.erase();
59  m_set_State[0] &= ~0xc;
60 }
61 
63 {
64  m_City.erase();
65  m_set_State[0] &= ~0x30;
66 }
67 
69 {
70  m_Sub.erase();
71  m_set_State[0] &= ~0xc0;
72 }
73 
75 {
76  m_Country.erase();
77  m_set_State[0] &= ~0x300;
78 }
79 
81 {
82  m_Street.erase();
83  m_set_State[0] &= ~0xc00;
84 }
85 
87 {
88  m_Email.erase();
89  m_set_State[0] &= ~0x3000;
90 }
91 
93 {
94  m_Fax.erase();
95  m_set_State[0] &= ~0xc000;
96 }
97 
99 {
100  m_Phone.erase();
101  m_set_State[0] &= ~0x30000;
102 }
103 
105 {
106  m_Postal_code.erase();
107  m_set_State[0] &= ~0xc0000;
108 }
109 
111 {
112  ResetAffil();
113  ResetDiv();
114  ResetCity();
115  ResetSub();
116  ResetCountry();
117  ResetStreet();
118  ResetEmail();
119  ResetFax();
120  ResetPhone();
121  ResetPostal_code();
122 }
123 
125 {
126  SET_INTERNAL_NAME("Affil", "std");
127  SET_CLASS_MODULE("NCBI-Biblio");
128  ADD_NAMED_STD_MEMBER("affil", m_Affil)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
129  ADD_NAMED_STD_MEMBER("div", m_Div)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
130  ADD_NAMED_STD_MEMBER("city", m_City)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
131  ADD_NAMED_STD_MEMBER("sub", m_Sub)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
132  ADD_NAMED_STD_MEMBER("country", m_Country)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
133  ADD_NAMED_STD_MEMBER("street", m_Street)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
134  ADD_NAMED_STD_MEMBER("email", m_Email)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
135  ADD_NAMED_STD_MEMBER("fax", m_Fax)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
136  ADD_NAMED_STD_MEMBER("phone", m_Phone)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
137  ADD_NAMED_STD_MEMBER("postal-code", m_Postal_code)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
138  info->RandomOrder();
139  info->CodeVersion(22400);
140  info->DataSpec(ncbi::EDataSpec::eASN);
141 }
143 
144 // constructor
146 {
147  memset(m_set_State,0,sizeof(m_set_State));
148 }
149 
150 // destructor
152 {
153 }
154 
155 
157 {
158  if ( m_choice != e_not_set )
159  ResetSelection();
160 }
161 
163 {
164  switch ( m_choice ) {
165  case e_Str:
166  m_string.Destruct();
167  break;
168  case e_Std:
169  m_object->RemoveReference();
170  break;
171  default:
172  break;
173  }
175 }
176 
177 void CAffil_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
178 {
179  switch ( index ) {
180  case e_Std:
181  (m_object = new(pool) C_Std())->AddReference();
182  break;
183  case e_Str:
184  m_string.Construct();
185  break;
186  default:
187  break;
188  }
189  m_choice = index;
190 }
191 
192 const char* const CAffil_Base::sm_SelectionNames[] = {
193  "not set",
194  "str",
195  "std"
196 };
197 
199 {
200  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
201 }
202 
204 {
205  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
206 }
207 
209 {
211  *m_string = value;
212 }
213 
215 {
217  return *static_cast<const TStd*>(m_object);
218 }
219 
221 {
223  return *static_cast<TStd*>(m_object);
224 }
225 
227 {
228  TStd* ptr = &value;
229  if ( m_choice != e_Std || m_object != ptr ) {
230  ResetSelection();
231  (m_object = ptr)->AddReference();
232  m_choice = e_Std;
233  }
234 }
235 
236 // helper methods
237 
238 // type info
240 {
241  SET_CHOICE_MODULE("NCBI-Biblio");
242  ADD_NAMED_BUF_CHOICE_VARIANT("str", m_string, STD, (string));
243  ADD_NAMED_REF_CHOICE_VARIANT("std", m_object, C_Std);
244  info->CodeVersion(22400);
245  info->DataSpec(ncbi::EDataSpec::eASN);
246 }
248 
249 // constructor
252 {
253 }
254 
255 // destructor
257 {
258  Reset();
259 }
260 
261 
262 
263 END_objects_SCOPE // namespace ncbi::objects::
264 
266 
BEGIN_NAMED_CLASS_INFO("", CAffil_Base::C_Std)
Definition: Affil_.cpp:124
BEGIN_NAMED_BASE_CHOICE_INFO("Affil", CAffil)
Definition: Affil_.cpp:239
std representation
Definition: Affil_.hpp:91
@Affil.hpp User-defined methods of the data storage class.
Definition: Affil.hpp:56
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 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
#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 ResetDiv(void)
Reset Div data member.
Definition: Affil_.cpp:56
void ResetAffil(void)
Reset Affil data member.
Definition: Affil_.cpp:50
void ResetSub(void)
Reset Sub data member.
Definition: Affil_.cpp:68
virtual ~CAffil_Base(void)
Definition: Affil_.cpp:256
static const char *const sm_SelectionNames[]
Definition: Affil_.hpp:670
void ResetEmail(void)
Reset Email data member.
Definition: Affil_.cpp:86
void Reset(void)
Reset the whole object.
Definition: Affil_.cpp:110
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Affil_.cpp:177
void ResetCity(void)
Reset City data member.
Definition: Affil_.cpp:62
TStr & SetStr(void)
Select the variant.
Definition: Affil_.hpp:1200
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Affil_.hpp:1164
void ResetStreet(void)
Reset Street data member.
Definition: Affil_.cpp:80
CAffil_Base(void)
Definition: Affil_.cpp:250
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Affil_.cpp:203
string TStr
Definition: Affil_.hpp:601
const TStd & GetStd(void) const
Get the variant data.
Definition: Affil_.cpp:214
E_Choice m_choice
Definition: Affil_.hpp:666
E_Choice
Choice variants.
Definition: Affil_.hpp:543
void ResetPostal_code(void)
Reset Postal_code data member.
Definition: Affil_.cpp:104
virtual void Reset(void)
Reset the whole object.
Definition: Affil_.cpp:156
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Affil_.cpp:162
void ResetFax(void)
Reset Fax data member.
Definition: Affil_.cpp:92
Uint4 m_set_State[1]
Definition: Affil_.hpp:529
void ResetPhone(void)
Reset Phone data member.
Definition: Affil_.cpp:98
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Affil_.cpp:198
void ResetCountry(void)
Reset Country data member.
Definition: Affil_.cpp:74
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Affil_.hpp:673
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TStd & SetStd(void)
Select the variant.
Definition: Affil_.cpp:220
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Affil_.hpp:674
@ e_not_set
No variant selected.
Definition: Affil_.hpp:544
@ e_Str
unparsed string
Definition: Affil_.hpp:545
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue Apr 23 07:37:57 2024 by modify_doxy.py rev. 669887