NCBI C++ ToolKit
Variation_inst_.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 Variation_inst_.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/seqfeat/seqfeat.asn">seqfeat.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqfeat/seqfeat.def">seqfeat.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_SEQFEAT_VARIATION_INST_BASE_HPP
42 #define OBJECTS_SEQFEAT_VARIATION_INST_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
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 // forward declarations
60 class CDelta_item;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_Variation
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 /// Variation instance
73 ///
74 /// CVariation_inst_Base --
75 ///
76 
78 {
80 public:
81  // constructor
83  // destructor
84  virtual ~CVariation_inst_Base(void);
85 
86  // type info
88 
89  enum EType {
90  eType_unknown = 0, ///< delta=[]
91  eType_identity = 1, ///< delta=[]
92  eType_inv = 2, ///< delta=[del, ins.seq= RevComp(variation-location)]
93  eType_snv = 3, ///< delta=[morph of length 1] NOTE: this is snV not snP; the latter requires frequency-based validation to be established in VariantProperties the strict definition of SNP is an SNV with an established population frequency of at least 1% in at least 1 popuplation
94  eType_mnp = 4, ///< delta=[morph of length >1]
95  eType_delins = 5, ///< delta=[del, ins]
96  eType_del = 6, ///< delta=[del]
97  eType_ins = 7, ///< delta=[ins]
98  eType_microsatellite = 8, ///< delta=[del, ins.seq= repeat-unit with fuzzy multiplier] variation-location is the microsat expansion on the sequence
99  eType_transposon = 9, ///< delta=[del, ins.seq= known donor or 'this'] variation-location is equiv of transposon locs.
100  eType_cnv = 10, ///< delta=[del, ins= 'this' with fuzzy multiplier]
101  eType_direct_copy = 11, ///< delta=[ins.seq= upstream location on the same strand]
102  eType_rev_direct_copy = 12, ///< delta=[ins.seq= downstream location on the same strand]
103  eType_inverted_copy = 13, ///< delta=[ins.seq= upstream location on the opposite strand]
104  eType_everted_copy = 14, ///< delta=[ins.seq= downstream location on the opposite strand]
105  eType_translocation = 15, ///< delta=like delins
106  eType_prot_missense = 16, ///< delta=[morph of length 1]
107  eType_prot_nonsense = 17, ///< delta=[del]; variation-location is the tail of the protein being truncated
108  eType_prot_neutral = 18, ///< delta=[morph of length 1]
109  eType_prot_silent = 19, ///< delta=[morph of length 1, same AA as at variation-location]
110  eType_prot_other = 20, ///< delta=any
111  eType_other = 255 ///< delta=any
112  };
113 
114  /// Access to EType's attributes (values, names) as defined in spec
115  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(EType)(void);
116 
117  /// 'observation' is used to label items in a Variation-ref package
118  /// This field is explicitly a bit-field, so the bitwise OR (= sum) of any
119  /// of the values may be observed.
121  eObservation_asserted = 1, ///< inst represents the asserted base at a position
122  eObservation_reference = 2, ///< inst represents the reference base at the position
123  eObservation_variant = 4 ///< inst represent the observed variant at a given position
124  };
125 
126  /// Access to EObservation's attributes (values, names) as defined in spec
127  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(EObservation)(void);
128 
129  // types
130  typedef int TType;
131  typedef list< CRef< CDelta_item > > TDelta;
132  typedef int TObservation;
133 
134  // member index
135  enum class E_memberIndex {
136  e__allMandatory = 0,
137  e_type,
138  e_delta,
139  e_observation
140  };
142 
143  // getters
144  // setters
145 
146  /// Check if a value has been assigned to Type data member.
147  ///
148  /// Data member Type is mandatory;
149  /// its type is defined as 'typedef int TType'
150  /// @return
151  /// - true, if a value has been assigned.
152  /// - false, otherwise.
153  bool IsSetType(void) const;
154 
155  /// Check if it is safe to call GetType method.
156  ///
157  /// @return
158  /// - true, if the data member is getatable.
159  /// - false, otherwise.
160  bool CanGetType(void) const;
161 
162  /// Reset Type data member.
163  void ResetType(void);
164 
165  /// Get the Type member data.
166  ///
167  /// @return
168  /// Copy of the member data.
169  TType GetType(void) const;
170 
171  /// Assign a value to Type data member.
172  ///
173  /// @param value
174  /// Value to assign
175  void SetType(TType value);
176 
177  /// Assign a value to Type data member.
178  ///
179  /// @return
180  /// Reference to the data value.
181  TType& SetType(void);
182 
183  /// Sequence that replaces the location, in biological order.
184  /// Check if a value has been assigned to Delta data member.
185  ///
186  /// Data member Delta is mandatory;
187  /// its type is defined as 'typedef list< CRef< CDelta_item > > TDelta'
188  /// @return
189  /// - true, if a value has been assigned.
190  /// - false, otherwise.
191  bool IsSetDelta(void) const;
192 
193  /// Check if it is safe to call GetDelta method.
194  ///
195  /// @return
196  /// - true, if the data member is getatable.
197  /// - false, otherwise.
198  bool CanGetDelta(void) const;
199 
200  /// Reset Delta data member.
201  void ResetDelta(void);
202 
203  /// Get the Delta member data.
204  ///
205  /// @return
206  /// Reference to the member data.
207  const TDelta& GetDelta(void) const;
208 
209  /// Assign a value to Delta data member.
210  ///
211  /// @return
212  /// Reference to the data value.
213  TDelta& SetDelta(void);
214 
215  /// Check if a value has been assigned to Observation data member.
216  ///
217  /// Data member Observation is optional;
218  /// its type is defined as 'typedef int TObservation'
219  /// @return
220  /// - true, if a value has been assigned.
221  /// - false, otherwise.
222  bool IsSetObservation(void) const;
223 
224  /// Check if it is safe to call GetObservation method.
225  ///
226  /// @return
227  /// - true, if the data member is getatable.
228  /// - false, otherwise.
229  bool CanGetObservation(void) const;
230 
231  /// Reset Observation data member.
232  void ResetObservation(void);
233 
234  /// Get the Observation member data.
235  ///
236  /// @return
237  /// Copy of the member data.
238  TObservation GetObservation(void) const;
239 
240  /// Assign a value to Observation data member.
241  ///
242  /// @param value
243  /// Value to assign
244  void SetObservation(TObservation value);
245 
246  /// Assign a value to Observation data member.
247  ///
248  /// @return
249  /// Reference to the data value.
250  TObservation& SetObservation(void);
251 
252  /// Reset the whole object
253  virtual void Reset(void);
254 
255 
256 private:
257  // Prohibit copy constructor and assignment operator
260 
261  // data
262  Uint4 m_set_State[1];
263  int m_Type;
264  list< CRef< CDelta_item > > m_Delta;
266 };
267 
268 /* @} */
269 
270 
271 
272 
273 
274 ///////////////////////////////////////////////////////////
275 ///////////////////// inline methods //////////////////////
276 ///////////////////////////////////////////////////////////
277 inline
279 {
280  return ((m_set_State[0] & 0x3) != 0);
281 }
282 
283 inline
285 {
286  return IsSetType();
287 }
288 
289 inline
291 {
292  m_Type = (EType)(0);
293  m_set_State[0] &= ~0x3;
294 }
295 
296 inline
298 {
299  if (!CanGetType()) {
300  ThrowUnassigned(0);
301  }
302  return m_Type;
303 }
304 
305 inline
307 {
308  m_Type = value;
309  m_set_State[0] |= 0x3;
310 }
311 
312 inline
314 {
315 #ifdef _DEBUG
316  if (!IsSetType()) {
317  memset(&m_Type,UnassignedByte(),sizeof(m_Type));
318  }
319 #endif
320  m_set_State[0] |= 0x1;
321  return m_Type;
322 }
323 
324 inline
326 {
327  return ((m_set_State[0] & 0xc) != 0);
328 }
329 
330 inline
332 {
333  return true;
334 }
335 
336 inline
338 {
339  return m_Delta;
340 }
341 
342 inline
344 {
345  m_set_State[0] |= 0x4;
346  return m_Delta;
347 }
348 
349 inline
351 {
352  return ((m_set_State[0] & 0x30) != 0);
353 }
354 
355 inline
357 {
358  return IsSetObservation();
359 }
360 
361 inline
363 {
365  m_set_State[0] &= ~0x30;
366 }
367 
368 inline
370 {
371  if (!CanGetObservation()) {
372  ThrowUnassigned(2);
373  }
374  return m_Observation;
375 }
376 
377 inline
379 {
381  m_set_State[0] |= 0x30;
382 }
383 
384 inline
386 {
387 #ifdef _DEBUG
388  if (!IsSetObservation()) {
389  memset(&m_Observation,UnassignedByte(),sizeof(m_Observation));
390  }
391 #endif
392  m_set_State[0] |= 0x10;
393  return m_Observation;
394 }
395 
396 ///////////////////////////////////////////////////////////
397 ////////////////// end of inline methods //////////////////
398 ///////////////////////////////////////////////////////////
399 
400 
401 
402 
403 
404 END_objects_SCOPE // namespace ncbi::objects::
405 
407 
408 
409 #endif // OBJECTS_SEQFEAT_VARIATION_INST_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
Variation instance.
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
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_SEQFEAT_EXPORT
Definition: ncbi_export.h:768
TType GetType(void) const
Get the Type member data.
TObservation GetObservation(void) const
Get the Observation member data.
void ResetType(void)
Reset Type data member.
void ResetObservation(void)
Reset Observation data member.
bool IsSetDelta(void) const
Sequence that replaces the location, in biological order.
bool CanGetType(void) const
Check if it is safe to call GetType method.
const TDelta & GetDelta(void) const
Get the Delta member data.
CVariation_inst_Base(const CVariation_inst_Base &)
TObservation & SetObservation(void)
Assign a value to Observation data member.
list< CRef< CDelta_item > > m_Delta
bool CanGetDelta(void) const
Check if it is safe to call GetDelta method.
bool CanGetObservation(void) const
Check if it is safe to call GetObservation method.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
list< CRef< CDelta_item > > TDelta
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
bool IsSetObservation(void) const
Check if a value has been assigned to Observation data member.
TType & SetType(void)
Assign a value to Type data member.
EObservation
'observation' is used to label items in a Variation-ref package This field is explicitly a bit-field,...
TDelta & SetDelta(void)
Assign a value to Delta data member.
CVariation_inst_Base & operator=(const CVariation_inst_Base &)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Thu Apr 25 08:17:04 2024 by modify_doxy.py rev. 669887