NCBI C++ ToolKit
ArticleId_.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
45 
46 BEGIN_objects_SCOPE // namespace ncbi::objects::
47 
48 
49 // generated classes
50 
52 {
53  if ( m_choice != e_not_set )
55 }
56 
58 {
59  switch ( m_choice ) {
60  case e_Pubmed:
61  m_Pubmed.Destruct();
62  break;
63  case e_Medline:
64  m_Medline.Destruct();
65  break;
66  case e_Doi:
67  m_Doi.Destruct();
68  break;
69  case e_Pii:
70  m_Pii.Destruct();
71  break;
72  case e_Pmcid:
73  m_Pmcid.Destruct();
74  break;
75  case e_Pmcpid:
76  m_Pmcpid.Destruct();
77  break;
78  case e_Pmpid:
79  m_Pmpid.Destruct();
80  break;
81  case e_Other:
82  m_object->RemoveReference();
83  break;
84  default:
85  break;
86  }
88 }
89 
90 void CArticleId_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
91 {
92  switch ( index ) {
93  case e_Pubmed:
94  m_Pubmed.Construct();
95  break;
96  case e_Medline:
97  m_Medline.Construct();
98  break;
99  case e_Doi:
100  m_Doi.Construct();
101  break;
102  case e_Pii:
103  m_Pii.Construct();
104  break;
105  case e_Pmcid:
106  m_Pmcid.Construct();
107  break;
108  case e_Pmcpid:
109  m_Pmcpid.Construct();
110  break;
111  case e_Pmpid:
112  m_Pmpid.Construct();
113  break;
114  case e_Other:
115  (m_object = new(pool) ncbi::objects::CDbtag())->AddReference();
116  break;
117  default:
118  break;
119  }
120  m_choice = index;
121 }
122 
123 const char* const CArticleId_Base::sm_SelectionNames[] = {
124  "not set",
125  "pubmed",
126  "medline",
127  "doi",
128  "pii",
129  "pmcid",
130  "pmcpid",
131  "pmpid",
132  "other"
133 };
134 
136 {
137  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
138 }
139 
141 {
142  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
143 }
144 
146 {
148  *m_Pubmed = value;
149 }
150 
152 {
154  *m_Medline = value;
155 }
156 
158 {
160  *m_Doi = value;
161 }
162 
164 {
166  *m_Pii = value;
167 }
168 
170 {
172  *m_Pmcid = value;
173 }
174 
176 {
178  *m_Pmcpid = value;
179 }
180 
182 {
184  *m_Pmpid = value;
185 }
186 
188 {
190  return *static_cast<const TOther*>(m_object);
191 }
192 
194 {
196  return *static_cast<TOther*>(m_object);
197 }
198 
200 {
201  TOther* ptr = &value;
202  if ( m_choice != e_Other || m_object != ptr ) {
203  ResetSelection();
204  (m_object = ptr)->AddReference();
205  m_choice = e_Other;
206  }
207 }
208 
209 // helper methods
210 
211 // type info
213 {
214  SET_CHOICE_MODULE("NCBI-Biblio");
215  ADD_NAMED_BUF_CHOICE_VARIANT("pubmed", m_Pubmed, CLASS, (CPubMedId));
216  ADD_NAMED_BUF_CHOICE_VARIANT("medline", m_Medline, CLASS, (CMedlineUID));
217  ADD_NAMED_BUF_CHOICE_VARIANT("doi", m_Doi, CLASS, (CDOI));
218  ADD_NAMED_BUF_CHOICE_VARIANT("pii", m_Pii, CLASS, (CPII));
219  ADD_NAMED_BUF_CHOICE_VARIANT("pmcid", m_Pmcid, CLASS, (CPmcID));
220  ADD_NAMED_BUF_CHOICE_VARIANT("pmcpid", m_Pmcpid, CLASS, (CPmcPid));
221  ADD_NAMED_BUF_CHOICE_VARIANT("pmpid", m_Pmpid, CLASS, (CPmPid));
222  ADD_NAMED_REF_CHOICE_VARIANT("other", m_object, CDbtag);
223  info->CodeVersion(22400);
224  info->DataSpec(ncbi::EDataSpec::eASN);
225 }
227 
228 // constructor
230  : m_choice(e_not_set)
231 {
232 }
233 
234 // destructor
236 {
237  Reset();
238 }
239 
240 
241 
242 END_objects_SCOPE // namespace ncbi::objects::
243 
245 
CArticleId –.
Definition: ArticleId.hpp:66
CDOI –.
Definition: DOI.hpp:66
Definition: Dbtag.hpp:53
CPII –.
Definition: PII.hpp:66
CPmPid –.
Definition: PmPid.hpp:66
Definition: PmcID.hpp:54
CPmcPid –.
Definition: PmcPid.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 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
NCBI_NS_NCBI::CUnionBuffer< TMedline > m_Medline
Definition: ArticleId_.hpp:403
NCBI_NS_NCBI::CUnionBuffer< TPmcid > m_Pmcid
Definition: ArticleId_.hpp:406
TOther & SetOther(void)
Select the variant.
Definition: ArticleId_.cpp:193
const TOther & GetOther(void) const
Get the variant data.
Definition: ArticleId_.cpp:187
NCBI_NS_NCBI::CUnionBuffer< TPmcpid > m_Pmcpid
Definition: ArticleId_.hpp:407
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: ArticleId_.cpp:135
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: ArticleId_.hpp:429
E_Choice
Choice variants.
Definition: ArticleId_.hpp:98
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TPubmed & SetPubmed(void)
Select the variant.
Definition: ArticleId_.hpp:465
NCBI_NS_NCBI::CUnionBuffer< TDoi > m_Doi
Definition: ArticleId_.hpp:404
NCBI_NS_NCBI::CSerialObject * m_object
Definition: ArticleId_.hpp:409
TPmcpid & SetPmcpid(void)
Select the variant.
Definition: ArticleId_.hpp:565
TMedline & SetMedline(void)
Select the variant.
Definition: ArticleId_.hpp:485
NCBI_NS_NCBI::CUnionBuffer< TPii > m_Pii
Definition: ArticleId_.hpp:405
virtual void Reset(void)
Reset the whole object.
Definition: ArticleId_.cpp:51
TDoi & SetDoi(void)
Select the variant.
Definition: ArticleId_.hpp:505
NCBI_NS_NCBI::CUnionBuffer< TPmpid > m_Pmpid
Definition: ArticleId_.hpp:408
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: ArticleId_.cpp:140
virtual ~CArticleId_Base(void)
Definition: ArticleId_.cpp:235
TPmcid & SetPmcid(void)
Select the variant.
Definition: ArticleId_.hpp:545
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: ArticleId_.cpp:57
TPmpid & SetPmpid(void)
Select the variant.
Definition: ArticleId_.hpp:585
TPii & SetPii(void)
Select the variant.
Definition: ArticleId_.hpp:525
static const char *const sm_SelectionNames[]
Definition: ArticleId_.hpp:399
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: ArticleId_.cpp:90
NCBI_NS_NCBI::CUnionBuffer< TPubmed > m_Pubmed
Definition: ArticleId_.hpp:402
E_Choice m_choice
Definition: ArticleId_.hpp:395
@ e_not_set
No variant selected.
Definition: ArticleId_.hpp:99
@ e_Other
generic catch all
Definition: ArticleId_.hpp:107
@ e_Pubmed
see types below
Definition: ArticleId_.hpp:100
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("ArticleId", CArticleId)
Definition: ArticleId_.cpp:212
Modified on Sun Jun 16 04:31:04 2024 by modify_doxy.py rev. 669887