NCBI C++ ToolKit
RNA_ref_.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  * 'seqfeat.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
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 
50 // generated classes
51 
53 {
54  SET_ENUM_INTERNAL_NAME("RNA-ref", "type");
55  SET_ENUM_MODULE("NCBI-RNA");
56  ADD_ENUM_VALUE("unknown", eType_unknown);
57  ADD_ENUM_VALUE("premsg", eType_premsg);
58  ADD_ENUM_VALUE("mRNA", eType_mRNA);
59  ADD_ENUM_VALUE("tRNA", eType_tRNA);
60  ADD_ENUM_VALUE("rRNA", eType_rRNA);
61  ADD_ENUM_VALUE("snRNA", eType_snRNA);
62  ADD_ENUM_VALUE("scRNA", eType_scRNA);
63  ADD_ENUM_VALUE("snoRNA", eType_snoRNA);
64  ADD_ENUM_VALUE("ncRNA", eType_ncRNA);
65  ADD_ENUM_VALUE("tmRNA", eType_tmRNA);
66  ADD_ENUM_VALUE("miscRNA", eType_miscRNA);
67  ADD_ENUM_VALUE("other", eType_other);
68 }
70 
72 {
73  if ( m_choice != e_not_set )
75 }
76 
78 {
79  switch ( m_choice ) {
80  case e_Name:
81  m_string.Destruct();
82  break;
83  case e_TRNA:
84  case e_Gen:
85  m_object->RemoveReference();
86  break;
87  default:
88  break;
89  }
90  m_choice = e_not_set;
91 }
92 
93 void CRNA_ref_Base::C_Ext::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
94 {
95  switch ( index ) {
96  case e_TRNA:
97  (m_object = new(pool) ncbi::objects::CTrna_ext())->AddReference();
98  break;
99  case e_Gen:
100  (m_object = new(pool) ncbi::objects::CRNA_gen())->AddReference();
101  break;
102  case e_Name:
103  m_string.Construct();
104  break;
105  default:
106  break;
107  }
108  m_choice = index;
109 }
110 
111 const char* const CRNA_ref_Base::C_Ext::sm_SelectionNames[] = {
112  "not set",
113  "name",
114  "tRNA",
115  "gen"
116 };
117 
119 {
120  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
121 }
122 
124 {
125  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
126 }
127 
129 {
130  Select(e_Name, NCBI_NS_NCBI::eDoNotResetVariant);
131  *m_string = value;
132 }
133 
135 {
136  CheckSelected(e_TRNA);
137  return *static_cast<const TTRNA*>(m_object);
138 }
139 
141 {
142  Select(e_TRNA, NCBI_NS_NCBI::eDoNotResetVariant);
143  return *static_cast<TTRNA*>(m_object);
144 }
145 
147 {
148  TTRNA* ptr = &value;
149  if ( m_choice != e_TRNA || m_object != ptr ) {
150  ResetSelection();
151  (m_object = ptr)->AddReference();
152  m_choice = e_TRNA;
153  }
154 }
155 
157 {
158  CheckSelected(e_Gen);
159  return *static_cast<const TGen*>(m_object);
160 }
161 
163 {
164  Select(e_Gen, NCBI_NS_NCBI::eDoNotResetVariant);
165  return *static_cast<TGen*>(m_object);
166 }
167 
169 {
170  TGen* ptr = &value;
171  if ( m_choice != e_Gen || m_object != ptr ) {
172  ResetSelection();
173  (m_object = ptr)->AddReference();
174  m_choice = e_Gen;
175  }
176 }
177 
178 // helper methods
179 
180 // type info
182 {
183  SET_INTERNAL_NAME("RNA-ref", "ext");
184  SET_CHOICE_MODULE("NCBI-RNA");
185  ADD_NAMED_BUF_CHOICE_VARIANT("name", m_string, STD, (string));
186  ADD_NAMED_REF_CHOICE_VARIANT("tRNA", m_object, CTrna_ext);
187  ADD_NAMED_REF_CHOICE_VARIANT("gen", m_object, CRNA_gen);
188  info->CodeVersion(22301);
189  info->DataSpec(ncbi::EDataSpec::eASN);
190 }
192 
193 // constructor
195  : m_choice(e_not_set)
196 {
197 }
198 
199 // destructor
201 {
202  Reset();
203 }
204 
205 
207 {
208  m_Ext.Reset();
209 }
210 
212 {
213  m_Ext.Reset(&value);
214 }
215 
217 {
218  if ( !m_Ext )
219  m_Ext.Reset(new TExt());
220  return (*m_Ext);
221 }
222 
224 {
225  ResetType();
226  ResetPseudo();
227  ResetExt();
228 }
229 
231 {
232  SET_CLASS_MODULE("NCBI-RNA");
233  ADD_NAMED_ENUM_MEMBER("type", m_Type, EType)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
234  ADD_NAMED_STD_MEMBER("pseudo", m_Pseudo)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
235  ADD_NAMED_REF_MEMBER("ext", m_Ext, C_Ext)->SetOptional();
236  info->RandomOrder();
237  info->CodeVersion(22301);
238  info->DataSpec(ncbi::EDataSpec::eASN);
239 }
241 
242 // constructor
244  : m_Type((EType)(0)), m_Pseudo(0)
245 {
246  memset(m_set_State,0,sizeof(m_set_State));
247 }
248 
249 // destructor
251 {
252 }
253 
254 
255 
256 END_objects_SCOPE // namespace ncbi::objects::
257 
259 
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CRNA_ref_Base::C_Ext)
Definition: RNA_ref_.cpp:181
BEGIN_NAMED_BASE_CLASS_INFO("RNA-ref", CRNA_ref)
Definition: RNA_ref_.cpp:230
BEGIN_NAMED_ENUM_IN_INFO("", CRNA_ref_Base::, EType, false)
Definition: RNA_ref_.cpp:52
User-defined methods of the data storage class.
END_ENUM_INFO
Definition: aln_errors.cpp:58
*** rnas *********************************************** * * various rnas * minimal RNA sequence
Definition: RNA_ref_.hpp:83
@RNA_ref.hpp User-defined methods of the data storage class.
Definition: RNA_ref.hpp:54
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 MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#define SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#define ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define ADD_NAMED_STD_MEMBER(MemberAlias, MemberName)
Definition: serialimpl.hpp:345
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#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
#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
E_Choice
Choice variants.
Definition: RNA_ref_.hpp:132
CRef< TExt > m_Ext
Definition: RNA_ref_.hpp:436
TTRNA & SetTRNA(void)
Select the variant.
Definition: RNA_ref_.cpp:140
TName & SetName(void)
Select the variant.
Definition: RNA_ref_.hpp:491
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: RNA_ref_.cpp:118
void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: RNA_ref_.cpp:77
virtual ~CRNA_ref_Base(void)
Definition: RNA_ref_.cpp:250
EType
type of RNA feature
Definition: RNA_ref_.hpp:95
virtual void Reset(void)
Reset the whole object.
Definition: RNA_ref_.cpp:223
void Reset(void)
Reset the whole object.
Definition: RNA_ref_.cpp:71
static const char *const sm_SelectionNames[]
Definition: RNA_ref_.hpp:287
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: RNA_ref_.cpp:123
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: RNA_ref_.cpp:93
void ResetType(void)
Reset Type data member.
Definition: RNA_ref_.hpp:522
const TGen & GetGen(void) const
Get the variant data.
Definition: RNA_ref_.cpp:156
void ResetExt(void)
Reset Ext data member.
Definition: RNA_ref_.cpp:206
void ResetPseudo(void)
Reset Pseudo data member.
Definition: RNA_ref_.hpp:569
TGen & SetGen(void)
Select the variant.
Definition: RNA_ref_.cpp:162
CRNA_ref_Base(void)
Definition: RNA_ref_.cpp:243
const TTRNA & GetTRNA(void) const
Get the variant data.
Definition: RNA_ref_.cpp:134
TExt & SetExt(void)
Assign a value to Ext data member.
Definition: RNA_ref_.cpp:216
Uint4 m_set_State[1]
Definition: RNA_ref_.hpp:433
@ e_not_set
No variant selected.
Definition: RNA_ref_.hpp:133
@ 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 Tue Apr 16 20:14:11 2024 by modify_doxy.py rev. 669887