NCBI C++ ToolKit
SeqEdit_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 SeqEdit_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/seqedit/seqedit.asn">seqedit.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqedit/seqedit.def">seqedit.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_SEQEDIT_SEQEDIT_ID_BASE_HPP
42 #define OBJECTS_SEQEDIT_SEQEDIT_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 CSeq_id;
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_SeqEdit
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CSeqEdit_Id_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CSeqEdit_Id_Base(void);
78  // destructor
79  virtual ~CSeqEdit_Id_Base(void);
80 
81  // type info
83 
84 
85  /// Choice variants.
86  enum E_Choice {
87  e_not_set = 0, ///< No variant selected
90  e_Unique_num
91  };
92  /// Maximum+1 value of the choice variant enumerator.
94  e_MaxChoice = 4 ///< == e_Unique_num+1
95  };
96 
97  /// Reset the whole object
98  virtual void Reset(void);
99 
100  /// Reset the selection (set it to e_not_set).
101  virtual void ResetSelection(void);
102 
103  /// Which variant is currently selected.
104  ///
105  /// @return
106  /// Choice state enumerator.
107  E_Choice Which(void) const;
108 
109  /// Verify selection, throw exception if it differs from the expected.
110  ///
111  /// @param index
112  /// Expected selection.
113  void CheckSelected(E_Choice index) const;
114 
115  /// Throw 'InvalidSelection' exception.
116  ///
117  /// @param index
118  /// Expected selection.
119  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
120 
121  /// Retrieve selection name (for diagnostic purposes).
122  ///
123  /// @param index
124  /// One of possible selection states.
125  /// @return
126  /// Name string.
127  static string SelectionName(E_Choice index);
128 
129  /// Select the requested variant if needed.
130  ///
131  /// @param index
132  /// New selection state.
133  /// @param reset
134  /// Flag that defines the resetting of the variant data. The data will
135  /// be reset if either the current selection differs from the new one,
136  /// or the flag is set to eDoResetVariant.
138  /// Select the requested variant if needed,
139  /// allocating CObject variants from memory pool.
140  void Select(E_Choice index,
141  EResetVariant reset,
142  CObjectMemoryPool* pool);
143 
144  // types
146  typedef int TBioseqset_id;
147  typedef int TUnique_num;
148 
149  // getters
150  // setters
151 
152 
153  /// Check if variant Bioseq_id is selected.
154  ///
155  /// Bioseq_id type is defined as 'typedef CSeq_id TBioseq_id'.
156  /// @return
157  /// - true, if the variant is selected.
158  /// - false, otherwise.
159  bool IsBioseq_id(void) const;
160 
161  /// Get the variant data.
162  ///
163  /// @return
164  /// Reference to the data.
165  const TBioseq_id& GetBioseq_id(void) const;
166 
167  /// Select the variant.
168  ///
169  /// @return
170  /// Reference to the variant data.
171  TBioseq_id& SetBioseq_id(void);
172  /// Select the variant and set its data.
173  ///
174  /// @param value
175  /// Reference to the data.
176  void SetBioseq_id(TBioseq_id& value);
177 
178 
179  /// Check if variant Bioseqset_id is selected.
180  ///
181  /// Bioseqset_id type is defined as 'typedef int TBioseqset_id'.
182  /// @return
183  /// - true, if the variant is selected.
184  /// - false, otherwise.
185  bool IsBioseqset_id(void) const;
186 
187  /// Get the variant data.
188  ///
189  /// @return
190  /// Copy of the variant data.
191  TBioseqset_id GetBioseqset_id(void) const;
192 
193  /// Select the variant.
194  ///
195  /// @return
196  /// Reference to the variant data.
197  TBioseqset_id& SetBioseqset_id(void);
198 
199  /// Select the variant and set its data.
200  ///
201  /// @param value
202  /// Variant data.
203  void SetBioseqset_id(TBioseqset_id value);
204 
205 
206  /// Check if variant Unique_num is selected.
207  ///
208  /// Unique_num type is defined as 'typedef int TUnique_num'.
209  /// @return
210  /// - true, if the variant is selected.
211  /// - false, otherwise.
212  bool IsUnique_num(void) const;
213 
214  /// Get the variant data.
215  ///
216  /// @return
217  /// Copy of the variant data.
218  TUnique_num GetUnique_num(void) const;
219 
220  /// Select the variant.
221  ///
222  /// @return
223  /// Reference to the variant data.
224  TUnique_num& SetUnique_num(void);
225 
226  /// Select the variant and set its data.
227  ///
228  /// @param value
229  /// Variant data.
230  void SetUnique_num(TUnique_num value);
231 
232 
233 private:
234  // copy constructor and assignment operator
237  // choice state
239  // helper methods
240  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
241 
242  static const char* const sm_SelectionNames[];
243  // data
244  union {
247  NCBI_NS_NCBI::CSerialObject *m_object;
248  };
249 };
250 
251 /* @} */
252 
253 
254 
255 
256 
257 ///////////////////////////////////////////////////////////
258 ///////////////////// inline methods //////////////////////
259 ///////////////////////////////////////////////////////////
260 inline
262 {
263  return m_choice;
264 }
265 
266 inline
268 {
269  if ( m_choice != index )
270  ThrowInvalidSelection(index);
271 }
272 
273 inline
274 void CSeqEdit_Id_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
275 {
276  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
277  if ( m_choice != e_not_set )
278  ResetSelection();
279  DoSelect(index, pool);
280  }
281 }
282 
283 inline
284 void CSeqEdit_Id_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
285 {
286  Select(index, reset, 0);
287 }
288 
289 inline
291 {
292  return m_choice == e_Bioseq_id;
293 }
294 
295 inline
297 {
298  return m_choice == e_Bioseqset_id;
299 }
300 
301 inline
303 {
305  return m_Bioseqset_id;
306 }
307 
308 inline
310 {
312  return m_Bioseqset_id;
313 }
314 
315 inline
317 {
320 }
321 
322 inline
324 {
325  return m_choice == e_Unique_num;
326 }
327 
328 inline
330 {
332  return m_Unique_num;
333 }
334 
335 inline
337 {
339  return m_Unique_num;
340 }
341 
342 inline
344 {
347 }
348 
349 ///////////////////////////////////////////////////////////
350 ////////////////// end of inline methods //////////////////
351 ///////////////////////////////////////////////////////////
352 
353 
354 
355 
356 
357 END_objects_SCOPE // namespace ncbi::objects::
358 
360 
361 
362 #endif // OBJECTS_SEQEDIT_SEQEDIT_ID_BASE_HPP
CSeqEdit_Id_Base –.
Definition: SeqEdit_Id_.hpp:73
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_SEQEDIT_EXPORT
Definition: ncbi_export.h:801
CSerialObject Tparent
Definition: SeqEdit_Id_.hpp:74
TUnique_num m_Unique_num
TUnique_num & SetUnique_num(void)
Select the variant.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: SeqEdit_Id_.hpp:93
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.
E_Choice Which(void) const
Which variant is currently selected.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: SeqEdit_Id_.cpp:99
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: SeqEdit_Id_.cpp:69
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: SeqEdit_Id_.cpp:57
bool IsBioseqset_id(void) const
Check if variant Bioseqset_id is selected.
TBioseqset_id m_Bioseqset_id
CSeqEdit_Id_Base & operator=(const CSeqEdit_Id_Base &)
TBioseqset_id & SetBioseqset_id(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
NCBI_NS_NCBI::CSerialObject * m_object
TBioseqset_id m_Bioseqset_id
bool IsUnique_num(void) const
Check if variant Unique_num is selected.
E_Choice
Choice variants.
Definition: SeqEdit_Id_.hpp:86
TUnique_num GetUnique_num(void) const
Get the variant data.
TBioseqset_id GetBioseqset_id(void) const
Get the variant data.
bool IsBioseq_id(void) const
Check if variant Bioseq_id is selected.
CSeqEdit_Id_Base(const CSeqEdit_Id_Base &)
@ e_not_set
No variant selected.
Definition: SeqEdit_Id_.hpp:87
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Mon Jun 17 05:09:28 2024 by modify_doxy.py rev. 669887