NCBI C++ ToolKit
Seq_loc_.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 Seq_loc_.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/seqloc/seqloc.asn">seqloc.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqloc/seqloc.def">seqloc.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_SEQLOC_SEQ_LOC_BASE_HPP
42 #define OBJECTS_SEQLOC_SEQ_LOC_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 // forward declarations
56 class CFeat_id;
57 class CPacked_seqint;
58 class CPacked_seqpnt;
59 class CSeq_bond;
60 class CSeq_id;
61 class CSeq_interval;
62 class CSeq_loc_equiv;
63 class CSeq_loc_mix;
64 class CSeq_point;
65 
66 
67 // generated classes
68 
69 
70 /** @addtogroup dataspec_NCBI_Seqloc
71  *
72  * @{
73  */
74 
75 /////////////////////////////////////////////////////////////////////////////
76 ///*** Sequence locations **********************************
77 ///*
78 ///
79 /// CSeq_loc_Base --
80 ///
81 
83 {
85 public:
86  // constructor
87  CSeq_loc_Base(void);
88  // destructor
89  virtual ~CSeq_loc_Base(void);
90 
91  // type info
93 
94 
95  /// Choice variants.
96  enum E_Choice {
97  e_not_set = 0, ///< No variant selected
98  e_Null, ///< not placed
99  e_Empty, ///< to NULL one Seq-id in a collection
100  e_Whole, ///< whole sequence
101  e_Int, ///< from to
106  e_Equiv, ///< equivalent sets of locations
108  e_Feat ///< indirect, through a Seq-feat
109  };
110  /// Maximum+1 value of the choice variant enumerator.
112  e_MaxChoice = 12 ///< == e_Feat+1
113  };
114 
115  /// Reset the whole object
116  virtual void Reset(void);
117 
118  /// Reset the selection (set it to e_not_set).
119  virtual void ResetSelection(void);
120 
121  /// Which variant is currently selected.
122  ///
123  /// @return
124  /// Choice state enumerator.
125  E_Choice Which(void) const;
126 
127  /// Verify selection, throw exception if it differs from the expected.
128  ///
129  /// @param index
130  /// Expected selection.
131  void CheckSelected(E_Choice index) const;
132 
133  /// Throw 'InvalidSelection' exception.
134  ///
135  /// @param index
136  /// Expected selection.
137  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
138 
139  /// Retrieve selection name (for diagnostic purposes).
140  ///
141  /// @param index
142  /// One of possible selection states.
143  /// @return
144  /// Name string.
145  static string SelectionName(E_Choice index);
146 
147  /// Select the requested variant if needed.
148  ///
149  /// @param index
150  /// New selection state.
151  /// @param reset
152  /// Flag that defines the resetting of the variant data. The data will
153  /// be reset if either the current selection differs from the new one,
154  /// or the flag is set to eDoResetVariant.
156  /// Select the requested variant if needed,
157  /// allocating CObject variants from memory pool.
158  void Select(E_Choice index,
159  EResetVariant reset,
160  CObjectMemoryPool* pool);
161 
162  // types
163  typedef CSeq_id TEmpty;
164  typedef CSeq_id TWhole;
167  typedef CSeq_point TPnt;
171  typedef CSeq_bond TBond;
172  typedef CFeat_id TFeat;
173 
174  // getters
175  // setters
176 
177 
178  /// Check if variant Null is selected.
179  ///
180  /// @return
181  /// - true, if the variant is selected.
182  /// - false, otherwise.
183  bool IsNull(void) const;
184 
185  /// Select the variant.
186  void SetNull(void);
187 
188 
189  /// Check if variant Empty is selected.
190  ///
191  /// Empty type is defined as 'typedef CSeq_id TEmpty'.
192  /// @return
193  /// - true, if the variant is selected.
194  /// - false, otherwise.
195  bool IsEmpty(void) const;
196 
197  /// Get the variant data.
198  ///
199  /// @return
200  /// Reference to the data.
201  const TEmpty& GetEmpty(void) const;
202 
203  /// Select the variant.
204  ///
205  /// @return
206  /// Reference to the variant data.
207  TEmpty& SetEmpty(void);
208  /// Select the variant and set its data.
209  ///
210  /// @param value
211  /// Reference to the data.
212  void SetEmpty(TEmpty& value);
213 
214 
215  /// Check if variant Whole is selected.
216  ///
217  /// Whole type is defined as 'typedef CSeq_id TWhole'.
218  /// @return
219  /// - true, if the variant is selected.
220  /// - false, otherwise.
221  bool IsWhole(void) const;
222 
223  /// Get the variant data.
224  ///
225  /// @return
226  /// Reference to the data.
227  const TWhole& GetWhole(void) const;
228 
229  /// Select the variant.
230  ///
231  /// @return
232  /// Reference to the variant data.
233  TWhole& SetWhole(void);
234  /// Select the variant and set its data.
235  ///
236  /// @param value
237  /// Reference to the data.
238  void SetWhole(TWhole& value);
239 
240 
241  /// Check if variant Int is selected.
242  ///
243  /// Int type is defined as 'typedef CSeq_interval TInt'.
244  /// @return
245  /// - true, if the variant is selected.
246  /// - false, otherwise.
247  bool IsInt(void) const;
248 
249  /// Get the variant data.
250  ///
251  /// @return
252  /// Reference to the data.
253  const TInt& GetInt(void) const;
254 
255  /// Select the variant.
256  ///
257  /// @return
258  /// Reference to the variant data.
259  TInt& SetInt(void);
260  /// Select the variant and set its data.
261  ///
262  /// @param value
263  /// Reference to the data.
264  void SetInt(TInt& value);
265 
266 
267  /// Check if variant Packed_int is selected.
268  ///
269  /// Packed_int type is defined as 'typedef CPacked_seqint TPacked_int'.
270  /// @return
271  /// - true, if the variant is selected.
272  /// - false, otherwise.
273  bool IsPacked_int(void) const;
274 
275  /// Get the variant data.
276  ///
277  /// @return
278  /// Reference to the data.
279  const TPacked_int& GetPacked_int(void) const;
280 
281  /// Select the variant.
282  ///
283  /// @return
284  /// Reference to the variant data.
285  TPacked_int& SetPacked_int(void);
286  /// Select the variant and set its data.
287  ///
288  /// @param value
289  /// Reference to the data.
290  void SetPacked_int(TPacked_int& value);
291 
292 
293  /// Check if variant Pnt is selected.
294  ///
295  /// Pnt type is defined as 'typedef CSeq_point TPnt'.
296  /// @return
297  /// - true, if the variant is selected.
298  /// - false, otherwise.
299  bool IsPnt(void) const;
300 
301  /// Get the variant data.
302  ///
303  /// @return
304  /// Reference to the data.
305  const TPnt& GetPnt(void) const;
306 
307  /// Select the variant.
308  ///
309  /// @return
310  /// Reference to the variant data.
311  TPnt& SetPnt(void);
312  /// Select the variant and set its data.
313  ///
314  /// @param value
315  /// Reference to the data.
316  void SetPnt(TPnt& value);
317 
318 
319  /// Check if variant Packed_pnt is selected.
320  ///
321  /// Packed_pnt type is defined as 'typedef CPacked_seqpnt TPacked_pnt'.
322  /// @return
323  /// - true, if the variant is selected.
324  /// - false, otherwise.
325  bool IsPacked_pnt(void) const;
326 
327  /// Get the variant data.
328  ///
329  /// @return
330  /// Reference to the data.
331  const TPacked_pnt& GetPacked_pnt(void) const;
332 
333  /// Select the variant.
334  ///
335  /// @return
336  /// Reference to the variant data.
337  TPacked_pnt& SetPacked_pnt(void);
338  /// Select the variant and set its data.
339  ///
340  /// @param value
341  /// Reference to the data.
342  void SetPacked_pnt(TPacked_pnt& value);
343 
344 
345  /// Check if variant Mix is selected.
346  ///
347  /// Mix type is defined as 'typedef CSeq_loc_mix TMix'.
348  /// @return
349  /// - true, if the variant is selected.
350  /// - false, otherwise.
351  bool IsMix(void) const;
352 
353  /// Get the variant data.
354  ///
355  /// @return
356  /// Reference to the data.
357  const TMix& GetMix(void) const;
358 
359  /// Select the variant.
360  ///
361  /// @return
362  /// Reference to the variant data.
363  TMix& SetMix(void);
364  /// Select the variant and set its data.
365  ///
366  /// @param value
367  /// Reference to the data.
368  void SetMix(TMix& value);
369 
370 
371  /// Check if variant Equiv is selected.
372  ///
373  /// Equiv type is defined as 'typedef CSeq_loc_equiv TEquiv'.
374  /// @return
375  /// - true, if the variant is selected.
376  /// - false, otherwise.
377  bool IsEquiv(void) const;
378 
379  /// Get the variant data.
380  ///
381  /// @return
382  /// Reference to the data.
383  const TEquiv& GetEquiv(void) const;
384 
385  /// Select the variant.
386  ///
387  /// @return
388  /// Reference to the variant data.
389  TEquiv& SetEquiv(void);
390  /// Select the variant and set its data.
391  ///
392  /// @param value
393  /// Reference to the data.
394  void SetEquiv(TEquiv& value);
395 
396 
397  /// Check if variant Bond is selected.
398  ///
399  /// Bond type is defined as 'typedef CSeq_bond TBond'.
400  /// @return
401  /// - true, if the variant is selected.
402  /// - false, otherwise.
403  bool IsBond(void) const;
404 
405  /// Get the variant data.
406  ///
407  /// @return
408  /// Reference to the data.
409  const TBond& GetBond(void) const;
410 
411  /// Select the variant.
412  ///
413  /// @return
414  /// Reference to the variant data.
415  TBond& SetBond(void);
416  /// Select the variant and set its data.
417  ///
418  /// @param value
419  /// Reference to the data.
420  void SetBond(TBond& value);
421 
422 
423  /// Check if variant Feat is selected.
424  ///
425  /// Feat type is defined as 'typedef CFeat_id TFeat'.
426  /// @return
427  /// - true, if the variant is selected.
428  /// - false, otherwise.
429  bool IsFeat(void) const;
430 
431  /// Get the variant data.
432  ///
433  /// @return
434  /// Reference to the data.
435  const TFeat& GetFeat(void) const;
436 
437  /// Select the variant.
438  ///
439  /// @return
440  /// Reference to the variant data.
441  TFeat& SetFeat(void);
442  /// Select the variant and set its data.
443  ///
444  /// @param value
445  /// Reference to the data.
446  void SetFeat(TFeat& value);
447 
448 
449 private:
450  // copy constructor and assignment operator
453  // choice state
455  // helper methods
456  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
457 
458  static const char* const sm_SelectionNames[];
459  // data
460  union {
461  NCBI_NS_NCBI::CSerialObject *m_object;
462  };
463 };
464 
465 /* @} */
466 
467 
468 
469 
470 
471 ///////////////////////////////////////////////////////////
472 ///////////////////// inline methods //////////////////////
473 ///////////////////////////////////////////////////////////
474 inline
476 {
477  return m_choice;
478 }
479 
480 inline
482 {
483  if ( m_choice != index )
484  ThrowInvalidSelection(index);
485 }
486 
487 inline
488 void CSeq_loc_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
489 {
490  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
491  if ( m_choice != e_not_set )
492  ResetSelection();
493  DoSelect(index, pool);
494  }
495 }
496 
497 inline
498 void CSeq_loc_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
499 {
500  Select(index, reset, 0);
501 }
502 
503 inline
504 bool CSeq_loc_Base::IsNull(void) const
505 {
506  return m_choice == e_Null;
507 }
508 
509 inline
511 {
513 }
514 
515 inline
516 bool CSeq_loc_Base::IsEmpty(void) const
517 {
518  return m_choice == e_Empty;
519 }
520 
521 inline
522 bool CSeq_loc_Base::IsWhole(void) const
523 {
524  return m_choice == e_Whole;
525 }
526 
527 inline
528 bool CSeq_loc_Base::IsInt(void) const
529 {
530  return m_choice == e_Int;
531 }
532 
533 inline
535 {
536  return m_choice == e_Packed_int;
537 }
538 
539 inline
540 bool CSeq_loc_Base::IsPnt(void) const
541 {
542  return m_choice == e_Pnt;
543 }
544 
545 inline
547 {
548  return m_choice == e_Packed_pnt;
549 }
550 
551 inline
552 bool CSeq_loc_Base::IsMix(void) const
553 {
554  return m_choice == e_Mix;
555 }
556 
557 inline
558 bool CSeq_loc_Base::IsEquiv(void) const
559 {
560  return m_choice == e_Equiv;
561 }
562 
563 inline
564 bool CSeq_loc_Base::IsBond(void) const
565 {
566  return m_choice == e_Bond;
567 }
568 
569 inline
570 bool CSeq_loc_Base::IsFeat(void) const
571 {
572  return m_choice == e_Feat;
573 }
574 
575 ///////////////////////////////////////////////////////////
576 ////////////////// end of inline methods //////////////////
577 ///////////////////////////////////////////////////////////
578 
579 
580 
581 
582 
583 END_objects_SCOPE // namespace ncbi::objects::
584 
586 
587 
588 #endif // OBJECTS_SEQLOC_SEQ_LOC_BASE_HPP
CFeat_id –.
Definition: Feat_id.hpp:66
*** Sequence locations ********************************** *
Definition: Seq_loc_.hpp:83
Base class for all serializable objects.
Definition: serialbase.hpp:150
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
#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_SEQLOC_EXPORT
Definition: ncbi_export.h:776
CSeq_interval TInt
Definition: Seq_loc_.hpp:165
bool IsMix(void) const
Check if variant Mix is selected.
Definition: Seq_loc_.hpp:552
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsEmpty(void) const
Check if variant Empty is selected.
Definition: Seq_loc_.hpp:516
void SetNull(void)
Select the variant.
Definition: Seq_loc_.hpp:510
bool IsFeat(void) const
Check if variant Feat is selected.
Definition: Seq_loc_.hpp:570
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Seq_loc_.cpp:65
CPacked_seqpnt TPacked_pnt
Definition: Seq_loc_.hpp:168
CSeq_bond TBond
Definition: Seq_loc_.hpp:171
bool IsPacked_pnt(void) const
Check if variant Packed_pnt is selected.
Definition: Seq_loc_.hpp:546
CSeq_loc_mix TMix
Definition: Seq_loc_.hpp:169
bool IsEquiv(void) const
Check if variant Equiv is selected.
Definition: Seq_loc_.hpp:558
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Seq_loc_.hpp:461
CSerialObject Tparent
Definition: Seq_loc_.hpp:84
DECLARE_INTERNAL_TYPE_INFO()
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
CPacked_seqint TPacked_int
Definition: Seq_loc_.hpp:166
bool IsBond(void) const
Check if variant Bond is selected.
Definition: Seq_loc_.hpp:564
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Seq_loc_.hpp:111
CSeq_id TWhole
Definition: Seq_loc_.hpp:164
CSeq_loc_Base(const CSeq_loc_Base &)
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Seq_loc_.cpp:86
CSeq_loc_Base & operator=(const CSeq_loc_Base &)
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
Definition: Seq_loc_.hpp:534
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
CFeat_id TFeat
Definition: Seq_loc_.hpp:172
CSeq_point TPnt
Definition: Seq_loc_.hpp:167
CSeq_loc_equiv TEquiv
Definition: Seq_loc_.hpp:170
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
bool IsInt(void) const
Check if variant Int is selected.
Definition: Seq_loc_.hpp:528
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Seq_loc_.cpp:145
bool IsNull(void) const
Check if variant Null is selected.
Definition: Seq_loc_.hpp:504
E_Choice
Choice variants.
Definition: Seq_loc_.hpp:96
bool IsPnt(void) const
Check if variant Pnt is selected.
Definition: Seq_loc_.hpp:540
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Seq_loc_.hpp:481
E_Choice m_choice
Definition: Seq_loc_.hpp:454
CSeq_id TEmpty
Definition: Seq_loc_.hpp:163
@ e_not_set
No variant selected.
Definition: Seq_loc_.hpp:97
@ e_Null
not placed
Definition: Seq_loc_.hpp:98
@ e_Equiv
equivalent sets of locations
Definition: Seq_loc_.hpp:106
@ e_Empty
to NULL one Seq-id in a collection
Definition: Seq_loc_.hpp:99
@ e_Feat
indirect, through a Seq-feat
Definition: Seq_loc_.hpp:108
@ e_Int
from to
Definition: Seq_loc_.hpp:101
@ e_Whole
whole sequence
Definition: Seq_loc_.hpp:100
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue May 07 08:16:37 2024 by modify_doxy.py rev. 669887