NCBI C++ ToolKit
ID2S_Bioseq_Ids_.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  * 'seqsplit.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  if ( m_choice != e_not_set )
56 }
57 
59 {
60  switch ( m_choice ) {
61  case e_Seq_id:
62  case e_Gi_range:
63  m_object->RemoveReference();
64  break;
65  default:
66  break;
67  }
68  m_choice = e_not_set;
69 }
70 
71 void CID2S_Bioseq_Ids_Base::C_E::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
72 {
73  switch ( index ) {
74  case e_Gi:
75  m_Gi = 0;
76  break;
77  case e_Seq_id:
78  (m_object = new(pool) ncbi::objects::CSeq_id())->AddReference();
79  break;
80  case e_Gi_range:
81  (m_object = new(pool) ncbi::objects::CID2S_Gi_Range())->AddReference();
82  break;
83  default:
84  break;
85  }
86  m_choice = index;
87 }
88 
90  "not set",
91  "gi",
92  "seq-id",
93  "gi-range"
94 };
95 
97 {
98  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
99 }
100 
102 {
103  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
104 }
105 
107 {
108  CheckSelected(e_Seq_id);
109  return *static_cast<const TSeq_id*>(m_object);
110 }
111 
113 {
114  Select(e_Seq_id, NCBI_NS_NCBI::eDoNotResetVariant);
115  return *static_cast<TSeq_id*>(m_object);
116 }
117 
119 {
120  TSeq_id* ptr = &value;
121  if ( m_choice != e_Seq_id || m_object != ptr ) {
122  ResetSelection();
123  (m_object = ptr)->AddReference();
124  m_choice = e_Seq_id;
125  }
126 }
127 
129 {
130  CheckSelected(e_Gi_range);
131  return *static_cast<const TGi_range*>(m_object);
132 }
133 
135 {
136  Select(e_Gi_range, NCBI_NS_NCBI::eDoNotResetVariant);
137  return *static_cast<TGi_range*>(m_object);
138 }
139 
141 {
142  TGi_range* ptr = &value;
143  if ( m_choice != e_Gi_range || m_object != ptr ) {
144  ResetSelection();
145  (m_object = ptr)->AddReference();
146  m_choice = e_Gi_range;
147  }
148 }
149 
150 // helper methods
151 
152 // type info
154 {
155  SET_INTERNAL_NAME("ID2S-Bioseq-Ids", "E");
156  SET_CHOICE_MODULE("NCBI-Seq-split");
157  ADD_NAMED_STD_CHOICE_VARIANT("gi", m_Gi);
158  ADD_NAMED_REF_CHOICE_VARIANT("seq-id", m_object, CSeq_id);
159  ADD_NAMED_REF_CHOICE_VARIANT("gi-range", m_object, CID2S_Gi_Range);
160  info->CodeVersion(22301);
161  info->DataSpec(ncbi::EDataSpec::eASN);
162 }
164 
165 // constructor
167  : m_choice(e_not_set)
168 {
169 }
170 
171 // destructor
173 {
174  Reset();
175 }
176 
177 
179 {
180  m_data.clear();
181  m_set_State[0] &= ~0x3;
182 }
183 
185 {
186  SET_CLASS_MODULE("NCBI-Seq-split");
187  ADD_NAMED_MEMBER("", m_data, STL_list_set, (STL_CRef, (CLASS, (C_E))))->SetSetFlag(MEMBER_PTR(m_set_State[0]));
188  info->RandomOrder();
189  info->CodeVersion(22301);
190  info->DataSpec(ncbi::EDataSpec::eASN);
191 }
193 
194 // constructor
196 {
197  memset(m_set_State,0,sizeof(m_set_State));
198 }
199 
200 // destructor
202 {
203 }
204 
205 
206 
207 END_objects_SCOPE // namespace ncbi::objects::
208 
210 
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CID2S_Bioseq_Ids_Base::C_E)
BEGIN_NAMED_BASE_IMPLICIT_CLASS_INFO("ID2S-Bioseq-Ids", CID2S_Bioseq_Ids)
User-defined methods of the data storage class.
CID2S_Bioseq_Ids –.
CID2S_Gi_Range –.
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 MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#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
@ 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
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TGi_range & GetGi_range(void) const
Get the variant data.
list< CRef< C_E > > m_data
TSeq_id & SetSeq_id(void)
Select the variant.
virtual ~CID2S_Bioseq_Ids_Base(void)
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void Reset(void)
Reset the whole object.
static const char *const sm_SelectionNames[]
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TGi_range & SetGi_range(void)
Select the variant.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
const TSeq_id & GetSeq_id(void) const
Get the variant data.
void Reset(void)
Reset data member.
@ e_not_set
No variant selected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Sat Dec 09 04:45:46 2023 by modify_doxy.py rev. 669887