NCBI C++ ToolKit
Spliced_exon_chunk_.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 Spliced_exon_chunk_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqalign/seqalign.asn">seqalign.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqalign/seqalign.def">seqalign.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_SEQALIGN_SPLICED_EXON_CHUNK_BASE_HPP
42 #define OBJECTS_SEQALIGN_SPLICED_EXON_CHUNK_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
47 
48 #ifndef BEGIN_objects_SCOPE
49 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
50 # define END_objects_SCOPE END_SCOPE(objects)
51 #endif
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 
55 // generated classes
56 
57 
58 /** @addtogroup dataspec_NCBI_Seqalign
59  *
60  * @{
61  */
62 
63 /////////////////////////////////////////////////////////////////////////////
64 /// Spliced-exon-chunk: piece of an exon
65 /// lengths are given in nucleotide bases (1/3 of aminoacid when product is a
66 /// protein)
67 ///
68 /// CSpliced_exon_chunk_Base --
69 ///
70 
72 {
74 public:
75  // constructor
77  // destructor
78  virtual ~CSpliced_exon_chunk_Base(void);
79 
80  // type info
82 
83 
84  /// Choice variants.
85  enum E_Choice {
86  e_not_set = 0, ///< No variant selected
87  e_Match, ///< both sequences represented, product and genomic sequences match
88  e_Mismatch, ///< both sequences represented, product and genomic sequences do not match
89  e_Diag, ///< both sequences are represented, there is sufficient similarity between product and genomic sequences. Can be used to replace stretches of matches and mismatches, mostly for protein to genomic where definition of match or mismatch depends on translation table
90  e_Product_ins, ///< insertion in product sequence (i.e. gap in the genomic sequence)
91  e_Genomic_ins ///< insertion in genomic sequence (i.e. gap in the product sequence)
92  };
93  /// Maximum+1 value of the choice variant enumerator.
95  e_MaxChoice = 6 ///< == e_Genomic_ins+1
96  };
97 
98  /// Reset the whole object
99  virtual void Reset(void);
100 
101  /// Reset the selection (set it to e_not_set).
102  virtual void ResetSelection(void);
103 
104  /// Which variant is currently selected.
105  ///
106  /// @return
107  /// Choice state enumerator.
108  E_Choice Which(void) const;
109 
110  /// Verify selection, throw exception if it differs from the expected.
111  ///
112  /// @param index
113  /// Expected selection.
114  void CheckSelected(E_Choice index) const;
115 
116  /// Throw 'InvalidSelection' exception.
117  ///
118  /// @param index
119  /// Expected selection.
120  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
121 
122  /// Retrieve selection name (for diagnostic purposes).
123  ///
124  /// @param index
125  /// One of possible selection states.
126  /// @return
127  /// Name string.
128  static string SelectionName(E_Choice index);
129 
130  /// Select the requested variant if needed.
131  ///
132  /// @param index
133  /// New selection state.
134  /// @param reset
135  /// Flag that defines the resetting of the variant data. The data will
136  /// be reset if either the current selection differs from the new one,
137  /// or the flag is set to eDoResetVariant.
138  void Select(E_Choice index, EResetVariant reset = eDoResetVariant);
139  /// Select the requested variant if needed,
140  /// allocating CObject variants from memory pool.
141  void Select(E_Choice index,
142  EResetVariant reset,
143  CObjectMemoryPool* pool);
144 
145  // types
146  typedef TSeqPos TMatch;
148  typedef TSeqPos TDiag;
151 
152  // getters
153  // setters
154 
155 
156  /// Check if variant Match is selected.
157  ///
158  /// Match type is defined as 'typedef TSeqPos TMatch'.
159  /// @return
160  /// - true, if the variant is selected.
161  /// - false, otherwise.
162  bool IsMatch(void) const;
163 
164  /// Get the variant data.
165  ///
166  /// @return
167  /// Copy of the variant data.
168  TMatch GetMatch(void) const;
169 
170  /// Select the variant.
171  ///
172  /// @return
173  /// Reference to the variant data.
174  TMatch& SetMatch(void);
175 
176  /// Select the variant and set its data.
177  ///
178  /// @param value
179  /// Variant data.
180  void SetMatch(TMatch value);
181 
182 
183  /// Check if variant Mismatch is selected.
184  ///
185  /// Mismatch type is defined as 'typedef TSeqPos TMismatch'.
186  /// @return
187  /// - true, if the variant is selected.
188  /// - false, otherwise.
189  bool IsMismatch(void) const;
190 
191  /// Get the variant data.
192  ///
193  /// @return
194  /// Copy of the variant data.
195  TMismatch GetMismatch(void) const;
196 
197  /// Select the variant.
198  ///
199  /// @return
200  /// Reference to the variant data.
201  TMismatch& SetMismatch(void);
202 
203  /// Select the variant and set its data.
204  ///
205  /// @param value
206  /// Variant data.
207  void SetMismatch(TMismatch value);
208 
209 
210  /// Check if variant Diag is selected.
211  ///
212  /// Diag type is defined as 'typedef TSeqPos TDiag'.
213  /// @return
214  /// - true, if the variant is selected.
215  /// - false, otherwise.
216  bool IsDiag(void) const;
217 
218  /// Get the variant data.
219  ///
220  /// @return
221  /// Copy of the variant data.
222  TDiag GetDiag(void) const;
223 
224  /// Select the variant.
225  ///
226  /// @return
227  /// Reference to the variant data.
228  TDiag& SetDiag(void);
229 
230  /// Select the variant and set its data.
231  ///
232  /// @param value
233  /// Variant data.
234  void SetDiag(TDiag value);
235 
236 
237  /// Check if variant Product_ins is selected.
238  ///
239  /// Product_ins type is defined as 'typedef TSeqPos TProduct_ins'.
240  /// @return
241  /// - true, if the variant is selected.
242  /// - false, otherwise.
243  bool IsProduct_ins(void) const;
244 
245  /// Get the variant data.
246  ///
247  /// @return
248  /// Copy of the variant data.
249  TProduct_ins GetProduct_ins(void) const;
250 
251  /// Select the variant.
252  ///
253  /// @return
254  /// Reference to the variant data.
255  TProduct_ins& SetProduct_ins(void);
256 
257  /// Select the variant and set its data.
258  ///
259  /// @param value
260  /// Variant data.
261  void SetProduct_ins(TProduct_ins value);
262 
263 
264  /// Check if variant Genomic_ins is selected.
265  ///
266  /// Genomic_ins type is defined as 'typedef TSeqPos TGenomic_ins'.
267  /// @return
268  /// - true, if the variant is selected.
269  /// - false, otherwise.
270  bool IsGenomic_ins(void) const;
271 
272  /// Get the variant data.
273  ///
274  /// @return
275  /// Copy of the variant data.
276  TGenomic_ins GetGenomic_ins(void) const;
277 
278  /// Select the variant.
279  ///
280  /// @return
281  /// Reference to the variant data.
282  TGenomic_ins& SetGenomic_ins(void);
283 
284  /// Select the variant and set its data.
285  ///
286  /// @param value
287  /// Variant data.
288  void SetGenomic_ins(TGenomic_ins value);
289 
290 
291 private:
292  // copy constructor and assignment operator
295  // choice state
297  // helper methods
298  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
299 
300  static const char* const sm_SelectionNames[];
301  // data
302  union {
303  TMatch m_Match;
304  TMismatch m_Mismatch;
305  TDiag m_Diag;
306  TProduct_ins m_Product_ins;
307  TGenomic_ins m_Genomic_ins;
308  };
309 };
310 
311 /* @} */
312 
313 
314 
315 
316 
317 ///////////////////////////////////////////////////////////
318 ///////////////////// inline methods //////////////////////
319 ///////////////////////////////////////////////////////////
320 inline
322 {
323  return m_choice;
324 }
325 
326 inline
328 {
329  if ( m_choice != index )
330  ThrowInvalidSelection(index);
331 }
332 
333 inline
334 void CSpliced_exon_chunk_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
335 {
336  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
337  if ( m_choice != e_not_set )
338  ResetSelection();
339  DoSelect(index, pool);
340  }
341 }
342 
343 inline
345 {
346  Select(index, reset, 0);
347 }
348 
349 inline
351 {
352  return m_choice == e_Match;
353 }
354 
355 inline
357 {
359  return m_Match;
360 }
361 
362 inline
364 {
366  return m_Match;
367 }
368 
369 inline
371 {
373  m_Match = value;
374 }
375 
376 inline
378 {
379  return m_choice == e_Mismatch;
380 }
381 
382 inline
384 {
386  return m_Mismatch;
387 }
388 
389 inline
391 {
393  return m_Mismatch;
394 }
395 
396 inline
398 {
400  m_Mismatch = value;
401 }
402 
403 inline
405 {
406  return m_choice == e_Diag;
407 }
408 
409 inline
411 {
413  return m_Diag;
414 }
415 
416 inline
418 {
420  return m_Diag;
421 }
422 
423 inline
425 {
427  m_Diag = value;
428 }
429 
430 inline
432 {
433  return m_choice == e_Product_ins;
434 }
435 
436 inline
438 {
440  return m_Product_ins;
441 }
442 
443 inline
445 {
447  return m_Product_ins;
448 }
449 
450 inline
452 {
455 }
456 
457 inline
459 {
460  return m_choice == e_Genomic_ins;
461 }
462 
463 inline
465 {
467  return m_Genomic_ins;
468 }
469 
470 inline
472 {
474  return m_Genomic_ins;
475 }
476 
477 inline
479 {
482 }
483 
484 ///////////////////////////////////////////////////////////
485 ////////////////// end of inline methods //////////////////
486 ///////////////////////////////////////////////////////////
487 
488 
489 
490 
491 
492 END_objects_SCOPE // namespace ncbi::objects::
493 
495 
496 
497 #endif // OBJECTS_SEQALIGN_SPLICED_EXON_CHUNK_BASE_HPP
#define DECLARE_INTERNAL_TYPE_INFO()
Definition: serialbase.hpp:749
insertion in genomic sequence (i.e. gap in the product sequence)
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:897
bool IsDiag(void) const
Check if variant Diag is selected.
#define NCBI_NORETURN
Definition: ncbiconf_msvc.h:73
TMismatch & SetMismatch(void)
Select the variant.
TMatch & SetMatch(void)
Select the variant.
TGenomic_ins & SetGenomic_ins(void)
Select the variant.
TGenomic_ins GetGenomic_ins(void) const
Get the variant data.
both sequences represented, product and genomic sequences match
bool IsProduct_ins(void) const
Check if variant Product_ins is selected.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsMatch(void) const
Check if variant Match is selected.
NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
both sequences represented, product and genomic sequences do not match
Spliced-exon-chunk: piece of an exon lengths are given in nucleotide bases (1/3 of aminoacid when pro...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
TDiag GetDiag(void) const
Get the variant data.
bool IsMismatch(void) const
Check if variant Mismatch is selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
#define NCBI_SEQALIGN_EXPORT
Definition: ncbi_export.h:751
EResetVariant
Definition: serialbase.hpp:75
insertion in product sequence (i.e. gap in the genomic sequence)
TMismatch GetMismatch(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
TMatch GetMatch(void) const
Get the variant data.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Base class for all serializable objects.
Definition: serialbase.hpp:148
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1185
bool IsGenomic_ins(void) const
Check if variant Genomic_ins is selected.
both sequences are represented, there is sufficient similarity between product and genomic sequences...
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
CObject & operator=(const CObject &src) THROWS_NONE
Assignment operator.
Definition: ncbiobj.hpp:483
TDiag & SetDiag(void)
Select the variant.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
TProduct_ins & SetProduct_ins(void)
Select the variant.
TProduct_ins GetProduct_ins(void) const
Get the variant data.
Modified on Sat Jul 04 12:46:11 2015 by modify_doxy.py rev. 426318