NCBI C++ ToolKit
Source_qual_choice_.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 Source_qual_choice_.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_SOURCE_QUAL_CHOICE_BASE_HPP
42 #define OBJECTS_MACRO_SOURCE_QUAL_CHOICE_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
51 
53 
54 #ifndef BEGIN_objects_SCOPE
55 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
56 # define END_objects_SCOPE END_SCOPE(objects)
57 #endif
58 BEGIN_objects_SCOPE // namespace ncbi::objects::
59 
60 
61 // generated classes
62 
63 
64 /** @addtogroup dataspec_NCBI_Macro
65  *
66  * @{
67  */
68 
69 /////////////////////////////////////////////////////////////////////////////
70 ///
71 /// CSource_qual_choice_Base --
72 ///
73 
75 {
77 public:
78  // constructor
80  // destructor
81  virtual ~CSource_qual_choice_Base(void);
82 
83  // type info
85 
86 
87  /// Choice variants.
88  enum E_Choice {
89  e_not_set = 0, ///< No variant selected
94  e_Mgcode
95  };
96  /// Maximum+1 value of the choice variant enumerator.
98  e_MaxChoice = 6 ///< == e_Mgcode+1
99  };
100 
101  /// Reset the whole object
102  virtual void Reset(void);
103 
104  /// Reset the selection (set it to e_not_set).
105  virtual void ResetSelection(void);
106 
107  /// Which variant is currently selected.
108  ///
109  /// @return
110  /// Choice state enumerator.
111  E_Choice Which(void) const;
112 
113  /// Verify selection, throw exception if it differs from the expected.
114  ///
115  /// @param index
116  /// Expected selection.
117  void CheckSelected(E_Choice index) const;
118 
119  /// Throw 'InvalidSelection' exception.
120  ///
121  /// @param index
122  /// Expected selection.
123  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
124 
125  /// Retrieve selection name (for diagnostic purposes).
126  ///
127  /// @param index
128  /// One of possible selection states.
129  /// @return
130  /// Name string.
131  static string SelectionName(E_Choice index);
132 
133  /// Select the requested variant if needed.
134  ///
135  /// @param index
136  /// New selection state.
137  /// @param reset
138  /// Flag that defines the resetting of the variant data. The data will
139  /// be reset if either the current selection differs from the new one,
140  /// or the flag is set to eDoResetVariant.
142  /// Select the requested variant if needed,
143  /// allocating CObject variants from memory pool.
144  void Select(E_Choice index,
145  EResetVariant reset,
146  CObjectMemoryPool* pool);
147 
148  // types
152  typedef int TGcode;
153  typedef int TMgcode;
154 
155  // getters
156  // setters
157 
158 
159  /// Check if variant Textqual is selected.
160  ///
161  /// Textqual type is defined as 'typedef ESource_qual TTextqual'.
162  /// @return
163  /// - true, if the variant is selected.
164  /// - false, otherwise.
165  bool IsTextqual(void) const;
166 
167  /// Get the variant data.
168  ///
169  /// @return
170  /// Copy of the variant data.
171  TTextqual GetTextqual(void) const;
172 
173  /// Select the variant.
174  ///
175  /// @return
176  /// Reference to the variant data.
177  TTextqual& SetTextqual(void);
178 
179  /// Select the variant and set its data.
180  ///
181  /// @param value
182  /// Variant data.
184 
185 
186  /// Check if variant Location is selected.
187  ///
188  /// Location type is defined as 'typedef ESource_location TLocation'.
189  /// @return
190  /// - true, if the variant is selected.
191  /// - false, otherwise.
192  bool IsLocation(void) const;
193 
194  /// Get the variant data.
195  ///
196  /// @return
197  /// Copy of the variant data.
198  TLocation GetLocation(void) const;
199 
200  /// Select the variant.
201  ///
202  /// @return
203  /// Reference to the variant data.
204  TLocation& SetLocation(void);
205 
206  /// Select the variant and set its data.
207  ///
208  /// @param value
209  /// Variant data.
211 
212 
213  /// Check if variant Origin is selected.
214  ///
215  /// Origin type is defined as 'typedef ESource_origin TOrigin'.
216  /// @return
217  /// - true, if the variant is selected.
218  /// - false, otherwise.
219  bool IsOrigin(void) const;
220 
221  /// Get the variant data.
222  ///
223  /// @return
224  /// Copy of the variant data.
225  TOrigin GetOrigin(void) const;
226 
227  /// Select the variant.
228  ///
229  /// @return
230  /// Reference to the variant data.
231  TOrigin& SetOrigin(void);
232 
233  /// Select the variant and set its data.
234  ///
235  /// @param value
236  /// Variant data.
237  void SetOrigin(TOrigin value);
238 
239 
240  /// Check if variant Gcode is selected.
241  ///
242  /// Gcode type is defined as 'typedef int TGcode'.
243  /// @return
244  /// - true, if the variant is selected.
245  /// - false, otherwise.
246  bool IsGcode(void) const;
247 
248  /// Get the variant data.
249  ///
250  /// @return
251  /// Copy of the variant data.
252  TGcode GetGcode(void) const;
253 
254  /// Select the variant.
255  ///
256  /// @return
257  /// Reference to the variant data.
258  TGcode& SetGcode(void);
259 
260  /// Select the variant and set its data.
261  ///
262  /// @param value
263  /// Variant data.
264  void SetGcode(TGcode value);
265 
266 
267  /// Check if variant Mgcode is selected.
268  ///
269  /// Mgcode type is defined as 'typedef int TMgcode'.
270  /// @return
271  /// - true, if the variant is selected.
272  /// - false, otherwise.
273  bool IsMgcode(void) const;
274 
275  /// Get the variant data.
276  ///
277  /// @return
278  /// Copy of the variant data.
279  TMgcode GetMgcode(void) const;
280 
281  /// Select the variant.
282  ///
283  /// @return
284  /// Reference to the variant data.
285  TMgcode& SetMgcode(void);
286 
287  /// Select the variant and set its data.
288  ///
289  /// @param value
290  /// Variant data.
291  void SetMgcode(TMgcode value);
292 
293 
294 private:
295  // copy constructor and assignment operator
298  // choice state
300  // helper methods
301  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
302 
303  static const char* const sm_SelectionNames[];
304  // data
305  union {
311  };
312 };
313 
314 /* @} */
315 
316 
317 
318 
319 
320 ///////////////////////////////////////////////////////////
321 ///////////////////// inline methods //////////////////////
322 ///////////////////////////////////////////////////////////
323 inline
325 {
326  return m_choice;
327 }
328 
329 inline
331 {
332  if ( m_choice != index )
333  ThrowInvalidSelection(index);
334 }
335 
336 inline
337 void CSource_qual_choice_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
338 {
339  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
340  if ( m_choice != e_not_set )
341  ResetSelection();
342  DoSelect(index, pool);
343  }
344 }
345 
346 inline
348 {
349  Select(index, reset, 0);
350 }
351 
352 inline
354 {
355  return m_choice == e_Textqual;
356 }
357 
358 inline
360 {
362  return m_Textqual;
363 }
364 
365 inline
367 {
369  return m_Textqual;
370 }
371 
372 inline
374 {
376  m_Textqual = value;
377 }
378 
379 inline
381 {
382  return m_choice == e_Location;
383 }
384 
385 inline
387 {
389  return m_Location;
390 }
391 
392 inline
394 {
396  return m_Location;
397 }
398 
399 inline
401 {
403  m_Location = value;
404 }
405 
406 inline
408 {
409  return m_choice == e_Origin;
410 }
411 
412 inline
414 {
416  return m_Origin;
417 }
418 
419 inline
421 {
423  return m_Origin;
424 }
425 
426 inline
428 {
430  m_Origin = value;
431 }
432 
433 inline
435 {
436  return m_choice == e_Gcode;
437 }
438 
439 inline
441 {
443  return m_Gcode;
444 }
445 
446 inline
448 {
450  return m_Gcode;
451 }
452 
453 inline
455 {
457  m_Gcode = value;
458 }
459 
460 inline
462 {
463  return m_choice == e_Mgcode;
464 }
465 
466 inline
468 {
470  return m_Mgcode;
471 }
472 
473 inline
475 {
477  return m_Mgcode;
478 }
479 
480 inline
482 {
484  m_Mgcode = value;
485 }
486 
487 ///////////////////////////////////////////////////////////
488 ////////////////// end of inline methods //////////////////
489 ///////////////////////////////////////////////////////////
490 
491 
492 
493 
494 
495 END_objects_SCOPE // namespace ncbi::objects::
496 
498 
499 
500 #endif // OBJECTS_MACRO_SOURCE_QUAL_CHOICE_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.
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSource_qual_choice_Base –.
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
CSource_qual_choice_Base & operator=(const CSource_qual_choice_Base &)
ESource_qual
Access to ESource_qual's attributes (values, names) as defined in spec.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TOrigin & SetOrigin(void)
Select the variant.
TTextqual GetTextqual(void) const
Get the variant data.
TMgcode & SetMgcode(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
TTextqual & SetTextqual(void)
Select the variant.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
TLocation & SetLocation(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
E_Choice Which(void) const
Which variant is currently selected.
ESource_origin
Access to ESource_origin's attributes (values, names) as defined in spec.
bool IsMgcode(void) const
Check if variant Mgcode is selected.
CSource_qual_choice_Base(const CSource_qual_choice_Base &)
TOrigin GetOrigin(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TGcode & SetGcode(void)
Select the variant.
ESource_location
Access to ESource_location's attributes (values, names) as defined in spec.
TMgcode GetMgcode(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
bool IsGcode(void) const
Check if variant Gcode is selected.
static const char *const sm_SelectionNames[]
TGcode GetGcode(void) const
Get the variant data.
bool IsTextqual(void) const
Check if variant Textqual is selected.
TLocation GetLocation(void) const
Get the variant data.
bool IsLocation(void) const
Check if variant Location is selected.
bool IsOrigin(void) const
Check if variant Origin is selected.
@ e_not_set
No variant selected.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Apr 26 16:25:22 2024 by modify_doxy.py rev. 669887