NCBI C++ ToolKit
Feat_id_.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 Feat_id_.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_FEAT_ID_BASE_HPP
42 #define OBJECTS_SEQFEAT_FEAT_ID_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 CDbtag;
57 class CGiimport_id;
58 class CObject_id;
59 
60 
61 // generated classes
62 
63 
64 /** @addtogroup dataspec_NCBI_Seqfeat
65  *
66  * @{
67  */
68 
69 /////////////////////////////////////////////////////////////////////////////
70 ///*** Feature identifiers ********************************
71 ///*
72 ///
73 /// CFeat_id_Base --
74 ///
75 
77 {
79 public:
80  // constructor
81  CFeat_id_Base(void);
82  // destructor
83  virtual ~CFeat_id_Base(void);
84 
85  // type info
87 
88 
89  /// Choice variants.
90  enum E_Choice {
91  e_not_set = 0, ///< No variant selected
92  e_Gibb, ///< geninfo backbone
93  e_Giim, ///< geninfo import
94  e_Local, ///< for local software use
95  e_General ///< for use by various databases
96  };
97  /// Maximum+1 value of the choice variant enumerator.
99  e_MaxChoice = 5 ///< == e_General+1
100  };
101 
102  /// Reset the whole object
103  virtual void Reset(void);
104 
105  /// Reset the selection (set it to e_not_set).
106  virtual void ResetSelection(void);
107 
108  /// Which variant is currently selected.
109  ///
110  /// @return
111  /// Choice state enumerator.
112  E_Choice Which(void) const;
113 
114  /// Verify selection, throw exception if it differs from the expected.
115  ///
116  /// @param index
117  /// Expected selection.
118  void CheckSelected(E_Choice index) const;
119 
120  /// Throw 'InvalidSelection' exception.
121  ///
122  /// @param index
123  /// Expected selection.
124  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
125 
126  /// Retrieve selection name (for diagnostic purposes).
127  ///
128  /// @param index
129  /// One of possible selection states.
130  /// @return
131  /// Name string.
132  static string SelectionName(E_Choice index);
133 
134  /// Select the requested variant if needed.
135  ///
136  /// @param index
137  /// New selection state.
138  /// @param reset
139  /// Flag that defines the resetting of the variant data. The data will
140  /// be reset if either the current selection differs from the new one,
141  /// or the flag is set to eDoResetVariant.
143  /// Select the requested variant if needed,
144  /// allocating CObject variants from memory pool.
145  void Select(E_Choice index,
146  EResetVariant reset,
147  CObjectMemoryPool* pool);
148 
149  // types
150  typedef int TGibb;
153  typedef CDbtag TGeneral;
154 
155  // getters
156  // setters
157 
158 
159  /// Check if variant Gibb is selected.
160  ///
161  /// Gibb type is defined as 'typedef int TGibb'.
162  /// @return
163  /// - true, if the variant is selected.
164  /// - false, otherwise.
165  bool IsGibb(void) const;
166 
167  /// Get the variant data.
168  ///
169  /// @return
170  /// Copy of the variant data.
171  TGibb GetGibb(void) const;
172 
173  /// Select the variant.
174  ///
175  /// @return
176  /// Reference to the variant data.
177  TGibb& SetGibb(void);
178 
179  /// Select the variant and set its data.
180  ///
181  /// @param value
182  /// Variant data.
183  void SetGibb(TGibb value);
184 
185 
186  /// Check if variant Giim is selected.
187  ///
188  /// Giim type is defined as 'typedef CGiimport_id TGiim'.
189  /// @return
190  /// - true, if the variant is selected.
191  /// - false, otherwise.
192  bool IsGiim(void) const;
193 
194  /// Get the variant data.
195  ///
196  /// @return
197  /// Reference to the data.
198  const TGiim& GetGiim(void) const;
199 
200  /// Select the variant.
201  ///
202  /// @return
203  /// Reference to the variant data.
204  TGiim& SetGiim(void);
205  /// Select the variant and set its data.
206  ///
207  /// @param value
208  /// Reference to the data.
209  void SetGiim(TGiim& value);
210 
211 
212  /// Check if variant Local is selected.
213  ///
214  /// Local type is defined as 'typedef CObject_id TLocal'.
215  /// @return
216  /// - true, if the variant is selected.
217  /// - false, otherwise.
218  bool IsLocal(void) const;
219 
220  /// Get the variant data.
221  ///
222  /// @return
223  /// Reference to the data.
224  const TLocal& GetLocal(void) const;
225 
226  /// Select the variant.
227  ///
228  /// @return
229  /// Reference to the variant data.
230  TLocal& SetLocal(void);
231  /// Select the variant and set its data.
232  ///
233  /// @param value
234  /// Reference to the data.
235  void SetLocal(TLocal& value);
236 
237 
238  /// Check if variant General is selected.
239  ///
240  /// General type is defined as 'typedef CDbtag TGeneral'.
241  /// @return
242  /// - true, if the variant is selected.
243  /// - false, otherwise.
244  bool IsGeneral(void) const;
245 
246  /// Get the variant data.
247  ///
248  /// @return
249  /// Reference to the data.
250  const TGeneral& GetGeneral(void) const;
251 
252  /// Select the variant.
253  ///
254  /// @return
255  /// Reference to the variant data.
256  TGeneral& SetGeneral(void);
257  /// Select the variant and set its data.
258  ///
259  /// @param value
260  /// Reference to the data.
261  void SetGeneral(TGeneral& value);
262 
263 
264 private:
265  // copy constructor and assignment operator
268  // choice state
270  // helper methods
271  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
272 
273  static const char* const sm_SelectionNames[];
274  // data
275  union {
277  NCBI_NS_NCBI::CSerialObject *m_object;
278  };
279 };
280 
281 /* @} */
282 
283 
284 
285 
286 
287 ///////////////////////////////////////////////////////////
288 ///////////////////// inline methods //////////////////////
289 ///////////////////////////////////////////////////////////
290 inline
292 {
293  return m_choice;
294 }
295 
296 inline
298 {
299  if ( m_choice != index )
300  ThrowInvalidSelection(index);
301 }
302 
303 inline
304 void CFeat_id_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
305 {
306  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
307  if ( m_choice != e_not_set )
308  ResetSelection();
309  DoSelect(index, pool);
310  }
311 }
312 
313 inline
314 void CFeat_id_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
315 {
316  Select(index, reset, 0);
317 }
318 
319 inline
320 bool CFeat_id_Base::IsGibb(void) const
321 {
322  return m_choice == e_Gibb;
323 }
324 
325 inline
327 {
329  return m_Gibb;
330 }
331 
332 inline
334 {
336  return m_Gibb;
337 }
338 
339 inline
341 {
343  m_Gibb = value;
344 }
345 
346 inline
347 bool CFeat_id_Base::IsGiim(void) const
348 {
349  return m_choice == e_Giim;
350 }
351 
352 inline
353 bool CFeat_id_Base::IsLocal(void) const
354 {
355  return m_choice == e_Local;
356 }
357 
358 inline
359 bool CFeat_id_Base::IsGeneral(void) const
360 {
361  return m_choice == e_General;
362 }
363 
364 ///////////////////////////////////////////////////////////
365 ////////////////// end of inline methods //////////////////
366 ///////////////////////////////////////////////////////////
367 
368 
369 
370 
371 
372 END_objects_SCOPE // namespace ncbi::objects::
373 
375 
376 
377 #endif // OBJECTS_SEQFEAT_FEAT_ID_BASE_HPP
Definition: Dbtag.hpp:53
*** Feature identifiers ******************************** *
Definition: Feat_id_.hpp:77
CGiimport_id –.
Definition: Giimport_id.hpp:66
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_SEQFEAT_EXPORT
Definition: ncbi_export.h:768
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Feat_id_.hpp:98
CObject_id TLocal
Definition: Feat_id_.hpp:152
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Feat_id_.hpp:297
CDbtag TGeneral
Definition: Feat_id_.hpp:153
CFeat_id_Base & operator=(const CFeat_id_Base &)
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Feat_id_.hpp:277
E_Choice Which(void) const
Which variant is currently selected.
Definition: Feat_id_.hpp:291
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
bool IsGibb(void) const
Check if variant Gibb is selected.
Definition: Feat_id_.hpp:320
E_Choice m_choice
Definition: Feat_id_.hpp:269
bool IsLocal(void) const
Check if variant Local is selected.
Definition: Feat_id_.hpp:353
CGiimport_id TGiim
Definition: Feat_id_.hpp:151
bool IsGiim(void) const
Check if variant Giim is selected.
Definition: Feat_id_.hpp:347
E_Choice
Choice variants.
Definition: Feat_id_.hpp:90
DECLARE_INTERNAL_TYPE_INFO()
TGibb & SetGibb(void)
Select the variant.
Definition: Feat_id_.hpp:333
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Feat_id_.cpp:73
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Feat_id_.cpp:59
CSerialObject Tparent
Definition: Feat_id_.hpp:78
CFeat_id_Base(const CFeat_id_Base &)
TGibb GetGibb(void) const
Get the variant data.
Definition: Feat_id_.hpp:326
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Feat_id_.cpp:107
bool IsGeneral(void) const
Check if variant General is selected.
Definition: Feat_id_.hpp:359
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
@ e_Giim
geninfo import
Definition: Feat_id_.hpp:93
@ e_not_set
No variant selected.
Definition: Feat_id_.hpp:91
@ e_General
for use by various databases
Definition: Feat_id_.hpp:95
@ e_Gibb
geninfo backbone
Definition: Feat_id_.hpp:92
@ e_Local
for local software use
Definition: Feat_id_.hpp:94
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:58 2024 by modify_doxy.py rev. 669887