NCBI C++ ToolKit
PluginValueConstraint_.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  * 'gui_objects.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 
49 // generated classes
50 
52 {
53  if ( m_choice != e_not_set )
55 }
56 
58 {
59  switch ( m_choice ) {
60  case e_Set:
61  m_Set.Destruct();
62  break;
63  case e_Seq_repr:
64  m_Seq_repr.Destruct();
65  break;
66  case e_Seq_mol:
67  m_Seq_mol.Destruct();
68  break;
69  case e_Feat_type:
70  m_Feat_type.Destruct();
71  break;
72  case e_Feat_subtype:
73  m_Feat_subtype.Destruct();
74  break;
75  case e_Lower:
76  case e_Upper:
78  m_string.Destruct();
79  break;
80  case e_Range:
81  case e_Seq_length_range:
82  m_object->RemoveReference();
83  break;
84  default:
85  break;
86  }
88 }
89 
90 void CPluginValueConstraint_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
91 {
92  switch ( index ) {
93  case e_Range:
94  (m_object = new(pool) ncbi::objects::CPluginValueRangeConstraint())->AddReference();
95  break;
96  case e_Set:
97  m_Set.Construct();
98  break;
99  case e_Seq_repr:
100  m_Seq_repr.Construct();
101  break;
102  case e_Seq_mol:
103  m_Seq_mol.Construct();
104  break;
105  case e_Seq_length_lower:
106  m_Seq_length_lower = 0;
107  break;
108  case e_Seq_length_upper:
109  m_Seq_length_upper = 0;
110  break;
111  case e_Seq_length_range:
112  (m_object = new(pool) ncbi::objects::CPluginValueRangeConstraint())->AddReference();
113  break;
114  case e_Entry_type:
115  m_Entry_type = 0;
116  break;
117  case e_Annot_type:
118  m_Annot_type = 0;
119  break;
120  case e_Feat_type:
121  m_Feat_type.Construct();
122  break;
123  case e_Feat_subtype:
124  m_Feat_subtype.Construct();
125  break;
126  case e_Lower:
127  case e_Upper:
128  case e_Project_item_type:
129  m_string.Construct();
130  break;
131  default:
132  break;
133  }
134  m_choice = index;
135 }
136 
138  "not set",
139  "lower",
140  "upper",
141  "range",
142  "set",
143  "seq-repr",
144  "seq-mol",
145  "seq-mol-same-type",
146  "seq-length-lower",
147  "seq-length-upper",
148  "seq-length-range",
149  "seq-length-same",
150  "entry-type",
151  "annot-type",
152  "feat-type",
153  "feat-subtype",
154  "feat-has-product",
155  "project-item-type"
156 };
157 
159 {
160  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
161 }
162 
164 {
165  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
166 }
167 
169 {
171  *m_string = value;
172 }
173 
175 {
177  *m_string = value;
178 }
179 
181 {
183  return *static_cast<const TRange*>(m_object);
184 }
185 
187 {
189  return *static_cast<TRange*>(m_object);
190 }
191 
193 {
194  TRange* ptr = &value;
195  if ( m_choice != e_Range || m_object != ptr ) {
196  ResetSelection();
197  (m_object = ptr)->AddReference();
198  m_choice = e_Range;
199  }
200 }
201 
203 {
205  return *static_cast<const TSeq_length_range*>(m_object);
206 }
207 
209 {
211  return *static_cast<TSeq_length_range*>(m_object);
212 }
213 
215 {
216  TSeq_length_range* ptr = &value;
217  if ( m_choice != e_Seq_length_range || m_object != ptr ) {
218  ResetSelection();
219  (m_object = ptr)->AddReference();
221  }
222 }
223 
225 {
227  *m_string = value;
228 }
229 
230 // helper methods
231 
232 // type info
234 {
235  SET_CHOICE_MODULE("NCBI-Plugin");
236  ADD_NAMED_BUF_CHOICE_VARIANT("lower", m_string, STD, (string));
237  ADD_NAMED_BUF_CHOICE_VARIANT("upper", m_string, STD, (string));
239  ADD_NAMED_BUF_CHOICE_VARIANT("set", m_Set, STL_list_set, (STD, (string)));
240  ADD_NAMED_BUF_CHOICE_VARIANT("seq-repr", m_Seq_repr, STL_list_set, (STD, (int)));
241  ADD_NAMED_BUF_CHOICE_VARIANT("seq-mol", m_Seq_mol, STL_list_set, (STD, (int)));
242  ADD_NAMED_NULL_CHOICE_VARIANT("seq-mol-same-type", null, ());
243  ADD_NAMED_STD_CHOICE_VARIANT("seq-length-lower", m_Seq_length_lower);
244  ADD_NAMED_STD_CHOICE_VARIANT("seq-length-upper", m_Seq_length_upper);
245  ADD_NAMED_REF_CHOICE_VARIANT("seq-length-range", m_object, CPluginValueRangeConstraint);
246  ADD_NAMED_NULL_CHOICE_VARIANT("seq-length-same", null, ());
247  ADD_NAMED_STD_CHOICE_VARIANT("entry-type", m_Entry_type);
248  ADD_NAMED_STD_CHOICE_VARIANT("annot-type", m_Annot_type);
249  ADD_NAMED_BUF_CHOICE_VARIANT("feat-type", m_Feat_type, STL_list_set, (STD, (int)));
250  ADD_NAMED_BUF_CHOICE_VARIANT("feat-subtype", m_Feat_subtype, STL_list_set, (STD, (int)));
251  ADD_NAMED_NULL_CHOICE_VARIANT("feat-has-product", null, ());
252  ADD_NAMED_BUF_CHOICE_VARIANT("project-item-type", m_string, STD, (string));
253  info->CodeVersion(22400);
254  info->DataSpec(ncbi::EDataSpec::eASN);
255 }
257 
258 // constructor
260  : m_choice(e_not_set)
261 {
262 }
263 
264 // destructor
266 {
267  Reset();
268 }
269 
270 
271 
272 END_objects_SCOPE // namespace ncbi::objects::
273 
275 
BEGIN_NAMED_BASE_CHOICE_INFO("PluginValueConstraint", CPluginValueConstraint)
User-defined methods of the data storage class.
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 ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias, MemberName)
Definition: serialimpl.hpp:388
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:379
#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
const TRange & GetRange(void) const
Get the variant data.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
TUpper & SetUpper(void)
Select the variant.
static const char *const sm_SelectionNames[]
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
const TSeq_length_range & GetSeq_length_range(void) const
Get the variant data.
NCBI_NS_NCBI::CSerialObject * m_object
NCBI_NS_NCBI::CUnionBuffer< TSeq_repr > m_Seq_repr
NCBI_NS_NCBI::CUnionBuffer< TFeat_type > m_Feat_type
TRange & SetRange(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< TSeq_mol > m_Seq_mol
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TSeq_length_range & SetSeq_length_range(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< TFeat_subtype > m_Feat_subtype
TLower & SetLower(void)
Select the variant.
virtual void Reset(void)
Reset the whole object.
NCBI_NS_NCBI::CUnionBuffer< TSet > m_Set
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TProject_item_type & SetProject_item_type(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define STD
Modified on Fri Sep 20 14:58:01 2024 by modify_doxy.py rev. 669887