NCBI C++ ToolKit
Biomol_descr_.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  * 'mmdb1.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/pub/Pub.hpp>
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 
50 // generated classes
51 
52 BEGIN_NAMED_ENUM_IN_INFO("", CBiomol_descr_Base::, EAssembly_type, true)
53 {
54  SET_ENUM_INTERNAL_NAME("Biomol-descr", "assembly-type");
55  SET_ENUM_MODULE("MMDB-Chemical-graph");
56  ADD_ENUM_VALUE("physiological-form", eAssembly_type_physiological_form);
57  ADD_ENUM_VALUE("crystallographic-cell", eAssembly_type_crystallographic_cell);
58  ADD_ENUM_VALUE("other", eAssembly_type_other);
59 }
61 
63 {
64  SET_ENUM_INTERNAL_NAME("Biomol-descr", "molecule-type");
65  SET_ENUM_MODULE("MMDB-Chemical-graph");
66  ADD_ENUM_VALUE("dna", eMolecule_type_dna);
67  ADD_ENUM_VALUE("rna", eMolecule_type_rna);
68  ADD_ENUM_VALUE("protein", eMolecule_type_protein);
69  ADD_ENUM_VALUE("other-biopolymer", eMolecule_type_other_biopolymer);
70  ADD_ENUM_VALUE("solvent", eMolecule_type_solvent);
71  ADD_ENUM_VALUE("other-nonpolymer", eMolecule_type_other_nonpolymer);
72  ADD_ENUM_VALUE("other", eMolecule_type_other);
73 }
75 
77 {
78  if ( m_choice != e_not_set )
80 }
81 
83 {
84  switch ( m_choice ) {
85  case e_Name:
86  case e_Pdb_class:
87  case e_Pdb_source:
88  case e_Pdb_comment:
89  case e_Other_comment:
90  m_string.Destruct();
91  break;
92  case e_Organism:
93  case e_Attribution:
94  m_object->RemoveReference();
95  break;
96  default:
97  break;
98  }
100 }
101 
102 void CBiomol_descr_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
103 {
104  switch ( index ) {
105  case e_Organism:
106  (m_object = new(pool) ncbi::objects::CBioSource())->AddReference();
107  break;
108  case e_Attribution:
109  (m_object = new(pool) ncbi::objects::CPub())->AddReference();
110  break;
111  case e_Assembly_type:
113  break;
114  case e_Molecule_type:
116  break;
117  case e_Name:
118  case e_Pdb_class:
119  case e_Pdb_source:
120  case e_Pdb_comment:
121  case e_Other_comment:
122  m_string.Construct();
123  break;
124  default:
125  break;
126  }
127  m_choice = index;
128 }
129 
130 const char* const CBiomol_descr_Base::sm_SelectionNames[] = {
131  "not set",
132  "name",
133  "pdb-class",
134  "pdb-source",
135  "pdb-comment",
136  "other-comment",
137  "organism",
138  "attribution",
139  "assembly-type",
140  "molecule-type"
141 };
142 
144 {
145  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
146 }
147 
149 {
150  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
151 }
152 
154 {
156  *m_string = value;
157 }
158 
160 {
162  *m_string = value;
163 }
164 
166 {
168  *m_string = value;
169 }
170 
172 {
174  *m_string = value;
175 }
176 
178 {
180  *m_string = value;
181 }
182 
184 {
186  return *static_cast<const TOrganism*>(m_object);
187 }
188 
190 {
192  return *static_cast<TOrganism*>(m_object);
193 }
194 
196 {
197  TOrganism* ptr = &value;
198  if ( m_choice != e_Organism || m_object != ptr ) {
199  ResetSelection();
200  (m_object = ptr)->AddReference();
202  }
203 }
204 
206 {
208  return *static_cast<const TAttribution*>(m_object);
209 }
210 
212 {
214  return *static_cast<TAttribution*>(m_object);
215 }
216 
218 {
219  TAttribution* ptr = &value;
220  if ( m_choice != e_Attribution || m_object != ptr ) {
221  ResetSelection();
222  (m_object = ptr)->AddReference();
224  }
225 }
226 
227 // helper methods
228 
229 // type info
231 {
232  SET_CHOICE_MODULE("MMDB-Chemical-graph");
233  ADD_NAMED_BUF_CHOICE_VARIANT("name", m_string, STD, (string));
234  ADD_NAMED_BUF_CHOICE_VARIANT("pdb-class", m_string, STD, (string));
235  ADD_NAMED_BUF_CHOICE_VARIANT("pdb-source", m_string, STD, (string));
236  ADD_NAMED_BUF_CHOICE_VARIANT("pdb-comment", m_string, STD, (string));
237  ADD_NAMED_BUF_CHOICE_VARIANT("other-comment", m_string, STD, (string));
238  ADD_NAMED_REF_CHOICE_VARIANT("organism", m_object, CBioSource);
239  ADD_NAMED_REF_CHOICE_VARIANT("attribution", m_object, CPub);
240  ADD_NAMED_ENUM_CHOICE_VARIANT("assembly-type", m_Assembly_type, EAssembly_type);
241  ADD_NAMED_ENUM_CHOICE_VARIANT("molecule-type", m_Molecule_type, EMolecule_type);
242  info->CodeVersion(22301);
243  info->DataSpec(ncbi::EDataSpec::eASN);
244 }
246 
247 // constructor
249  : m_choice(e_not_set)
250 {
251 }
252 
253 // destructor
255 {
256  Reset();
257 }
258 
259 
260 
261 END_objects_SCOPE // namespace ncbi::objects::
262 
264 
User-defined methods of the data storage class.
BEGIN_NAMED_ENUM_IN_INFO("", CBiomol_descr_Base::, EAssembly_type, true)
BEGIN_NAMED_BASE_CHOICE_INFO("Biomol-descr", CBiomol_descr)
END_ENUM_INFO
Definition: aln_errors.cpp:58
A biomolecule description refers to the chemical structure of a molecule or component substructures.
CBiomol_descr –.
Definition: Pub.hpp:56
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 SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#define ADD_NAMED_ENUM_CHOICE_VARIANT(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:391
#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
TPdb_comment & SetPdb_comment(void)
Select the variant.
TMolecule_type m_Molecule_type
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TAttribution & SetAttribution(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
const TAttribution & GetAttribution(void) const
Get the variant data.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
TAssembly_type m_Assembly_type
virtual void Reset(void)
Reset the whole object.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
static const char *const sm_SelectionNames[]
TPdb_class & SetPdb_class(void)
Select the variant.
E_Choice
Choice variants.
TOther_comment & SetOther_comment(void)
Select the variant.
virtual ~CBiomol_descr_Base(void)
const TOrganism & GetOrganism(void) const
Get the variant data.
TName & SetName(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TPdb_source & SetPdb_source(void)
Select the variant.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TOrganism & SetOrganism(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
@ e_not_set
No variant selected.
EMolecule_type
Access to EMolecule_type's attributes (values, names) as defined in spec.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Tue Dec 05 02:17:52 2023 by modify_doxy.py rev. 669887