NCBI C++ ToolKit
Trna_ext_.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 Trna_ext_.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_TRNA_EXT_BASE_HPP
42 #define OBJECTS_SEQFEAT_TRNA_EXT_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 CSeq_loc;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_RNA
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 /// tRNA feature extensions
73 ///
74 /// CTrna_ext_Base --
75 ///
76 
78 {
80 public:
81  // constructor
82  CTrna_ext_Base(void);
83  // destructor
84  virtual ~CTrna_ext_Base(void);
85 
86  // type info
88 
89  /////////////////////////////////////////////////////////////////////////////
90  /// aa this carries
91  ///
92  /// C_Aa --
93  ///
94 
96  {
98  public:
99  // constructor
100  C_Aa(void);
101  // destructor
102  ~C_Aa(void);
103 
104  // type info
106 
107 
108  /// Choice variants.
109  enum E_Choice {
110  e_not_set = 0, ///< No variant selected
114  e_Ncbistdaa
115  };
116  /// Maximum+1 value of the choice variant enumerator.
118  e_MaxChoice = 5 ///< == e_Ncbistdaa+1
119  };
120 
121  /// Reset the whole object
122  void Reset(void);
123 
124  /// Reset the selection (set it to e_not_set).
125  void ResetSelection(void);
126 
127  /// Which variant is currently selected.
128  ///
129  /// @return
130  /// Choice state enumerator.
131  E_Choice Which(void) const;
132 
133  /// Verify selection, throw exception if it differs from the expected.
134  ///
135  /// @param index
136  /// Expected selection.
137  void CheckSelected(E_Choice index) const;
138 
139  /// Throw 'InvalidSelection' exception.
140  ///
141  /// @param index
142  /// Expected selection.
143  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
144 
145  /// Retrieve selection name (for diagnostic purposes).
146  ///
147  /// @param index
148  /// One of possible selection states.
149  /// @return
150  /// Name string.
151  static string SelectionName(E_Choice index);
152 
153  /// Select the requested variant if needed.
154  ///
155  /// @param index
156  /// New selection state.
157  /// @param reset
158  /// Flag that defines the resetting of the variant data. The data will
159  /// be reset if either the current selection differs from the new one,
160  /// or the flag is set to eDoResetVariant.
162  /// Select the requested variant if needed,
163  /// allocating CObject variants from memory pool.
164  void Select(E_Choice index,
165  EResetVariant reset,
166  CObjectMemoryPool* pool);
167 
168  // types
169  typedef int TIupacaa;
170  typedef int TNcbieaa;
171  typedef int TNcbi8aa;
172  typedef int TNcbistdaa;
173 
174  // getters
175  // setters
176 
177 
178  /// Check if variant Iupacaa is selected.
179  ///
180  /// Iupacaa type is defined as 'typedef int TIupacaa'.
181  /// @return
182  /// - true, if the variant is selected.
183  /// - false, otherwise.
184  bool IsIupacaa(void) const;
185 
186  /// Get the variant data.
187  ///
188  /// @return
189  /// Copy of the variant data.
190  TIupacaa GetIupacaa(void) const;
191 
192  /// Select the variant.
193  ///
194  /// @return
195  /// Reference to the variant data.
196  TIupacaa& SetIupacaa(void);
197 
198  /// Select the variant and set its data.
199  ///
200  /// @param value
201  /// Variant data.
202  void SetIupacaa(TIupacaa value);
203 
204 
205  /// Check if variant Ncbieaa is selected.
206  ///
207  /// Ncbieaa type is defined as 'typedef int TNcbieaa'.
208  /// @return
209  /// - true, if the variant is selected.
210  /// - false, otherwise.
211  bool IsNcbieaa(void) const;
212 
213  /// Get the variant data.
214  ///
215  /// @return
216  /// Copy of the variant data.
217  TNcbieaa GetNcbieaa(void) const;
218 
219  /// Select the variant.
220  ///
221  /// @return
222  /// Reference to the variant data.
223  TNcbieaa& SetNcbieaa(void);
224 
225  /// Select the variant and set its data.
226  ///
227  /// @param value
228  /// Variant data.
229  void SetNcbieaa(TNcbieaa value);
230 
231 
232  /// Check if variant Ncbi8aa is selected.
233  ///
234  /// Ncbi8aa type is defined as 'typedef int TNcbi8aa'.
235  /// @return
236  /// - true, if the variant is selected.
237  /// - false, otherwise.
238  bool IsNcbi8aa(void) const;
239 
240  /// Get the variant data.
241  ///
242  /// @return
243  /// Copy of the variant data.
244  TNcbi8aa GetNcbi8aa(void) const;
245 
246  /// Select the variant.
247  ///
248  /// @return
249  /// Reference to the variant data.
250  TNcbi8aa& SetNcbi8aa(void);
251 
252  /// Select the variant and set its data.
253  ///
254  /// @param value
255  /// Variant data.
256  void SetNcbi8aa(TNcbi8aa value);
257 
258 
259  /// Check if variant Ncbistdaa is selected.
260  ///
261  /// Ncbistdaa type is defined as 'typedef int TNcbistdaa'.
262  /// @return
263  /// - true, if the variant is selected.
264  /// - false, otherwise.
265  bool IsNcbistdaa(void) const;
266 
267  /// Get the variant data.
268  ///
269  /// @return
270  /// Copy of the variant data.
271  TNcbistdaa GetNcbistdaa(void) const;
272 
273  /// Select the variant.
274  ///
275  /// @return
276  /// Reference to the variant data.
277  TNcbistdaa& SetNcbistdaa(void);
278 
279  /// Select the variant and set its data.
280  ///
281  /// @param value
282  /// Variant data.
283  void SetNcbistdaa(TNcbistdaa value);
284 
285 
286  private:
287  // copy constructor and assignment operator
288  C_Aa(const C_Aa& );
289  C_Aa& operator=(const C_Aa& );
290  // choice state
292  // helper methods
293  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
294 
295  static const char* const sm_SelectionNames[];
296  // data
297  union {
302  };
303  };
304  // types
305  typedef C_Aa TAa;
306  typedef list< int > TCodon;
308 
309  // member index
310  enum class E_memberIndex {
311  e__allMandatory = 0,
312  e_aa,
313  e_codon,
314  e_anticodon
315  };
317 
318  // getters
319  // setters
320 
321  /// Check if a value has been assigned to Aa data member.
322  ///
323  /// Data member Aa is optional;
324  /// its type is defined as 'typedef C_Aa TAa'
325  /// @return
326  /// - true, if a value has been assigned.
327  /// - false, otherwise.
328  bool IsSetAa(void) const;
329 
330  /// Check if it is safe to call GetAa method.
331  ///
332  /// @return
333  /// - true, if the data member is getatable.
334  /// - false, otherwise.
335  bool CanGetAa(void) const;
336 
337  /// Reset Aa data member.
338  void ResetAa(void);
339 
340  /// Get the Aa member data.
341  ///
342  /// @return
343  /// Reference to the member data.
344  const TAa& GetAa(void) const;
345 
346  /// Assign a value to Aa data member.
347  ///
348  /// @param value
349  /// Reference to value.
350  void SetAa(TAa& value);
351 
352  /// Assign a value to Aa data member.
353  ///
354  /// @return
355  /// Reference to the data value.
356  TAa& SetAa(void);
357 
358  /// codon(s) as in Genetic-code
359  /// Check if a value has been assigned to Codon data member.
360  ///
361  /// Data member Codon is optional;
362  /// its type is defined as 'typedef list< int > TCodon'
363  /// @return
364  /// - true, if a value has been assigned.
365  /// - false, otherwise.
366  bool IsSetCodon(void) const;
367 
368  /// Check if it is safe to call GetCodon method.
369  ///
370  /// @return
371  /// - true, if the data member is getatable.
372  /// - false, otherwise.
373  bool CanGetCodon(void) const;
374 
375  /// Reset Codon data member.
376  void ResetCodon(void);
377 
378  /// Get the Codon member data.
379  ///
380  /// @return
381  /// Reference to the member data.
382  const TCodon& GetCodon(void) const;
383 
384  /// Assign a value to Codon data member.
385  ///
386  /// @return
387  /// Reference to the data value.
388  TCodon& SetCodon(void);
389 
390  /// location of anticodon
391  /// Check if a value has been assigned to Anticodon data member.
392  ///
393  /// Data member Anticodon is optional;
394  /// its type is defined as 'typedef CSeq_loc TAnticodon'
395  /// @return
396  /// - true, if a value has been assigned.
397  /// - false, otherwise.
398  bool IsSetAnticodon(void) const;
399 
400  /// Check if it is safe to call GetAnticodon method.
401  ///
402  /// @return
403  /// - true, if the data member is getatable.
404  /// - false, otherwise.
405  bool CanGetAnticodon(void) const;
406 
407  /// Reset Anticodon data member.
408  void ResetAnticodon(void);
409 
410  /// Get the Anticodon member data.
411  ///
412  /// @return
413  /// Reference to the member data.
414  const TAnticodon& GetAnticodon(void) const;
415 
416  /// Assign a value to Anticodon data member.
417  ///
418  /// @param value
419  /// Reference to value.
420  void SetAnticodon(TAnticodon& value);
421 
422  /// Assign a value to Anticodon data member.
423  ///
424  /// @return
425  /// Reference to the data value.
426  TAnticodon& SetAnticodon(void);
427 
428  /// Reset the whole object
429  virtual void Reset(void);
430 
431 
432 private:
433  // Prohibit copy constructor and assignment operator
436 
437  // data
438  Uint4 m_set_State[1];
440  list< int > m_Codon;
442 };
443 
444 /* @} */
445 
446 
447 
448 
449 
450 ///////////////////////////////////////////////////////////
451 ///////////////////// inline methods //////////////////////
452 ///////////////////////////////////////////////////////////
453 inline
455 {
456  return m_choice;
457 }
458 
459 inline
461 {
462  if ( m_choice != index )
463  ThrowInvalidSelection(index);
464 }
465 
466 inline
467 void CTrna_ext_Base::C_Aa::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
468 {
469  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
470  if ( m_choice != e_not_set )
471  ResetSelection();
472  DoSelect(index, pool);
473  }
474 }
475 
476 inline
478 {
479  Select(index, reset, 0);
480 }
481 
482 inline
484 {
485  return m_choice == e_Iupacaa;
486 }
487 
488 inline
490 {
491  CheckSelected(e_Iupacaa);
492  return m_Iupacaa;
493 }
494 
495 inline
497 {
498  Select(e_Iupacaa, NCBI_NS_NCBI::eDoNotResetVariant);
499  return m_Iupacaa;
500 }
501 
502 inline
504 {
505  Select(e_Iupacaa, NCBI_NS_NCBI::eDoNotResetVariant);
506  m_Iupacaa = value;
507 }
508 
509 inline
511 {
512  return m_choice == e_Ncbieaa;
513 }
514 
515 inline
517 {
518  CheckSelected(e_Ncbieaa);
519  return m_Ncbieaa;
520 }
521 
522 inline
524 {
525  Select(e_Ncbieaa, NCBI_NS_NCBI::eDoNotResetVariant);
526  return m_Ncbieaa;
527 }
528 
529 inline
531 {
532  Select(e_Ncbieaa, NCBI_NS_NCBI::eDoNotResetVariant);
533  m_Ncbieaa = value;
534 }
535 
536 inline
538 {
539  return m_choice == e_Ncbi8aa;
540 }
541 
542 inline
544 {
545  CheckSelected(e_Ncbi8aa);
546  return m_Ncbi8aa;
547 }
548 
549 inline
551 {
552  Select(e_Ncbi8aa, NCBI_NS_NCBI::eDoNotResetVariant);
553  return m_Ncbi8aa;
554 }
555 
556 inline
558 {
559  Select(e_Ncbi8aa, NCBI_NS_NCBI::eDoNotResetVariant);
560  m_Ncbi8aa = value;
561 }
562 
563 inline
565 {
566  return m_choice == e_Ncbistdaa;
567 }
568 
569 inline
571 {
572  CheckSelected(e_Ncbistdaa);
573  return m_Ncbistdaa;
574 }
575 
576 inline
578 {
579  Select(e_Ncbistdaa, NCBI_NS_NCBI::eDoNotResetVariant);
580  return m_Ncbistdaa;
581 }
582 
583 inline
585 {
586  Select(e_Ncbistdaa, NCBI_NS_NCBI::eDoNotResetVariant);
587  m_Ncbistdaa = value;
588 }
589 
590 inline
591 bool CTrna_ext_Base::IsSetAa(void) const
592 {
593  return m_Aa.NotEmpty();
594 }
595 
596 inline
597 bool CTrna_ext_Base::CanGetAa(void) const
598 {
599  return IsSetAa();
600 }
601 
602 inline
604 {
605  if (!CanGetAa()) {
606  ThrowUnassigned(0);
607  }
608  return (*m_Aa);
609 }
610 
611 inline
613 {
614  return ((m_set_State[0] & 0xc) != 0);
615 }
616 
617 inline
619 {
620  return true;
621 }
622 
623 inline
625 {
626  return m_Codon;
627 }
628 
629 inline
631 {
632  m_set_State[0] |= 0x4;
633  return m_Codon;
634 }
635 
636 inline
638 {
639  return m_Anticodon.NotEmpty();
640 }
641 
642 inline
644 {
645  return IsSetAnticodon();
646 }
647 
648 inline
650 {
651  if (!CanGetAnticodon()) {
652  ThrowUnassigned(2);
653  }
654  return (*m_Anticodon);
655 }
656 
657 ///////////////////////////////////////////////////////////
658 ////////////////// end of inline methods //////////////////
659 ///////////////////////////////////////////////////////////
660 
661 
662 
663 
664 
665 END_objects_SCOPE // namespace ncbi::objects::
666 
668 
669 
670 #endif // OBJECTS_SEQFEAT_TRNA_EXT_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
aa this carries
Definition: Trna_ext_.hpp:96
tRNA feature extensions
Definition: Trna_ext_.hpp:78
void ThrowUnassigned(TMemberIndex index) const
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
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
bool IsNcbistdaa(void) const
Check if variant Ncbistdaa is selected.
Definition: Trna_ext_.hpp:564
const TAnticodon & GetAnticodon(void) const
Get the Anticodon member data.
Definition: Trna_ext_.hpp:649
TIupacaa & SetIupacaa(void)
Select the variant.
Definition: Trna_ext_.hpp:496
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Trna_ext_.hpp:460
TNcbi8aa GetNcbi8aa(void) const
Get the variant data.
Definition: Trna_ext_.hpp:543
const TAa & GetAa(void) const
Get the Aa member data.
Definition: Trna_ext_.hpp:603
TNcbistdaa GetNcbistdaa(void) const
Get the variant data.
Definition: Trna_ext_.hpp:570
const TCodon & GetCodon(void) const
Get the Codon member data.
Definition: Trna_ext_.hpp:624
bool IsSetAa(void) const
Check if a value has been assigned to Aa data member.
Definition: Trna_ext_.hpp:591
bool IsNcbi8aa(void) const
Check if variant Ncbi8aa is selected.
Definition: Trna_ext_.hpp:537
bool IsSetAnticodon(void) const
location of anticodon Check if a value has been assigned to Anticodon data member.
Definition: Trna_ext_.hpp:637
CSerialObject Tparent
Definition: Trna_ext_.hpp:97
bool IsIupacaa(void) const
Check if variant Iupacaa is selected.
Definition: Trna_ext_.hpp:483
bool IsNcbieaa(void) const
Check if variant Ncbieaa is selected.
Definition: Trna_ext_.hpp:510
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
TNcbieaa & SetNcbieaa(void)
Select the variant.
Definition: Trna_ext_.hpp:523
CTrna_ext_Base(const CTrna_ext_Base &)
TCodon & SetCodon(void)
Assign a value to Codon data member.
Definition: Trna_ext_.hpp:630
TNcbieaa GetNcbieaa(void) const
Get the variant data.
Definition: Trna_ext_.hpp:516
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsSetCodon(void) const
codon(s) as in Genetic-code Check if a value has been assigned to Codon data member.
Definition: Trna_ext_.hpp:612
TIupacaa GetIupacaa(void) const
Get the variant data.
Definition: Trna_ext_.hpp:489
CSeq_loc TAnticodon
Definition: Trna_ext_.hpp:307
list< int > TCodon
Definition: Trna_ext_.hpp:306
CRef< TAnticodon > m_Anticodon
Definition: Trna_ext_.hpp:441
CTrna_ext_Base & operator=(const CTrna_ext_Base &)
bool CanGetAnticodon(void) const
Check if it is safe to call GetAnticodon method.
Definition: Trna_ext_.hpp:643
C_Aa(const C_Aa &)
CRef< TAa > m_Aa
Definition: Trna_ext_.hpp:439
TNcbistdaa & SetNcbistdaa(void)
Select the variant.
Definition: Trna_ext_.hpp:577
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Trna_ext_.hpp:117
E_Choice
Choice variants.
Definition: Trna_ext_.hpp:109
list< int > m_Codon
Definition: Trna_ext_.hpp:440
TNcbi8aa & SetNcbi8aa(void)
Select the variant.
Definition: Trna_ext_.hpp:550
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: Trna_ext_.hpp:316
bool CanGetAa(void) const
Check if it is safe to call GetAa method.
Definition: Trna_ext_.hpp:597
DECLARE_INTERNAL_TYPE_INFO()
E_Choice Which(void) const
Which variant is currently selected.
Definition: Trna_ext_.hpp:454
Uint4 m_set_State[1]
Definition: Trna_ext_.hpp:438
bool CanGetCodon(void) const
Check if it is safe to call GetCodon method.
Definition: Trna_ext_.hpp:618
CSerialObject Tparent
Definition: Trna_ext_.hpp:79
C_Aa & operator=(const C_Aa &)
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Mon Jul 15 05:32:20 2024 by modify_doxy.py rev. 669887