NCBI C++ ToolKit
PC_AssayTargetInfo_.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  * 'pcassay2.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 BEGIN_pcassay2_SCOPE // namespace ncbi::objects::pcassay2::
49 
50 
51 // generated classes
52 
54 {
55  if ( m_choice != e_not_set )
57 }
58 
60 {
61  switch ( m_choice ) {
62  case e_Protein_accession:
63  case e_Nucleotide_accession:
64  case e_Other:
65  m_string.Destruct();
66  break;
67  default:
68  break;
69  }
70  m_choice = e_not_set;
71 }
72 
73 void CPC_AssayTargetInfo_Base::C_Mol_id::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* )
74 {
75  switch ( index ) {
76  case e_Gene_id:
77  m_Gene_id = 0;
78  break;
79  case e_Tax_id:
80  m_Tax_id = 0;
81  break;
82  case e_Protein_accession:
83  case e_Nucleotide_accession:
84  case e_Other:
85  m_string.Construct();
86  break;
87  default:
88  break;
89  }
90  m_choice = index;
91 }
92 
94  "not set",
95  "gene-id",
96  "protein-accession",
97  "nucleotide-accession",
98  "other",
99  "tax-id"
100 };
101 
103 {
104  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
105 }
106 
108 {
109  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
110 }
111 
113 {
114  Select(e_Protein_accession, NCBI_NS_NCBI::eDoNotResetVariant);
115  *m_string = value;
116 }
117 
119 {
120  Select(e_Nucleotide_accession, NCBI_NS_NCBI::eDoNotResetVariant);
121  *m_string = value;
122 }
123 
125 {
126  Select(e_Other, NCBI_NS_NCBI::eDoNotResetVariant);
127  *m_string = value;
128 }
129 
130 // helper methods
131 
132 // type info
134 {
135  SET_INTERNAL_NAME("PC-AssayTargetInfo", "mol-id");
136  SET_CHOICE_MODULE("NCBI-PCAssay2");
137  ADD_NAMED_STD_CHOICE_VARIANT("gene-id", m_Gene_id);
138  ADD_NAMED_BUF_CHOICE_VARIANT("protein-accession", m_string, STD, (string));
139  ADD_NAMED_BUF_CHOICE_VARIANT("nucleotide-accession", m_string, STD, (string));
140  ADD_NAMED_BUF_CHOICE_VARIANT("other", m_string, STD, (string));
141  ADD_NAMED_STD_CHOICE_VARIANT("tax-id", m_Tax_id);
142  info->CodeVersion(22400);
143  info->DataSpec(ncbi::EDataSpec::eASN);
144 }
146 
147 // constructor
149  : m_choice(e_not_set)
150 {
151 }
152 
153 // destructor
155 {
156  Reset();
157 }
158 
159 
161 {
162  m_Name.erase();
163  m_set_State[0] &= ~0x3;
164 }
165 
167 {
168  if ( !m_Mol_id ) {
169  m_Mol_id.Reset(new TMol_id());
170  return;
171  }
172  (*m_Mol_id).Reset();
173 }
174 
176 {
177  m_Mol_id.Reset(&value);
178 }
179 
181 {
182  m_Organism.Reset();
183 }
184 
186 {
187  m_Organism.Reset(&value);
188 }
189 
191 {
192  if ( !m_Organism )
193  m_Organism.Reset(new TOrganism());
194  return (*m_Organism);
195 }
196 
198 {
199  m_Descr.erase();
200  m_set_State[0] &= ~0xc0;
201 }
202 
204 {
205  m_Comment.clear();
206  m_set_State[0] &= ~0x300;
207 }
208 
210 {
211  ResetName();
212  ResetMol_id();
213  ResetOrganism();
214  ResetDescr();
215  ResetComment();
216 }
217 
219 {
220  SET_CLASS_MODULE("NCBI-PCAssay2");
221  ADD_NAMED_MEMBER("name", m_Name, CStringUTF8, ())->SetSetFlag(MEMBER_PTR(m_set_State[0]));
222  ADD_NAMED_REF_MEMBER("mol-id", m_Mol_id, C_Mol_id);
223  ADD_NAMED_REF_MEMBER("organism", m_Organism, objects::CBioSource)->SetOptional();
224  ADD_NAMED_MEMBER("descr", m_Descr, CStringUTF8, ())->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
225  ADD_NAMED_MEMBER("comment", m_Comment, STL_list, (CStringUTF8, ()))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
226  info->RandomOrder();
227  info->CodeVersion(22400);
228  info->DataSpec(ncbi::EDataSpec::eASN);
229 }
231 
232 // constructor
234 {
235  memset(m_set_State,0,sizeof(m_set_State));
236  if ( !IsAllocatedInPool() ) {
237  ResetMol_id();
238  }
239 }
240 
241 // destructor
243 {
244 }
245 
246 
247 
248 END_pcassay2_SCOPE // namespace ncbi::objects::pcassay2::
249 
250 END_objects_SCOPE // namespace ncbi::objects::
251 
253 
#define END_pcassay2_SCOPE
#define BEGIN_pcassay2_SCOPE
database and identifier of the target molecule
CPC_AssayTargetInfo –.
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 ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#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
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
std::string CStringUTF8
Definition: ncbistl.hpp:254
void ResetSelection(void)
Reset the selection (set it to e_not_set).
static const char *const sm_SelectionNames[]
TProtein_accession & SetProtein_accession(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TOther & SetOther(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TNucleotide_accession & SetNucleotide_accession(void)
Select the variant.
void Reset(void)
Reset the whole object.
void ResetComment(void)
Reset Comment data member.
virtual void Reset(void)
Reset the whole object.
void ResetName(void)
Reset Name data member.
void ResetOrganism(void)
Reset Organism data member.
void ResetDescr(void)
Reset Descr data member.
TOrganism & SetOrganism(void)
Assign a value to Organism data member.
void ResetMol_id(void)
Reset Mol_id data member.
TMol_id & SetMol_id(void)
Assign a value to Mol_id data member.
@ 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_CHOICE_INFO("", CPC_AssayTargetInfo_Base::C_Mol_id)
BEGIN_NAMED_BASE_CLASS_INFO("PC-AssayTargetInfo", CPC_AssayTargetInfo)
Modified on Wed Jul 17 13:18:41 2024 by modify_doxy.py rev. 669887