NCBI C++ ToolKit
Int_fuzz_.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  * 'general.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
44 
45 BEGIN_objects_SCOPE // namespace ncbi::objects::
46 
47 
48 // generated classes
49 
51 {
52  ResetMax();
53  ResetMin();
54 }
55 
57 {
58  SET_INTERNAL_NAME("Int-fuzz", "range");
59  SET_CLASS_MODULE("NCBI-General");
60  ADD_NAMED_STD_MEMBER("max", m_Max)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
61  ADD_NAMED_STD_MEMBER("min", m_Min)->SetSetFlag(MEMBER_PTR(m_set_State[0]));
62  info->RandomOrder();
63  info->CodeVersion(22301);
64  info->DataSpec(ncbi::EDataSpec::eASN);
65 }
67 
68 // constructor
70  : m_Max(0), m_Min(0)
71 {
72  memset(m_set_State,0,sizeof(m_set_State));
73 }
74 
75 // destructor
77 {
78 }
79 
80 
82 {
83  SET_ENUM_INTERNAL_NAME("Int-fuzz", "lim");
84  SET_ENUM_MODULE("NCBI-General");
85  ADD_ENUM_VALUE("unk", eLim_unk);
86  ADD_ENUM_VALUE("gt", eLim_gt);
87  ADD_ENUM_VALUE("lt", eLim_lt);
88  ADD_ENUM_VALUE("tr", eLim_tr);
89  ADD_ENUM_VALUE("tl", eLim_tl);
90  ADD_ENUM_VALUE("circle", eLim_circle);
91  ADD_ENUM_VALUE("other", eLim_other);
92 }
94 
96 {
97  if ( m_choice != e_not_set )
99 }
100 
102 {
103  switch ( m_choice ) {
104  case e_Alt:
105  m_Alt.Destruct();
106  break;
107  case e_Range:
108  m_object->RemoveReference();
109  break;
110  default:
111  break;
112  }
114 }
115 
116 void CInt_fuzz_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
117 {
118  switch ( index ) {
119  case e_P_m:
120  m_P_m = 0;
121  break;
122  case e_Range:
123  (m_object = new(pool) C_Range())->AddReference();
124  break;
125  case e_Pct:
126  m_Pct = 0;
127  break;
128  case e_Lim:
129  m_Lim = (ELim)(0);
130  break;
131  case e_Alt:
132  m_Alt.Construct();
133  break;
134  default:
135  break;
136  }
137  m_choice = index;
138 }
139 
140 const char* const CInt_fuzz_Base::sm_SelectionNames[] = {
141  "not set",
142  "p-m",
143  "range",
144  "pct",
145  "lim",
146  "alt"
147 };
148 
150 {
151  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
152 }
153 
155 {
156  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
157 }
158 
160 {
162  return *static_cast<const TRange*>(m_object);
163 }
164 
166 {
168  return *static_cast<TRange*>(m_object);
169 }
170 
172 {
173  TRange* ptr = &value;
174  if ( m_choice != e_Range || m_object != ptr ) {
175  ResetSelection();
176  (m_object = ptr)->AddReference();
177  m_choice = e_Range;
178  }
179 }
180 
181 // helper methods
182 
183 // type info
185 {
186  SET_CHOICE_MODULE("NCBI-General");
188  ADD_NAMED_REF_CHOICE_VARIANT("range", m_object, C_Range);
191  ADD_NAMED_BUF_CHOICE_VARIANT("alt", m_Alt, STL_list_set, (STD, (TSeqPos)));
192  info->CodeVersion(22301);
193  info->DataSpec(ncbi::EDataSpec::eASN);
194 }
196 
197 // constructor
200 {
201 }
202 
203 // destructor
205 {
206  Reset();
207 }
208 
209 
210 
211 END_objects_SCOPE // namespace ncbi::objects::
212 
214 
BEGIN_NAMED_CLASS_INFO("", CInt_fuzz_Base::C_Range)
Definition: Int_fuzz_.cpp:56
BEGIN_NAMED_ENUM_IN_INFO("", CInt_fuzz_Base::, ELim, false)
Definition: Int_fuzz_.cpp:81
BEGIN_NAMED_BASE_CHOICE_INFO("Int-fuzz", CInt_fuzz)
Definition: Int_fuzz_.cpp:184
END_ENUM_INFO
Definition: aln_errors.cpp:58
**** Int-fuzz ********************************************** * * uncertainties in integer values
Definition: Int_fuzz_.hpp:76
char value[7]
Definition: config.c:431
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
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 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_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#define ADD_NAMED_ENUM_CHOICE_VARIANT(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:391
#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
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 ResetMin(void)
Reset Min data member.
Definition: Int_fuzz_.hpp:512
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TRange & SetRange(void)
Select the variant.
Definition: Int_fuzz_.cpp:165
E_Choice m_choice
Definition: Int_fuzz_.hpp:428
virtual void Reset(void)
Reset the whole object.
Definition: Int_fuzz_.cpp:95
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Int_fuzz_.hpp:553
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Int_fuzz_.cpp:101
ELim
some limit value
Definition: Int_fuzz_.hpp:209
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Int_fuzz_.cpp:116
E_Choice
Choice variants.
Definition: Int_fuzz_.hpp:224
NCBI_NS_NCBI::CUnionBuffer< TAlt > m_Alt
Definition: Int_fuzz_.hpp:438
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
Definition: Int_fuzz_.cpp:149
void Reset(void)
Reset the whole object.
Definition: Int_fuzz_.cpp:50
static const char *const sm_SelectionNames[]
Definition: Int_fuzz_.hpp:432
CInt_fuzz_Base(void)
Definition: Int_fuzz_.cpp:198
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Int_fuzz_.cpp:154
void ResetMax(void)
Reset Max data member.
Definition: Int_fuzz_.hpp:465
virtual ~CInt_fuzz_Base(void)
Definition: Int_fuzz_.cpp:204
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Int_fuzz_.hpp:439
const TRange & GetRange(void) const
Get the variant data.
Definition: Int_fuzz_.cpp:159
@ eLim_gt
greater than
Definition: Int_fuzz_.hpp:211
@ eLim_unk
unknown
Definition: Int_fuzz_.hpp:210
@ eLim_other
something else
Definition: Int_fuzz_.hpp:216
@ eLim_circle
artificial break at origin of circle
Definition: Int_fuzz_.hpp:215
@ eLim_lt
less than
Definition: Int_fuzz_.hpp:212
@ eLim_tl
space to left of position
Definition: Int_fuzz_.hpp:214
@ eLim_tr
space to right of position
Definition: Int_fuzz_.hpp:213
@ e_not_set
No variant selected.
Definition: Int_fuzz_.hpp:225
@ e_Pct
% plus or minus (x10) 0-1000
Definition: Int_fuzz_.hpp:228
@ e_Alt
set of alternatives for the integer
Definition: Int_fuzz_.hpp:230
@ e_P_m
plus or minus fixed amount
Definition: Int_fuzz_.hpp:226
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Mon Feb 26 04:05:55 2024 by modify_doxy.py rev. 669887