NCBI C++ ToolKit
Code_break_.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 Code_break_.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_CODE_BREAK_BASE_HPP
42 #define OBJECTS_SEQFEAT_CODE_BREAK_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 CSeq_loc;
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_Seqfeat
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// specific codon exceptions
69 /// NCBIstdaa code
70 ///
71 /// CCode_break_Base --
72 ///
73 
75 {
77 public:
78  // constructor
79  CCode_break_Base(void);
80  // destructor
81  virtual ~CCode_break_Base(void);
82 
83  // type info
85 
86  /////////////////////////////////////////////////////////////////////////////
87  /// the amino acid
88  ///
89  /// C_Aa --
90  ///
91 
93  {
95  public:
96  // constructor
97  C_Aa(void);
98  // destructor
99  ~C_Aa(void);
100 
101  // type info
103 
104 
105  /// Choice variants.
106  enum E_Choice {
107  e_not_set = 0, ///< No variant selected
108  e_Ncbieaa, ///< ASCII value of NCBIeaa code
109  e_Ncbi8aa, ///< NCBI8aa code
110  e_Ncbistdaa
111  };
112  /// Maximum+1 value of the choice variant enumerator.
114  e_MaxChoice = 4 ///< == e_Ncbistdaa+1
115  };
116 
117  /// Reset the whole object
118  void Reset(void);
119 
120  /// Reset the selection (set it to e_not_set).
121  void ResetSelection(void);
122 
123  /// Which variant is currently selected.
124  ///
125  /// @return
126  /// Choice state enumerator.
127  E_Choice Which(void) const;
128 
129  /// Verify selection, throw exception if it differs from the expected.
130  ///
131  /// @param index
132  /// Expected selection.
133  void CheckSelected(E_Choice index) const;
134 
135  /// Throw 'InvalidSelection' exception.
136  ///
137  /// @param index
138  /// Expected selection.
139  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
140 
141  /// Retrieve selection name (for diagnostic purposes).
142  ///
143  /// @param index
144  /// One of possible selection states.
145  /// @return
146  /// Name string.
147  static string SelectionName(E_Choice index);
148 
149  /// Select the requested variant if needed.
150  ///
151  /// @param index
152  /// New selection state.
153  /// @param reset
154  /// Flag that defines the resetting of the variant data. The data will
155  /// be reset if either the current selection differs from the new one,
156  /// or the flag is set to eDoResetVariant.
158  /// Select the requested variant if needed,
159  /// allocating CObject variants from memory pool.
160  void Select(E_Choice index,
161  EResetVariant reset,
162  CObjectMemoryPool* pool);
163 
164  // types
165  typedef int TNcbieaa;
166  typedef int TNcbi8aa;
167  typedef int TNcbistdaa;
168 
169  // getters
170  // setters
171 
172 
173  /// Check if variant Ncbieaa is selected.
174  ///
175  /// Ncbieaa type is defined as 'typedef int TNcbieaa'.
176  /// @return
177  /// - true, if the variant is selected.
178  /// - false, otherwise.
179  bool IsNcbieaa(void) const;
180 
181  /// Get the variant data.
182  ///
183  /// @return
184  /// Copy of the variant data.
185  TNcbieaa GetNcbieaa(void) const;
186 
187  /// Select the variant.
188  ///
189  /// @return
190  /// Reference to the variant data.
191  TNcbieaa& SetNcbieaa(void);
192 
193  /// Select the variant and set its data.
194  ///
195  /// @param value
196  /// Variant data.
197  void SetNcbieaa(TNcbieaa value);
198 
199 
200  /// Check if variant Ncbi8aa is selected.
201  ///
202  /// Ncbi8aa type is defined as 'typedef int TNcbi8aa'.
203  /// @return
204  /// - true, if the variant is selected.
205  /// - false, otherwise.
206  bool IsNcbi8aa(void) const;
207 
208  /// Get the variant data.
209  ///
210  /// @return
211  /// Copy of the variant data.
212  TNcbi8aa GetNcbi8aa(void) const;
213 
214  /// Select the variant.
215  ///
216  /// @return
217  /// Reference to the variant data.
218  TNcbi8aa& SetNcbi8aa(void);
219 
220  /// Select the variant and set its data.
221  ///
222  /// @param value
223  /// Variant data.
224  void SetNcbi8aa(TNcbi8aa value);
225 
226 
227  /// Check if variant Ncbistdaa is selected.
228  ///
229  /// Ncbistdaa type is defined as 'typedef int TNcbistdaa'.
230  /// @return
231  /// - true, if the variant is selected.
232  /// - false, otherwise.
233  bool IsNcbistdaa(void) const;
234 
235  /// Get the variant data.
236  ///
237  /// @return
238  /// Copy of the variant data.
239  TNcbistdaa GetNcbistdaa(void) const;
240 
241  /// Select the variant.
242  ///
243  /// @return
244  /// Reference to the variant data.
245  TNcbistdaa& SetNcbistdaa(void);
246 
247  /// Select the variant and set its data.
248  ///
249  /// @param value
250  /// Variant data.
251  void SetNcbistdaa(TNcbistdaa value);
252 
253 
254  private:
255  // copy constructor and assignment operator
256  C_Aa(const C_Aa& );
257  C_Aa& operator=(const C_Aa& );
258  // choice state
260  // helper methods
261  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
262 
263  static const char* const sm_SelectionNames[];
264  // data
265  union {
269  };
270  };
271  // types
272  typedef CSeq_loc TLoc;
273  typedef C_Aa TAa;
274 
275  // member index
276  enum class E_memberIndex {
277  e__allMandatory = 0,
278  e_loc,
279  e_aa
280  };
282 
283  // getters
284  // setters
285 
286  /// location of exception
287  /// Check if a value has been assigned to Loc data member.
288  ///
289  /// Data member Loc is mandatory;
290  /// its type is defined as 'typedef CSeq_loc TLoc'
291  /// @return
292  /// - true, if a value has been assigned.
293  /// - false, otherwise.
294  bool IsSetLoc(void) const;
295 
296  /// Check if it is safe to call GetLoc method.
297  ///
298  /// @return
299  /// - true, if the data member is getatable.
300  /// - false, otherwise.
301  bool CanGetLoc(void) const;
302 
303  /// Reset Loc data member.
304  void ResetLoc(void);
305 
306  /// Get the Loc member data.
307  ///
308  /// @return
309  /// Reference to the member data.
310  const TLoc& GetLoc(void) const;
311 
312  /// Assign a value to Loc data member.
313  ///
314  /// @param value
315  /// Reference to value.
316  void SetLoc(TLoc& value);
317 
318  /// Assign a value to Loc data member.
319  ///
320  /// @return
321  /// Reference to the data value.
322  TLoc& SetLoc(void);
323 
324  /// Check if a value has been assigned to Aa data member.
325  ///
326  /// Data member Aa is mandatory;
327  /// its type is defined as 'typedef C_Aa TAa'
328  /// @return
329  /// - true, if a value has been assigned.
330  /// - false, otherwise.
331  bool IsSetAa(void) const;
332 
333  /// Check if it is safe to call GetAa method.
334  ///
335  /// @return
336  /// - true, if the data member is getatable.
337  /// - false, otherwise.
338  bool CanGetAa(void) const;
339 
340  /// Reset Aa data member.
341  void ResetAa(void);
342 
343  /// Get the Aa member data.
344  ///
345  /// @return
346  /// Reference to the member data.
347  const TAa& GetAa(void) const;
348 
349  /// Assign a value to Aa data member.
350  ///
351  /// @param value
352  /// Reference to value.
353  void SetAa(TAa& value);
354 
355  /// Assign a value to Aa data member.
356  ///
357  /// @return
358  /// Reference to the data value.
359  TAa& SetAa(void);
360 
361  /// Reset the whole object
362  virtual void Reset(void);
363 
364 
365 private:
366  // Prohibit copy constructor and assignment operator
369 
370  // data
371  Uint4 m_set_State[1];
374 };
375 
376 /* @} */
377 
378 
379 
380 
381 
382 ///////////////////////////////////////////////////////////
383 ///////////////////// inline methods //////////////////////
384 ///////////////////////////////////////////////////////////
385 inline
387 {
388  return m_choice;
389 }
390 
391 inline
393 {
394  if ( m_choice != index )
395  ThrowInvalidSelection(index);
396 }
397 
398 inline
399 void CCode_break_Base::C_Aa::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
400 {
401  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
402  if ( m_choice != e_not_set )
403  ResetSelection();
404  DoSelect(index, pool);
405  }
406 }
407 
408 inline
410 {
411  Select(index, reset, 0);
412 }
413 
414 inline
416 {
417  return m_choice == e_Ncbieaa;
418 }
419 
420 inline
422 {
423  CheckSelected(e_Ncbieaa);
424  return m_Ncbieaa;
425 }
426 
427 inline
429 {
430  Select(e_Ncbieaa, NCBI_NS_NCBI::eDoNotResetVariant);
431  return m_Ncbieaa;
432 }
433 
434 inline
436 {
437  Select(e_Ncbieaa, NCBI_NS_NCBI::eDoNotResetVariant);
438  m_Ncbieaa = value;
439 }
440 
441 inline
443 {
444  return m_choice == e_Ncbi8aa;
445 }
446 
447 inline
449 {
450  CheckSelected(e_Ncbi8aa);
451  return m_Ncbi8aa;
452 }
453 
454 inline
456 {
457  Select(e_Ncbi8aa, NCBI_NS_NCBI::eDoNotResetVariant);
458  return m_Ncbi8aa;
459 }
460 
461 inline
463 {
464  Select(e_Ncbi8aa, NCBI_NS_NCBI::eDoNotResetVariant);
465  m_Ncbi8aa = value;
466 }
467 
468 inline
470 {
471  return m_choice == e_Ncbistdaa;
472 }
473 
474 inline
476 {
477  CheckSelected(e_Ncbistdaa);
478  return m_Ncbistdaa;
479 }
480 
481 inline
483 {
484  Select(e_Ncbistdaa, NCBI_NS_NCBI::eDoNotResetVariant);
485  return m_Ncbistdaa;
486 }
487 
488 inline
490 {
491  Select(e_Ncbistdaa, NCBI_NS_NCBI::eDoNotResetVariant);
492  m_Ncbistdaa = value;
493 }
494 
495 inline
497 {
498  return m_Loc.NotEmpty();
499 }
500 
501 inline
503 {
504  return true;
505 }
506 
507 inline
509 {
510  if ( !m_Loc ) {
511  const_cast<CCode_break_Base*>(this)->ResetLoc();
512  }
513  return (*m_Loc);
514 }
515 
516 inline
518 {
519  if ( !m_Loc ) {
520  ResetLoc();
521  }
522  return (*m_Loc);
523 }
524 
525 inline
527 {
528  return m_Aa.NotEmpty();
529 }
530 
531 inline
533 {
534  return true;
535 }
536 
537 inline
539 {
540  if ( !m_Aa ) {
541  const_cast<CCode_break_Base*>(this)->ResetAa();
542  }
543  return (*m_Aa);
544 }
545 
546 inline
548 {
549  if ( !m_Aa ) {
550  ResetAa();
551  }
552  return (*m_Aa);
553 }
554 
555 ///////////////////////////////////////////////////////////
556 ////////////////// end of inline methods //////////////////
557 ///////////////////////////////////////////////////////////
558 
559 
560 
561 
562 
563 END_objects_SCOPE // namespace ncbi::objects::
564 
566 
567 
568 #endif // OBJECTS_SEQFEAT_CODE_BREAK_BASE_HPP
specific codon exceptions NCBIstdaa code
Definition: Code_break_.hpp:75
CRef –.
Definition: ncbiobj.hpp:618
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
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
CCode_break_Base(const CCode_break_Base &)
void ResetAa(void)
Reset Aa data member.
TLoc & SetLoc(void)
Assign a value to Loc data member.
TNcbi8aa GetNcbi8aa(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
CRef< TLoc > m_Loc
C_Aa & operator=(const C_Aa &)
const TLoc & GetLoc(void) const
Get the Loc member data.
bool CanGetLoc(void) const
Check if it is safe to call GetLoc method.
bool IsNcbistdaa(void) const
Check if variant Ncbistdaa is selected.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void ResetLoc(void)
Reset Loc data member.
TAa & SetAa(void)
Assign a value to Aa data member.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
TNcbi8aa & SetNcbi8aa(void)
Select the variant.
TNcbistdaa & SetNcbistdaa(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool IsNcbieaa(void) const
Check if variant Ncbieaa is selected.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
bool IsSetAa(void) const
Check if a value has been assigned to Aa data member.
const TAa & GetAa(void) const
Get the Aa member data.
CSerialObject Tparent
Definition: Code_break_.hpp:94
TNcbieaa GetNcbieaa(void) const
Get the variant data.
CSerialObject Tparent
Definition: Code_break_.hpp:76
TNcbieaa & SetNcbieaa(void)
Select the variant.
CCode_break_Base & operator=(const CCode_break_Base &)
bool CanGetAa(void) const
Check if it is safe to call GetAa method.
CRef< TAa > m_Aa
bool IsNcbi8aa(void) const
Check if variant Ncbi8aa is selected.
TNcbistdaa GetNcbistdaa(void) const
Get the variant data.
bool IsSetLoc(void) const
location of exception Check if a value has been assigned to Loc data member.
E_Choice
Choice variants.
@ e_Ncbi8aa
NCBI8aa code.
@ e_Ncbieaa
ASCII value of NCBIeaa code.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
int GetLoc(const string &acc, const string &pat, CSeq_loc &loc, CScope &scope)
Modified on Sun Apr 14 05:25:04 2024 by modify_doxy.py rev. 669887