NCBI C++ ToolKit
Cit_art_.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
48 #include <objects/biblio/Title.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_Journal:
66  case e_Book:
67  case e_Proc:
68  m_object->RemoveReference();
69  break;
70  default:
71  break;
72  }
73  m_choice = e_not_set;
74 }
75 
76 void CCit_art_Base::C_From::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
77 {
78  switch ( index ) {
79  case e_Journal:
80  (m_object = new(pool) ncbi::objects::CCit_jour())->AddReference();
81  break;
82  case e_Book:
83  (m_object = new(pool) ncbi::objects::CCit_book())->AddReference();
84  break;
85  case e_Proc:
86  (m_object = new(pool) ncbi::objects::CCit_proc())->AddReference();
87  break;
88  default:
89  break;
90  }
91  m_choice = index;
92 }
93 
94 const char* const CCit_art_Base::C_From::sm_SelectionNames[] = {
95  "not set",
96  "journal",
97  "book",
98  "proc"
99 };
100 
102 {
103  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
104 }
105 
107 {
108  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
109 }
110 
112 {
113  CheckSelected(e_Journal);
114  return *static_cast<const TJournal*>(m_object);
115 }
116 
118 {
119  Select(e_Journal, NCBI_NS_NCBI::eDoNotResetVariant);
120  return *static_cast<TJournal*>(m_object);
121 }
122 
124 {
125  TJournal* ptr = &value;
126  if ( m_choice != e_Journal || m_object != ptr ) {
127  ResetSelection();
128  (m_object = ptr)->AddReference();
129  m_choice = e_Journal;
130  }
131 }
132 
134 {
135  CheckSelected(e_Book);
136  return *static_cast<const TBook*>(m_object);
137 }
138 
140 {
141  Select(e_Book, NCBI_NS_NCBI::eDoNotResetVariant);
142  return *static_cast<TBook*>(m_object);
143 }
144 
146 {
147  TBook* ptr = &value;
148  if ( m_choice != e_Book || m_object != ptr ) {
149  ResetSelection();
150  (m_object = ptr)->AddReference();
151  m_choice = e_Book;
152  }
153 }
154 
156 {
157  CheckSelected(e_Proc);
158  return *static_cast<const TProc*>(m_object);
159 }
160 
162 {
163  Select(e_Proc, NCBI_NS_NCBI::eDoNotResetVariant);
164  return *static_cast<TProc*>(m_object);
165 }
166 
168 {
169  TProc* ptr = &value;
170  if ( m_choice != e_Proc || m_object != ptr ) {
171  ResetSelection();
172  (m_object = ptr)->AddReference();
173  m_choice = e_Proc;
174  }
175 }
176 
177 // helper methods
178 
179 // type info
181 {
182  SET_INTERNAL_NAME("Cit-art", "from");
183  SET_CHOICE_MODULE("NCBI-Biblio");
184  ADD_NAMED_REF_CHOICE_VARIANT("journal", m_object, CCit_jour);
185  ADD_NAMED_REF_CHOICE_VARIANT("book", m_object, CCit_book);
186  ADD_NAMED_REF_CHOICE_VARIANT("proc", m_object, CCit_proc);
187  info->CodeVersion(22400);
188  info->DataSpec(ncbi::EDataSpec::eASN);
189 }
191 
192 // constructor
194  : m_choice(e_not_set)
195 {
196 }
197 
198 // destructor
200 {
201  Reset();
202 }
203 
204 
206 {
207  m_Title.Reset();
208 }
209 
211 {
212  m_Title.Reset(&value);
213 }
214 
216 {
217  if ( !m_Title )
218  m_Title.Reset(new TTitle());
219  return (*m_Title);
220 }
221 
223 {
224  m_Authors.Reset();
225 }
226 
228 {
229  m_Authors.Reset(&value);
230 }
231 
233 {
234  if ( !m_Authors )
235  m_Authors.Reset(new TAuthors());
236  return (*m_Authors);
237 }
238 
240 {
241  if ( !m_From ) {
242  m_From.Reset(new TFrom());
243  return;
244  }
245  (*m_From).Reset();
246 }
247 
249 {
250  m_From.Reset(&value);
251 }
252 
254 {
255  m_Ids.Reset();
256 }
257 
259 {
260  m_Ids.Reset(&value);
261 }
262 
264 {
265  if ( !m_Ids )
266  m_Ids.Reset(new TIds());
267  return (*m_Ids);
268 }
269 
271 {
272  ResetTitle();
273  ResetAuthors();
274  ResetFrom();
275  ResetIds();
276 }
277 
279 {
280  SET_CLASS_MODULE("NCBI-Biblio");
281  ADD_NAMED_REF_MEMBER("title", m_Title, CTitle)->SetOptional();
282  ADD_NAMED_REF_MEMBER("authors", m_Authors, CAuth_list)->SetOptional();
283  ADD_NAMED_REF_MEMBER("from", m_From, C_From);
284  ADD_NAMED_REF_MEMBER("ids", m_Ids, CArticleIdSet)->SetOptional();
285  info->RandomOrder();
286  info->CodeVersion(22400);
287  info->DataSpec(ncbi::EDataSpec::eASN);
288 }
290 
291 // constructor
293 {
294  memset(m_set_State,0,sizeof(m_set_State));
295  if ( !IsAllocatedInPool() ) {
296  ResetFrom();
297  }
298 }
299 
300 // destructor
302 {
303 }
304 
305 
306 
307 END_objects_SCOPE // namespace ncbi::objects::
308 
310 
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CLASS_INFO("Cit-art", CCit_art)
Definition: Cit_art_.cpp:278
BEGIN_NAMED_CHOICE_INFO("", CCit_art_Base::C_From)
Definition: Cit_art_.cpp:180
CArticleIdSet –.
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
journal or book
Definition: Cit_art_.hpp:98
Definition: Title.hpp:51
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_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#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 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
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
bool IsAllocatedInPool(void) const THROWS_NONE
Check if object is allocated in memory pool (not system heap)
Definition: ncbiobj.hpp:461
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TAuthors & SetAuthors(void)
Assign a value to Authors data member.
Definition: Cit_art_.cpp:232
TFrom & SetFrom(void)
Assign a value to From data member.
Definition: Cit_art_.hpp:576
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Cit_art_.cpp:101
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Cit_art_.cpp:106
const TJournal & GetJournal(void) const
Get the variant data.
Definition: Cit_art_.cpp:111
Uint4 m_set_State[1]
Definition: Cit_art_.hpp:449
virtual ~CCit_art_Base(void)
Definition: Cit_art_.cpp:301
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Cit_art_.cpp:62
void ResetTitle(void)
Reset Title data member.
Definition: Cit_art_.cpp:205
E_Choice
Choice variants.
Definition: Cit_art_.hpp:111
CAuth_list TAuthors
Definition: Cit_art_.hpp:271
virtual void Reset(void)
Reset the whole object.
Definition: Cit_art_.cpp:270
CRef< TTitle > m_Title
Definition: Cit_art_.hpp:450
void ResetFrom(void)
Reset From data member.
Definition: Cit_art_.cpp:239
C_From TFrom
Definition: Cit_art_.hpp:272
TTitle & SetTitle(void)
Assign a value to Title data member.
Definition: Cit_art_.cpp:215
void Reset(void)
Reset the whole object.
Definition: Cit_art_.cpp:56
CRef< TIds > m_Ids
Definition: Cit_art_.hpp:453
TBook & SetBook(void)
Select the variant.
Definition: Cit_art_.cpp:139
CRef< TFrom > m_From
Definition: Cit_art_.hpp:452
const TProc & GetProc(void) const
Get the variant data.
Definition: Cit_art_.cpp:155
static const char *const sm_SelectionNames[]
Definition: Cit_art_.hpp:265
void ResetIds(void)
Reset Ids data member.
Definition: Cit_art_.cpp:253
void ResetAuthors(void)
Reset Authors data member.
Definition: Cit_art_.cpp:222
TProc & SetProc(void)
Select the variant.
Definition: Cit_art_.cpp:161
TIds & SetIds(void)
Assign a value to Ids data member.
Definition: Cit_art_.cpp:263
TJournal & SetJournal(void)
Select the variant.
Definition: Cit_art_.cpp:117
CArticleIdSet TIds
Definition: Cit_art_.hpp:273
CRef< TAuthors > m_Authors
Definition: Cit_art_.hpp:451
CCit_art_Base(void)
Definition: Cit_art_.cpp:292
CTitle TTitle
Definition: Cit_art_.hpp:270
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Cit_art_.cpp:76
const TBook & GetBook(void) const
Get the variant data.
Definition: Cit_art_.cpp:133
@ e_not_set
No variant selected.
Definition: Cit_art_.hpp:112
@ 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 Jul 22 05:08:24 2024 by modify_doxy.py rev. 669887