NCBI C++ ToolKit
VariationException_.hpp
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  */
27 
28 /// @file VariationException_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/variation/variation.asn">variation.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/variation/variation.def">variation.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef OBJECTS_VARIATION_VARIATIONEXCEPTION_BASE_HPP
42 #define OBJECTS_VARIATION_VARIATIONEXCEPTION_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_VariationPackage
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CVariationException_Base --
70 ///
71 
73 {
75 public:
76  // constructor
78  // destructor
79  virtual ~CVariationException_Base(void);
80 
81  // type info
83 
84  enum ECode {
85  eCode_hgvs_parsing = 1, ///<invalid hgvs expression
86  eCode_hgvs_exon_boundary = 2, ///<anchor position in an intronic HGVS expression is not at an exon boundary
87  eCode_inconsistent_consequence = 3, ///<consequence protein variation attached to precursor variation's consequence could not be derived from it.
88  eCode_inconsistent_asserted_allele = 4, ///<asserted allele is inconsistent with the reference
89  eCode_no_mapping = 5, ///<could not remap
90  eCode_partial_mapping = 6, ///<mapped location is shorter than the query
91  eCode_split_mapping = 7, ///<a source interval maps to multiple non-abutting intervals.
92  eCode_mismatches_in_mapping = 8, ///<the source sequence differs from sequence at mapped loc
93  eCode_inconsistent_asserted_moltype = 9, ///<asserted mol-type is inconsistent with seq-id (e.g. NM_12345.6:g.)
94  eCode_bioseq_state = 10,
95  eCode_ambiguous_sequence = 11,
96  eCode_ref_same_as_variant = 12, ///<reference sequence at the location is same as variant sequence in the variation
97  eCode_seqfetch_too_long = 13, ///<can't fetch sequence because location is longer than specified threshold
98  eCode_seqfetch_intronic = 14, ///<can't fetch sequence for an intronic (anchor+offset)-based location
99  eCode_seqfetch_invalid = 15, ///<can't fetch sequence because location is invalid (e.g. extends past the end)
100  eCode_no_mapping_from_newer_version = 16, ///<have mapping from older version of a sequence, but not from newer
101  eCode_source_location_overhang = 17, ///<The source location overhangs the alignment by at least 5kb (VAR-1307)
102  eCode_hgvs_exon_boundary_induced = 18 ///<Similar to (2), except induced by 5'/3'-terminal or an exon extension (VAR-1309)
103  };
104 
105  /// Access to ECode's attributes (values, names) as defined in spec
106  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ECode)(void);
107 
108  // types
109  typedef int TCode;
110  typedef string TMessage;
111 
112  // member index
113  enum class E_memberIndex {
114  e__allMandatory = 0,
115  e_code,
116  e_message
117  };
119 
120  // getters
121  // setters
122 
123  /// Check if a value has been assigned to Code data member.
124  ///
125  /// Data member Code is optional;
126  /// its type is defined as 'typedef int TCode'
127  /// @return
128  /// - true, if a value has been assigned.
129  /// - false, otherwise.
130  bool IsSetCode(void) const;
131 
132  /// Check if it is safe to call GetCode method.
133  ///
134  /// @return
135  /// - true, if the data member is getatable.
136  /// - false, otherwise.
137  bool CanGetCode(void) const;
138 
139  /// Reset Code data member.
140  void ResetCode(void);
141 
142  /// Get the Code member data.
143  ///
144  /// @return
145  /// Copy of the member data.
146  TCode GetCode(void) const;
147 
148  /// Assign a value to Code data member.
149  ///
150  /// @param value
151  /// Value to assign
152  void SetCode(TCode value);
153 
154  /// Assign a value to Code data member.
155  ///
156  /// @return
157  /// Reference to the data value.
158  TCode& SetCode(void);
159 
160  /// Check if a value has been assigned to Message data member.
161  ///
162  /// Data member Message is mandatory;
163  /// its type is defined as 'typedef string TMessage'
164  /// @return
165  /// - true, if a value has been assigned.
166  /// - false, otherwise.
167  bool IsSetMessage(void) const;
168 
169  /// Check if it is safe to call GetMessage method.
170  ///
171  /// @return
172  /// - true, if the data member is getatable.
173  /// - false, otherwise.
174  bool CanGetMessage(void) const;
175 
176  /// Reset Message data member.
177  void ResetMessage(void);
178 
179  /// Get the Message member data.
180  ///
181  /// @return
182  /// Reference to the member data.
183  const TMessage& GetMessage(void) const;
184 
185  /// Assign a value to Message data member.
186  ///
187  /// @param value
188  /// Value to assign
189  void SetMessage(const TMessage& value);
190  void SetMessage(TMessage&& value);
191 
192  /// Assign a value to Message data member.
193  ///
194  /// @return
195  /// Reference to the data value.
196  TMessage& SetMessage(void);
197 
198  /// Reset the whole object
199  virtual void Reset(void);
200 
201 
202 private:
203  // Prohibit copy constructor and assignment operator
206 
207  // data
208  Uint4 m_set_State[1];
209  int m_Code;
210  string m_Message;
211 };
212 
213 /* @} */
214 
215 
216 
217 
218 
219 ///////////////////////////////////////////////////////////
220 ///////////////////// inline methods //////////////////////
221 ///////////////////////////////////////////////////////////
222 inline
224 {
225  return ((m_set_State[0] & 0x3) != 0);
226 }
227 
228 inline
230 {
231  return IsSetCode();
232 }
233 
234 inline
236 {
237  m_Code = (ECode)(0);
238  m_set_State[0] &= ~0x3;
239 }
240 
241 inline
243 {
244  if (!CanGetCode()) {
245  ThrowUnassigned(0);
246  }
247  return m_Code;
248 }
249 
250 inline
252 {
253  m_Code = value;
254  m_set_State[0] |= 0x3;
255 }
256 
257 inline
259 {
260 #ifdef _DEBUG
261  if (!IsSetCode()) {
262  memset(&m_Code,UnassignedByte(),sizeof(m_Code));
263  }
264 #endif
265  m_set_State[0] |= 0x1;
266  return m_Code;
267 }
268 
269 inline
271 {
272  return ((m_set_State[0] & 0xc) != 0);
273 }
274 
275 inline
277 {
278  return IsSetMessage();
279 }
280 
281 inline
283 {
284  if (!CanGetMessage()) {
285  ThrowUnassigned(1);
286  }
287  return m_Message;
288 }
289 
290 inline
292 {
293  m_Message = value;
294  m_set_State[0] |= 0xc;
295 }
296 
297 inline
299 {
300  m_Message = std::forward<CVariationException_Base::TMessage>(value);
301  m_set_State[0] |= 0xc;
302 }
303 
304 inline
306 {
307 #ifdef _DEBUG
308  if (!IsSetMessage()) {
310  }
311 #endif
312  m_set_State[0] |= 0x4;
313  return m_Message;
314 }
315 
316 ///////////////////////////////////////////////////////////
317 ////////////////// end of inline methods //////////////////
318 ///////////////////////////////////////////////////////////
319 
320 
321 
322 
323 
324 END_objects_SCOPE // namespace ncbi::objects::
325 
327 
328 
329 #endif // OBJECTS_VARIATION_VARIATIONEXCEPTION_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CVariationException_Base –.
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
static string UnassignedString(void)
Definition: serialbase.hpp:175
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_VARIATION_EXPORT
Definition: ncbi_export.h:873
TMessage & SetMessage(void)
Assign a value to Message data member.
TCode GetCode(void) const
Get the Code member data.
const TMessage & GetMessage(void) const
Get the Message member data.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
void ResetCode(void)
Reset Code data member.
bool CanGetCode(void) const
Check if it is safe to call GetCode method.
CVariationException_Base & operator=(const CVariationException_Base &)
bool IsSetCode(void) const
Check if a value has been assigned to Code data member.
bool IsSetMessage(void) const
Check if a value has been assigned to Message data member.
bool CanGetMessage(void) const
Check if it is safe to call GetMessage method.
CVariationException_Base(const CVariationException_Base &)
TCode & SetCode(void)
Assign a value to Code data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:29 2024 by modify_doxy.py rev. 669887