NCBI C++ ToolKit
Molinfo_field_.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 Molinfo_field_.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/macro/macro.asn">macro.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/macro/macro.def">macro.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_MACRO_MOLINFO_FIELD_BASE_HPP
42 #define OBJECTS_MACRO_MOLINFO_FIELD_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
54 
56 
57 #ifndef BEGIN_objects_SCOPE
58 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
59 # define END_objects_SCOPE END_SCOPE(objects)
60 #endif
61 BEGIN_objects_SCOPE // namespace ncbi::objects::
62 
63 
64 // generated classes
65 
66 
67 /** @addtogroup dataspec_NCBI_Macro
68  *
69  * @{
70  */
71 
72 /////////////////////////////////////////////////////////////////////////////
73 ///
74 /// CMolinfo_field_Base --
75 ///
76 
78 {
80 public:
81  // constructor
82  CMolinfo_field_Base(void);
83  // destructor
84  virtual ~CMolinfo_field_Base(void);
85 
86  // type info
88 
89 
90  /// Choice variants.
91  enum E_Choice {
92  e_not_set = 0, ///< No variant selected
98  e_Strand
99  };
100  /// Maximum+1 value of the choice variant enumerator.
102  e_MaxChoice = 7 ///< == e_Strand+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 Molecule is selected.
165  ///
166  /// Molecule type is defined as 'typedef EMolecule_type TMolecule'.
167  /// @return
168  /// - true, if the variant is selected.
169  /// - false, otherwise.
170  bool IsMolecule(void) const;
171 
172  /// Get the variant data.
173  ///
174  /// @return
175  /// Copy of the variant data.
176  TMolecule GetMolecule(void) const;
177 
178  /// Select the variant.
179  ///
180  /// @return
181  /// Reference to the variant data.
182  TMolecule& SetMolecule(void);
183 
184  /// Select the variant and set its data.
185  ///
186  /// @param value
187  /// Variant data.
189 
190 
191  /// Check if variant Technique is selected.
192  ///
193  /// Technique type is defined as 'typedef ETechnique_type TTechnique'.
194  /// @return
195  /// - true, if the variant is selected.
196  /// - false, otherwise.
197  bool IsTechnique(void) const;
198 
199  /// Get the variant data.
200  ///
201  /// @return
202  /// Copy of the variant data.
203  TTechnique GetTechnique(void) const;
204 
205  /// Select the variant.
206  ///
207  /// @return
208  /// Reference to the variant data.
209  TTechnique& SetTechnique(void);
210 
211  /// Select the variant and set its data.
212  ///
213  /// @param value
214  /// Variant data.
216 
217 
218  /// Check if variant Completedness is selected.
219  ///
220  /// Completedness type is defined as 'typedef ECompletedness_type TCompletedness'.
221  /// @return
222  /// - true, if the variant is selected.
223  /// - false, otherwise.
224  bool IsCompletedness(void) const;
225 
226  /// Get the variant data.
227  ///
228  /// @return
229  /// Copy of the variant data.
230  TCompletedness GetCompletedness(void) const;
231 
232  /// Select the variant.
233  ///
234  /// @return
235  /// Reference to the variant data.
237 
238  /// Select the variant and set its data.
239  ///
240  /// @param value
241  /// Variant data.
243 
244 
245  /// Check if variant Mol_class is selected.
246  ///
247  /// Mol_class type is defined as 'typedef EMolecule_class_type TMol_class'.
248  /// @return
249  /// - true, if the variant is selected.
250  /// - false, otherwise.
251  bool IsMol_class(void) const;
252 
253  /// Get the variant data.
254  ///
255  /// @return
256  /// Copy of the variant data.
257  TMol_class GetMol_class(void) const;
258 
259  /// Select the variant.
260  ///
261  /// @return
262  /// Reference to the variant data.
263  TMol_class& SetMol_class(void);
264 
265  /// Select the variant and set its data.
266  ///
267  /// @param value
268  /// Variant data.
270 
271 
272  /// Check if variant Topology is selected.
273  ///
274  /// Topology type is defined as 'typedef ETopology_type TTopology'.
275  /// @return
276  /// - true, if the variant is selected.
277  /// - false, otherwise.
278  bool IsTopology(void) const;
279 
280  /// Get the variant data.
281  ///
282  /// @return
283  /// Copy of the variant data.
284  TTopology GetTopology(void) const;
285 
286  /// Select the variant.
287  ///
288  /// @return
289  /// Reference to the variant data.
290  TTopology& SetTopology(void);
291 
292  /// Select the variant and set its data.
293  ///
294  /// @param value
295  /// Variant data.
297 
298 
299  /// Check if variant Strand is selected.
300  ///
301  /// Strand type is defined as 'typedef EStrand_type TStrand'.
302  /// @return
303  /// - true, if the variant is selected.
304  /// - false, otherwise.
305  bool IsStrand(void) const;
306 
307  /// Get the variant data.
308  ///
309  /// @return
310  /// Copy of the variant data.
311  TStrand GetStrand(void) const;
312 
313  /// Select the variant.
314  ///
315  /// @return
316  /// Reference to the variant data.
317  TStrand& SetStrand(void);
318 
319  /// Select the variant and set its data.
320  ///
321  /// @param value
322  /// Variant data.
323  void SetStrand(TStrand value);
324 
325 
326 private:
327  // copy constructor and assignment operator
330  // choice state
332  // helper methods
333  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
334 
335  static const char* const sm_SelectionNames[];
336  // data
337  union {
344  };
345 };
346 
347 /* @} */
348 
349 
350 
351 
352 
353 ///////////////////////////////////////////////////////////
354 ///////////////////// inline methods //////////////////////
355 ///////////////////////////////////////////////////////////
356 inline
358 {
359  return m_choice;
360 }
361 
362 inline
364 {
365  if ( m_choice != index )
366  ThrowInvalidSelection(index);
367 }
368 
369 inline
370 void CMolinfo_field_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
371 {
372  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
373  if ( m_choice != e_not_set )
374  ResetSelection();
375  DoSelect(index, pool);
376  }
377 }
378 
379 inline
381 {
382  Select(index, reset, 0);
383 }
384 
385 inline
387 {
388  return m_choice == e_Molecule;
389 }
390 
391 inline
393 {
395  return m_Molecule;
396 }
397 
398 inline
400 {
402  return m_Molecule;
403 }
404 
405 inline
407 {
409  m_Molecule = value;
410 }
411 
412 inline
414 {
415  return m_choice == e_Technique;
416 }
417 
418 inline
420 {
422  return m_Technique;
423 }
424 
425 inline
427 {
429  return m_Technique;
430 }
431 
432 inline
434 {
436  m_Technique = value;
437 }
438 
439 inline
441 {
442  return m_choice == e_Completedness;
443 }
444 
445 inline
447 {
449  return m_Completedness;
450 }
451 
452 inline
454 {
456  return m_Completedness;
457 }
458 
459 inline
461 {
464 }
465 
466 inline
468 {
469  return m_choice == e_Mol_class;
470 }
471 
472 inline
474 {
476  return m_Mol_class;
477 }
478 
479 inline
481 {
483  return m_Mol_class;
484 }
485 
486 inline
488 {
490  m_Mol_class = value;
491 }
492 
493 inline
495 {
496  return m_choice == e_Topology;
497 }
498 
499 inline
501 {
503  return m_Topology;
504 }
505 
506 inline
508 {
510  return m_Topology;
511 }
512 
513 inline
515 {
517  m_Topology = value;
518 }
519 
520 inline
522 {
523  return m_choice == e_Strand;
524 }
525 
526 inline
528 {
530  return m_Strand;
531 }
532 
533 inline
535 {
537  return m_Strand;
538 }
539 
540 inline
542 {
544  m_Strand = value;
545 }
546 
547 ///////////////////////////////////////////////////////////
548 ////////////////// end of inline methods //////////////////
549 ///////////////////////////////////////////////////////////
550 
551 
552 
553 
554 
555 END_objects_SCOPE // namespace ncbi::objects::
556 
558 
559 
560 #endif // OBJECTS_MACRO_MOLINFO_FIELD_BASE_HPP
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CMolinfo_field_Base –.
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
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
TMol_class GetMol_class(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsTechnique(void) const
Check if variant Technique is selected.
static const char *const sm_SelectionNames[]
bool IsMolecule(void) const
Check if variant Molecule is selected.
bool IsMol_class(void) const
Check if variant Mol_class is selected.
virtual void Reset(void)
Reset the whole object.
CMolinfo_field_Base(const CMolinfo_field_Base &)
TTopology & SetTopology(void)
Select the variant.
E_Choice
Choice variants.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsCompletedness(void) const
Check if variant Completedness is selected.
TMolecule GetMolecule(void) const
Get the variant data.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
TMol_class & SetMol_class(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsTopology(void) const
Check if variant Topology is selected.
EMolecule_class_type
Access to EMolecule_class_type's attributes (values, names) as defined in spec.
EMolecule_type TMolecule
EStrand_type
Access to EStrand_type's attributes (values, names) as defined in spec.
ECompletedness_type TCompletedness
TStrand & SetStrand(void)
Select the variant.
CSerialObject Tparent
CMolinfo_field_Base & operator=(const CMolinfo_field_Base &)
TTopology GetTopology(void) const
Get the variant data.
TCompletedness m_Completedness
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TCompletedness GetCompletedness(void) const
Get the variant data.
ETechnique_type TTechnique
TCompletedness & SetCompletedness(void)
Select the variant.
TMolecule & SetMolecule(void)
Select the variant.
ETopology_type TTopology
TStrand GetStrand(void) const
Get the variant data.
virtual ~CMolinfo_field_Base(void)
ETechnique_type
Access to ETechnique_type's attributes (values, names) as defined in spec.
EMolecule_type
Access to EMolecule_type's attributes (values, names) as defined in spec.
bool IsStrand(void) const
Check if variant Strand is selected.
ECompletedness_type
Access to ECompletedness_type's attributes (values, names) as defined in spec.
TTechnique & SetTechnique(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
EMolecule_class_type TMol_class
ETopology_type
Access to ETopology_type's attributes (values, names) as defined in spec.
TTechnique GetTechnique(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
@ e_MaxChoice
== e_Strand+1
@ e_not_set
No variant selected.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue May 28 05:54:23 2024 by modify_doxy.py rev. 669887