NCBI C++ ToolKit
Annotdesc_.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  * 'seq.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
43 #include <objects/general/Date.hpp>
46 #include <objects/seq/Pubdesc.hpp>
50 
51 BEGIN_objects_SCOPE // namespace ncbi::objects::
52 
53 
54 // generated classes
55 
57 {
58  if ( m_choice != e_not_set )
60 }
61 
63 {
64  switch ( m_choice ) {
65  case e_Name:
66  case e_Title:
67  case e_Comment:
68  m_string.Destruct();
69  break;
70  case e_Pub:
71  case e_User:
72  case e_Create_date:
73  case e_Update_date:
74  case e_Src:
75  case e_Align:
76  case e_Region:
77  m_object->RemoveReference();
78  break;
79  default:
80  break;
81  }
83 }
84 
85 void CAnnotdesc_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
86 {
87  switch ( index ) {
88  case e_Pub:
89  (m_object = new(pool) ncbi::objects::CPubdesc())->AddReference();
90  break;
91  case e_User:
92  (m_object = new(pool) ncbi::objects::CUser_object())->AddReference();
93  break;
94  case e_Create_date:
95  (m_object = new(pool) ncbi::objects::CDate())->AddReference();
96  break;
97  case e_Update_date:
98  (m_object = new(pool) ncbi::objects::CDate())->AddReference();
99  break;
100  case e_Src:
101  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
102  break;
103  case e_Align:
104  (m_object = new(pool) ncbi::objects::CAlign_def())->AddReference();
105  break;
106  case e_Region:
107  (m_object = new(pool) ncbi::objects::CSeq_loc())->AddReference();
108  break;
109  case e_Name:
110  case e_Title:
111  case e_Comment:
112  m_string.Construct();
113  break;
114  default:
115  break;
116  }
117  m_choice = index;
118 }
119 
120 const char* const CAnnotdesc_Base::sm_SelectionNames[] = {
121  "not set",
122  "name",
123  "title",
124  "comment",
125  "pub",
126  "user",
127  "create-date",
128  "update-date",
129  "src",
130  "align",
131  "region"
132 };
133 
135 {
136  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
137 }
138 
140 {
141  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
142 }
143 
145 {
147  *m_string = value;
148 }
149 
151 {
153  *m_string = value;
154 }
155 
157 {
159  *m_string = value;
160 }
161 
163 {
165  return *static_cast<const TPub*>(m_object);
166 }
167 
169 {
171  return *static_cast<TPub*>(m_object);
172 }
173 
175 {
176  TPub* ptr = &value;
177  if ( m_choice != e_Pub || m_object != ptr ) {
178  ResetSelection();
179  (m_object = ptr)->AddReference();
180  m_choice = e_Pub;
181  }
182 }
183 
185 {
187  return *static_cast<const TUser*>(m_object);
188 }
189 
191 {
193  return *static_cast<TUser*>(m_object);
194 }
195 
197 {
198  TUser* ptr = &value;
199  if ( m_choice != e_User || m_object != ptr ) {
200  ResetSelection();
201  (m_object = ptr)->AddReference();
202  m_choice = e_User;
203  }
204 }
205 
207 {
209  return *static_cast<const TCreate_date*>(m_object);
210 }
211 
213 {
215  return *static_cast<TCreate_date*>(m_object);
216 }
217 
219 {
220  TCreate_date* ptr = &value;
221  if ( m_choice != e_Create_date || m_object != ptr ) {
222  ResetSelection();
223  (m_object = ptr)->AddReference();
225  }
226 }
227 
229 {
231  return *static_cast<const TUpdate_date*>(m_object);
232 }
233 
235 {
237  return *static_cast<TUpdate_date*>(m_object);
238 }
239 
241 {
242  TUpdate_date* ptr = &value;
243  if ( m_choice != e_Update_date || m_object != ptr ) {
244  ResetSelection();
245  (m_object = ptr)->AddReference();
247  }
248 }
249 
251 {
253  return *static_cast<const TSrc*>(m_object);
254 }
255 
257 {
259  return *static_cast<TSrc*>(m_object);
260 }
261 
263 {
264  TSrc* ptr = &value;
265  if ( m_choice != e_Src || m_object != ptr ) {
266  ResetSelection();
267  (m_object = ptr)->AddReference();
268  m_choice = e_Src;
269  }
270 }
271 
273 {
275  return *static_cast<const TAlign*>(m_object);
276 }
277 
279 {
281  return *static_cast<TAlign*>(m_object);
282 }
283 
285 {
286  TAlign* ptr = &value;
287  if ( m_choice != e_Align || m_object != ptr ) {
288  ResetSelection();
289  (m_object = ptr)->AddReference();
290  m_choice = e_Align;
291  }
292 }
293 
295 {
297  return *static_cast<const TRegion*>(m_object);
298 }
299 
301 {
303  return *static_cast<TRegion*>(m_object);
304 }
305 
307 {
308  TRegion* ptr = &value;
309  if ( m_choice != e_Region || m_object != ptr ) {
310  ResetSelection();
311  (m_object = ptr)->AddReference();
312  m_choice = e_Region;
313  }
314 }
315 
316 // helper methods
317 
318 // type info
320 {
321  SET_CHOICE_MODULE("NCBI-Sequence");
322  ADD_NAMED_BUF_CHOICE_VARIANT("name", m_string, STD, (string));
323  ADD_NAMED_BUF_CHOICE_VARIANT("title", m_string, STD, (string));
324  ADD_NAMED_BUF_CHOICE_VARIANT("comment", m_string, STD, (string));
325  ADD_NAMED_REF_CHOICE_VARIANT("pub", m_object, CPubdesc);
326  ADD_NAMED_REF_CHOICE_VARIANT("user", m_object, CUser_object);
327  ADD_NAMED_REF_CHOICE_VARIANT("create-date", m_object, CDate);
328  ADD_NAMED_REF_CHOICE_VARIANT("update-date", m_object, CDate);
329  ADD_NAMED_REF_CHOICE_VARIANT("src", m_object, CSeq_id);
330  ADD_NAMED_REF_CHOICE_VARIANT("align", m_object, CAlign_def);
331  ADD_NAMED_REF_CHOICE_VARIANT("region", m_object, CSeq_loc);
332  info->CodeVersion(22301);
333  info->DataSpec(ncbi::EDataSpec::eASN);
334 }
336 
337 // constructor
339  : m_choice(e_not_set)
340 {
341 }
342 
343 // destructor
345 {
346  Reset();
347 }
348 
349 
350 
351 END_objects_SCOPE // namespace ncbi::objects::
352 
354 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Annotdesc", CAnnotdesc)
Definition: Annotdesc_.cpp:319
CAlign_def –.
Definition: Align_def.hpp:66
CAnnotdesc –.
Definition: Annotdesc.hpp:66
Definition: Date.hpp:53
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
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
#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
const TCreate_date & GetCreate_date(void) const
Get the variant data.
Definition: Annotdesc_.cpp:206
virtual ~CAnnotdesc_Base(void)
Definition: Annotdesc_.cpp:344
TTitle & SetTitle(void)
Select the variant.
Definition: Annotdesc_.hpp:528
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Annotdesc_.hpp:452
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Annotdesc_.hpp:472
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Annotdesc_.cpp:134
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Annotdesc_.cpp:139
TName & SetName(void)
Select the variant.
Definition: Annotdesc_.hpp:508
TPub & SetPub(void)
Select the variant.
Definition: Annotdesc_.cpp:168
TUser & SetUser(void)
Select the variant.
Definition: Annotdesc_.cpp:190
const TUser & GetUser(void) const
Get the variant data.
Definition: Annotdesc_.cpp:184
TComment & SetComment(void)
Select the variant.
Definition: Annotdesc_.hpp:548
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TRegion & SetRegion(void)
Select the variant.
Definition: Annotdesc_.cpp:300
TAlign & SetAlign(void)
Select the variant.
Definition: Annotdesc_.cpp:278
const TRegion & GetRegion(void) const
Get the variant data.
Definition: Annotdesc_.cpp:294
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Annotdesc_.cpp:85
const TPub & GetPub(void) const
Get the variant data.
Definition: Annotdesc_.cpp:162
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Annotdesc_.cpp:62
const TUpdate_date & GetUpdate_date(void) const
Get the variant data.
Definition: Annotdesc_.cpp:228
E_Choice
Choice variants.
Definition: Annotdesc_.hpp:95
const TSrc & GetSrc(void) const
Get the variant data.
Definition: Annotdesc_.cpp:250
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Annotdesc_.hpp:451
TUpdate_date & SetUpdate_date(void)
Select the variant.
Definition: Annotdesc_.cpp:234
E_Choice m_choice
Definition: Annotdesc_.hpp:444
TCreate_date & SetCreate_date(void)
Select the variant.
Definition: Annotdesc_.cpp:212
const TAlign & GetAlign(void) const
Get the variant data.
Definition: Annotdesc_.cpp:272
TSrc & SetSrc(void)
Select the variant.
Definition: Annotdesc_.cpp:256
virtual void Reset(void)
Reset the whole object.
Definition: Annotdesc_.cpp:56
static const char *const sm_SelectionNames[]
Definition: Annotdesc_.hpp:448
@ e_Comment
a more extensive comment
Definition: Annotdesc_.hpp:99
@ e_Pub
a reference to the publication
Definition: Annotdesc_.hpp:100
@ e_Align
definition of the SeqAligns
Definition: Annotdesc_.hpp:105
@ e_Region
all contents cover this region
Definition: Annotdesc_.hpp:106
@ e_Update_date
date of last update
Definition: Annotdesc_.hpp:103
@ e_Create_date
date entry first created/released
Definition: Annotdesc_.hpp:102
@ e_Name
a short name for this collection
Definition: Annotdesc_.hpp:97
@ e_Title
a title for this collection
Definition: Annotdesc_.hpp:98
@ e_User
user defined object
Definition: Annotdesc_.hpp:101
@ e_Src
source sequence from which annot came
Definition: Annotdesc_.hpp:104
@ e_not_set
No variant selected.
Definition: Annotdesc_.hpp:96
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Wed Mar 27 11:20:16 2024 by modify_doxy.py rev. 669887