NCBI C++ ToolKit
Ncbi_mime_asn1_.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 Ncbi_mime_asn1_.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/ncbimime/ncbimime.asn">ncbimime.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/ncbimime/ncbimime.def">ncbimime.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_NCBIMIME_NCBI_MIME_ASN1_BASE_HPP
42 #define OBJECTS_NCBIMIME_NCBI_MIME_ASN1_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 CBiostruc_align;
58 class CBiostruc_seq;
59 class CBiostruc_seqs;
61 class CEntrez_general;
62 
63 
64 // generated classes
65 
66 
67 /** @addtogroup dataspec_NCBI_Mime
68  *
69  * @{
70  */
71 
72 /////////////////////////////////////////////////////////////////////////////
73 ///
74 /// CNcbi_mime_asn1_Base --
75 ///
76 
78 {
80 public:
81  // constructor
83  // destructor
84  virtual ~CNcbi_mime_asn1_Base(void);
85 
86  // type info
88 
89 
90  /// Choice variants.
91  enum E_Choice {
92  e_not_set = 0, ///< No variant selected
93  e_Entrez, ///< just a structure
94  e_Alignstruc, ///< structures & sequences & alignments
95  e_Alignseq, ///< sequence alignment
96  e_Strucseq, ///< structure & sequences
97  e_Strucseqs, ///< structure & sequences & alignments
98  e_General ///< all-purpose "grab bag" others may be added here in the future
99  };
100  /// Maximum+1 value of the choice variant enumerator.
102  e_MaxChoice = 7 ///< == e_General+1
103  };
104 
105  /// Reset the whole object
106  virtual void Reset(void);
107 
108  /// Reset the selection (set it to e_not_set).
109  virtual void ResetSelection(void);
110 
111  /// Which variant is currently selected.
112  ///
113  /// @return
114  /// Choice state enumerator.
115  E_Choice Which(void) const;
116 
117  /// Verify selection, throw exception if it differs from the expected.
118  ///
119  /// @param index
120  /// Expected selection.
121  void CheckSelected(E_Choice index) const;
122 
123  /// Throw 'InvalidSelection' exception.
124  ///
125  /// @param index
126  /// Expected selection.
127  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
128 
129  /// Retrieve selection name (for diagnostic purposes).
130  ///
131  /// @param index
132  /// One of possible selection states.
133  /// @return
134  /// Name string.
135  static string SelectionName(E_Choice index);
136 
137  /// Select the requested variant if needed.
138  ///
139  /// @param index
140  /// New selection state.
141  /// @param reset
142  /// Flag that defines the resetting of the variant data. The data will
143  /// be reset if either the current selection differs from the new one,
144  /// or the flag is set to eDoResetVariant.
146  /// Select the requested variant if needed,
147  /// allocating CObject variants from memory pool.
148  void Select(E_Choice index,
149  EResetVariant reset,
150  CObjectMemoryPool* pool);
151 
152  // types
159 
160  // getters
161  // setters
162 
163 
164  /// Check if variant Entrez is selected.
165  ///
166  /// Entrez type is defined as 'typedef CEntrez_general TEntrez'.
167  /// @return
168  /// - true, if the variant is selected.
169  /// - false, otherwise.
170  bool IsEntrez(void) const;
171 
172  /// Get the variant data.
173  ///
174  /// @return
175  /// Reference to the data.
176  const TEntrez& GetEntrez(void) const;
177 
178  /// Select the variant.
179  ///
180  /// @return
181  /// Reference to the variant data.
182  TEntrez& SetEntrez(void);
183  /// Select the variant and set its data.
184  ///
185  /// @param value
186  /// Reference to the data.
187  void SetEntrez(TEntrez& value);
188 
189 
190  /// Check if variant Alignstruc is selected.
191  ///
192  /// Alignstruc type is defined as 'typedef CBiostruc_align TAlignstruc'.
193  /// @return
194  /// - true, if the variant is selected.
195  /// - false, otherwise.
196  bool IsAlignstruc(void) const;
197 
198  /// Get the variant data.
199  ///
200  /// @return
201  /// Reference to the data.
202  const TAlignstruc& GetAlignstruc(void) const;
203 
204  /// Select the variant.
205  ///
206  /// @return
207  /// Reference to the variant data.
208  TAlignstruc& SetAlignstruc(void);
209  /// Select the variant and set its data.
210  ///
211  /// @param value
212  /// Reference to the data.
213  void SetAlignstruc(TAlignstruc& value);
214 
215 
216  /// Check if variant Alignseq is selected.
217  ///
218  /// Alignseq type is defined as 'typedef CBiostruc_align_seq TAlignseq'.
219  /// @return
220  /// - true, if the variant is selected.
221  /// - false, otherwise.
222  bool IsAlignseq(void) const;
223 
224  /// Get the variant data.
225  ///
226  /// @return
227  /// Reference to the data.
228  const TAlignseq& GetAlignseq(void) const;
229 
230  /// Select the variant.
231  ///
232  /// @return
233  /// Reference to the variant data.
234  TAlignseq& SetAlignseq(void);
235  /// Select the variant and set its data.
236  ///
237  /// @param value
238  /// Reference to the data.
239  void SetAlignseq(TAlignseq& value);
240 
241 
242  /// Check if variant Strucseq is selected.
243  ///
244  /// Strucseq type is defined as 'typedef CBiostruc_seq TStrucseq'.
245  /// @return
246  /// - true, if the variant is selected.
247  /// - false, otherwise.
248  bool IsStrucseq(void) const;
249 
250  /// Get the variant data.
251  ///
252  /// @return
253  /// Reference to the data.
254  const TStrucseq& GetStrucseq(void) const;
255 
256  /// Select the variant.
257  ///
258  /// @return
259  /// Reference to the variant data.
260  TStrucseq& SetStrucseq(void);
261  /// Select the variant and set its data.
262  ///
263  /// @param value
264  /// Reference to the data.
265  void SetStrucseq(TStrucseq& value);
266 
267 
268  /// Check if variant Strucseqs is selected.
269  ///
270  /// Strucseqs type is defined as 'typedef CBiostruc_seqs TStrucseqs'.
271  /// @return
272  /// - true, if the variant is selected.
273  /// - false, otherwise.
274  bool IsStrucseqs(void) const;
275 
276  /// Get the variant data.
277  ///
278  /// @return
279  /// Reference to the data.
280  const TStrucseqs& GetStrucseqs(void) const;
281 
282  /// Select the variant.
283  ///
284  /// @return
285  /// Reference to the variant data.
286  TStrucseqs& SetStrucseqs(void);
287  /// Select the variant and set its data.
288  ///
289  /// @param value
290  /// Reference to the data.
291  void SetStrucseqs(TStrucseqs& value);
292 
293 
294  /// Check if variant General is selected.
295  ///
296  /// General type is defined as 'typedef CBiostruc_seqs_aligns_cdd TGeneral'.
297  /// @return
298  /// - true, if the variant is selected.
299  /// - false, otherwise.
300  bool IsGeneral(void) const;
301 
302  /// Get the variant data.
303  ///
304  /// @return
305  /// Reference to the data.
306  const TGeneral& GetGeneral(void) const;
307 
308  /// Select the variant.
309  ///
310  /// @return
311  /// Reference to the variant data.
312  TGeneral& SetGeneral(void);
313  /// Select the variant and set its data.
314  ///
315  /// @param value
316  /// Reference to the data.
317  void SetGeneral(TGeneral& value);
318 
319 
320 private:
321  // copy constructor and assignment operator
324  // choice state
326  // helper methods
327  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
328 
329  static const char* const sm_SelectionNames[];
330  // data
331  NCBI_NS_NCBI::CSerialObject *m_object;
332 };
333 
334 /* @} */
335 
336 
337 
338 
339 
340 ///////////////////////////////////////////////////////////
341 ///////////////////// inline methods //////////////////////
342 ///////////////////////////////////////////////////////////
343 inline
345 {
346  return m_choice;
347 }
348 
349 inline
351 {
352  if ( m_choice != index )
353  ThrowInvalidSelection(index);
354 }
355 
356 inline
357 void CNcbi_mime_asn1_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
358 {
359  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
360  if ( m_choice != e_not_set )
361  ResetSelection();
362  DoSelect(index, pool);
363  }
364 }
365 
366 inline
368 {
369  Select(index, reset, 0);
370 }
371 
372 inline
374 {
375  return m_choice == e_Entrez;
376 }
377 
378 inline
380 {
381  return m_choice == e_Alignstruc;
382 }
383 
384 inline
386 {
387  return m_choice == e_Alignseq;
388 }
389 
390 inline
392 {
393  return m_choice == e_Strucseq;
394 }
395 
396 inline
398 {
399  return m_choice == e_Strucseqs;
400 }
401 
402 inline
404 {
405  return m_choice == e_General;
406 }
407 
408 ///////////////////////////////////////////////////////////
409 ////////////////// end of inline methods //////////////////
410 ///////////////////////////////////////////////////////////
411 
412 
413 
414 
415 
416 END_objects_SCOPE // namespace ncbi::objects::
417 
419 
420 
421 #endif // OBJECTS_NCBIMIME_NCBI_MIME_ASN1_BASE_HPP
CBiostruc_align_seq –.
CBiostruc_align –.
CBiostruc_seq –.
CBiostruc_seqs_aligns_cdd –.
CBiostruc_seqs –.
CEntrez_general –.
CNcbi_mime_asn1_Base –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
#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_NCBIMIME_EXPORT
Definition: ncbi_export.h:648
E_Choice Which(void) const
Which variant is currently selected.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsStrucseqs(void) const
Check if variant Strucseqs is selected.
NCBI_NS_NCBI::CSerialObject * m_object
CNcbi_mime_asn1_Base & operator=(const CNcbi_mime_asn1_Base &)
bool IsStrucseq(void) const
Check if variant Strucseq is selected.
bool IsGeneral(void) const
Check if variant General is selected.
bool IsAlignseq(void) const
Check if variant Alignseq is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
CEntrez_general TEntrez
CBiostruc_align_seq TAlignseq
CBiostruc_align TAlignstruc
CNcbi_mime_asn1_Base(const CNcbi_mime_asn1_Base &)
CBiostruc_seqs_aligns_cdd TGeneral
E_Choice
Choice variants.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
CBiostruc_seqs TStrucseqs
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
bool IsEntrez(void) const
Check if variant Entrez is selected.
bool IsAlignstruc(void) const
Check if variant Alignstruc is selected.
@ e_Strucseq
structure & sequences
@ e_Alignseq
sequence alignment
@ e_Strucseqs
structure & sequences & alignments
@ e_General
all-purpose "grab bag" others may be added here in the future
@ e_Alignstruc
structures & sequences & alignments
@ e_Entrez
just a structure
@ e_not_set
No variant selected.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat May 18 11:37:02 2024 by modify_doxy.py rev. 669887