NCBI C++ ToolKit
Ncbi_mime_asn1_.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  * 'ncbimime.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
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_Entrez:
66  case e_Alignstruc:
67  case e_Alignseq:
68  case e_Strucseq:
69  case e_Strucseqs:
70  case e_General:
71  m_object->RemoveReference();
72  break;
73  default:
74  break;
75  }
77 }
78 
79 void CNcbi_mime_asn1_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
80 {
81  switch ( index ) {
82  case e_Entrez:
83  (m_object = new(pool) ncbi::objects::CEntrez_general())->AddReference();
84  break;
85  case e_Alignstruc:
86  (m_object = new(pool) ncbi::objects::CBiostruc_align())->AddReference();
87  break;
88  case e_Alignseq:
89  (m_object = new(pool) ncbi::objects::CBiostruc_align_seq())->AddReference();
90  break;
91  case e_Strucseq:
92  (m_object = new(pool) ncbi::objects::CBiostruc_seq())->AddReference();
93  break;
94  case e_Strucseqs:
95  (m_object = new(pool) ncbi::objects::CBiostruc_seqs())->AddReference();
96  break;
97  case e_General:
98  (m_object = new(pool) ncbi::objects::CBiostruc_seqs_aligns_cdd())->AddReference();
99  break;
100  default:
101  break;
102  }
103  m_choice = index;
104 }
105 
106 const char* const CNcbi_mime_asn1_Base::sm_SelectionNames[] = {
107  "not set",
108  "entrez",
109  "alignstruc",
110  "alignseq",
111  "strucseq",
112  "strucseqs",
113  "general"
114 };
115 
117 {
118  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
119 }
120 
122 {
123  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
124 }
125 
127 {
129  return *static_cast<const TEntrez*>(m_object);
130 }
131 
133 {
135  return *static_cast<TEntrez*>(m_object);
136 }
137 
139 {
140  TEntrez* ptr = &value;
141  if ( m_choice != e_Entrez || m_object != ptr ) {
142  ResetSelection();
143  (m_object = ptr)->AddReference();
144  m_choice = e_Entrez;
145  }
146 }
147 
149 {
151  return *static_cast<const TAlignstruc*>(m_object);
152 }
153 
155 {
157  return *static_cast<TAlignstruc*>(m_object);
158 }
159 
161 {
162  TAlignstruc* ptr = &value;
163  if ( m_choice != e_Alignstruc || m_object != ptr ) {
164  ResetSelection();
165  (m_object = ptr)->AddReference();
167  }
168 }
169 
171 {
173  return *static_cast<const TAlignseq*>(m_object);
174 }
175 
177 {
179  return *static_cast<TAlignseq*>(m_object);
180 }
181 
183 {
184  TAlignseq* ptr = &value;
185  if ( m_choice != e_Alignseq || m_object != ptr ) {
186  ResetSelection();
187  (m_object = ptr)->AddReference();
189  }
190 }
191 
193 {
195  return *static_cast<const TStrucseq*>(m_object);
196 }
197 
199 {
201  return *static_cast<TStrucseq*>(m_object);
202 }
203 
205 {
206  TStrucseq* ptr = &value;
207  if ( m_choice != e_Strucseq || m_object != ptr ) {
208  ResetSelection();
209  (m_object = ptr)->AddReference();
211  }
212 }
213 
215 {
217  return *static_cast<const TStrucseqs*>(m_object);
218 }
219 
221 {
223  return *static_cast<TStrucseqs*>(m_object);
224 }
225 
227 {
228  TStrucseqs* ptr = &value;
229  if ( m_choice != e_Strucseqs || m_object != ptr ) {
230  ResetSelection();
231  (m_object = ptr)->AddReference();
233  }
234 }
235 
237 {
239  return *static_cast<const TGeneral*>(m_object);
240 }
241 
243 {
245  return *static_cast<TGeneral*>(m_object);
246 }
247 
249 {
250  TGeneral* ptr = &value;
251  if ( m_choice != e_General || m_object != ptr ) {
252  ResetSelection();
253  (m_object = ptr)->AddReference();
255  }
256 }
257 
258 // helper methods
259 
260 // type info
262 {
263  SET_CHOICE_MODULE("NCBI-Mime");
264  ADD_NAMED_REF_CHOICE_VARIANT("entrez", m_object, CEntrez_general);
265  ADD_NAMED_REF_CHOICE_VARIANT("alignstruc", m_object, CBiostruc_align);
266  ADD_NAMED_REF_CHOICE_VARIANT("alignseq", m_object, CBiostruc_align_seq);
267  ADD_NAMED_REF_CHOICE_VARIANT("strucseq", m_object, CBiostruc_seq);
268  ADD_NAMED_REF_CHOICE_VARIANT("strucseqs", m_object, CBiostruc_seqs);
270  info->CodeVersion(22400);
271  info->DataSpec(ncbi::EDataSpec::eASN);
272 }
274 
275 // constructor
277  : m_choice(e_not_set)
278 {
279 }
280 
281 // destructor
283 {
284  Reset();
285 }
286 
287 
288 
289 END_objects_SCOPE // namespace ncbi::objects::
290 
292 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("Ncbi-mime-asn1", CNcbi_mime_asn1)
CBiostruc_align_seq –.
CBiostruc_align –.
CBiostruc_seq –.
CBiostruc_seqs_aligns_cdd –.
CBiostruc_seqs –.
CEntrez_general –.
string
Definition: cgiapp.hpp:690
#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
@ 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
virtual void Reset(void)
Reset the whole object.
const TStrucseq & GetStrucseq(void) const
Get the variant data.
const TAlignseq & GetAlignseq(void) const
Get the variant data.
const TEntrez & GetEntrez(void) const
Get the variant data.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
TStrucseq & SetStrucseq(void)
Select the variant.
virtual ~CNcbi_mime_asn1_Base(void)
const TAlignstruc & GetAlignstruc(void) const
Get the variant data.
TAlignseq & SetAlignseq(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
TStrucseqs & SetStrucseqs(void)
Select the variant.
TAlignstruc & SetAlignstruc(void)
Select the variant.
TGeneral & SetGeneral(void)
Select the variant.
E_Choice
Choice variants.
const TStrucseqs & GetStrucseqs(void) const
Get the variant data.
const TGeneral & GetGeneral(void) const
Get the variant data.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
static const char *const sm_SelectionNames[]
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TEntrez & SetEntrez(void)
Select the variant.
@ e_Strucseq
structure & sequences
@ e_Alignseq
sequence alignment
@ e_Strucseqs
structure & sequences & alignments
@ e_General
all-purpose "grab bag" others may be added here in the future
@ e_Alignstruc
structures & sequences & alignments
@ e_Entrez
just a structure
@ e_not_set
No variant selected.
@ 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 Fri Sep 20 14:58:31 2024 by modify_doxy.py rev. 669887