NCBI C++ ToolKit
Fix_caps_action_.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 Fix_caps_action_.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_FIX_CAPS_ACTION_BASE_HPP
42 #define OBJECTS_MACRO_FIX_CAPS_ACTION_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // forward declarations
60 class CFix_author_caps;
62 
63 
64 // generated classes
65 
66 
67 /** @addtogroup dataspec_NCBI_Macro
68  *
69  * @{
70  */
71 
72 /////////////////////////////////////////////////////////////////////////////
73 ///
74 /// CFix_caps_action_Base --
75 ///
76 
78 {
80 public:
81  // constructor
83  // destructor
84  virtual ~CFix_caps_action_Base(void);
85 
86  // type info
88 
89 
90  /// Choice variants.
91  enum E_Choice {
92  e_not_set = 0, ///< No variant selected
97  e_Author
98  };
99  /// Maximum+1 value of the choice variant enumerator.
101  e_MaxChoice = 6 ///< == e_Author+1
102  };
103 
104  /// Reset the whole object
105  virtual void Reset(void);
106 
107  /// Reset the selection (set it to e_not_set).
108  virtual void ResetSelection(void);
109 
110  /// Which variant is currently selected.
111  ///
112  /// @return
113  /// Choice state enumerator.
114  E_Choice Which(void) const;
115 
116  /// Verify selection, throw exception if it differs from the expected.
117  ///
118  /// @param index
119  /// Expected selection.
120  void CheckSelected(E_Choice index) const;
121 
122  /// Throw 'InvalidSelection' exception.
123  ///
124  /// @param index
125  /// Expected selection.
126  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
127 
128  /// Retrieve selection name (for diagnostic purposes).
129  ///
130  /// @param index
131  /// One of possible selection states.
132  /// @return
133  /// Name string.
134  static string SelectionName(E_Choice index);
135 
136  /// Select the requested variant if needed.
137  ///
138  /// @param index
139  /// New selection state.
140  /// @param reset
141  /// Flag that defines the resetting of the variant data. The data will
142  /// be reset if either the current selection differs from the new one,
143  /// or the flag is set to eDoResetVariant.
145  /// Select the requested variant if needed,
146  /// allocating CObject variants from memory pool.
147  void Select(E_Choice index,
148  EResetVariant reset,
149  CObjectMemoryPool* pool);
150 
151  // types
155 
156  // getters
157  // setters
158 
159 
160  /// Check if variant Pub is selected.
161  ///
162  /// Pub type is defined as 'typedef CFix_pub_caps_action TPub'.
163  /// @return
164  /// - true, if the variant is selected.
165  /// - false, otherwise.
166  bool IsPub(void) const;
167 
168  /// Get the variant data.
169  ///
170  /// @return
171  /// Reference to the data.
172  const TPub& GetPub(void) const;
173 
174  /// Select the variant.
175  ///
176  /// @return
177  /// Reference to the variant data.
178  TPub& SetPub(void);
179  /// Select the variant and set its data.
180  ///
181  /// @param value
182  /// Reference to the data.
183  void SetPub(TPub& value);
184 
185 
186  /// Check if variant Src_country is selected.
187  ///
188  /// @return
189  /// - true, if the variant is selected.
190  /// - false, otherwise.
191  bool IsSrc_country(void) const;
192 
193  /// Select the variant.
194  void SetSrc_country(void);
195 
196 
197  /// Check if variant Mouse_strain is selected.
198  ///
199  /// @return
200  /// - true, if the variant is selected.
201  /// - false, otherwise.
202  bool IsMouse_strain(void) const;
203 
204  /// Select the variant.
205  void SetMouse_strain(void);
206 
207 
208  /// Check if variant Src_qual is selected.
209  ///
210  /// Src_qual type is defined as 'typedef ESource_qual TSrc_qual'.
211  /// @return
212  /// - true, if the variant is selected.
213  /// - false, otherwise.
214  bool IsSrc_qual(void) const;
215 
216  /// Get the variant data.
217  ///
218  /// @return
219  /// Copy of the variant data.
220  TSrc_qual GetSrc_qual(void) const;
221 
222  /// Select the variant.
223  ///
224  /// @return
225  /// Reference to the variant data.
226  TSrc_qual& SetSrc_qual(void);
227 
228  /// Select the variant and set its data.
229  ///
230  /// @param value
231  /// Variant data.
233 
234 
235  /// Check if variant Author is selected.
236  ///
237  /// Author type is defined as 'typedef CFix_author_caps TAuthor'.
238  /// @return
239  /// - true, if the variant is selected.
240  /// - false, otherwise.
241  bool IsAuthor(void) const;
242 
243  /// Get the variant data.
244  ///
245  /// @return
246  /// Reference to the data.
247  const TAuthor& GetAuthor(void) const;
248 
249  /// Select the variant.
250  ///
251  /// @return
252  /// Reference to the variant data.
253  TAuthor& SetAuthor(void);
254  /// Select the variant and set its data.
255  ///
256  /// @param value
257  /// Reference to the data.
258  void SetAuthor(TAuthor& value);
259 
260 
261 private:
262  // copy constructor and assignment operator
265  // choice state
267  // helper methods
268  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
269 
270  static const char* const sm_SelectionNames[];
271  // data
272  union {
274  NCBI_NS_NCBI::CSerialObject *m_object;
275  };
276 };
277 
278 /* @} */
279 
280 
281 
282 
283 
284 ///////////////////////////////////////////////////////////
285 ///////////////////// inline methods //////////////////////
286 ///////////////////////////////////////////////////////////
287 inline
289 {
290  return m_choice;
291 }
292 
293 inline
295 {
296  if ( m_choice != index )
297  ThrowInvalidSelection(index);
298 }
299 
300 inline
301 void CFix_caps_action_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
302 {
303  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
304  if ( m_choice != e_not_set )
305  ResetSelection();
306  DoSelect(index, pool);
307  }
308 }
309 
310 inline
312 {
313  Select(index, reset, 0);
314 }
315 
316 inline
318 {
319  return m_choice == e_Pub;
320 }
321 
322 inline
324 {
325  return m_choice == e_Src_country;
326 }
327 
328 inline
330 {
332 }
333 
334 inline
336 {
337  return m_choice == e_Mouse_strain;
338 }
339 
340 inline
342 {
344 }
345 
346 inline
348 {
349  return m_choice == e_Src_qual;
350 }
351 
352 inline
354 {
356  return m_Src_qual;
357 }
358 
359 inline
361 {
363  return m_Src_qual;
364 }
365 
366 inline
368 {
370  m_Src_qual = value;
371 }
372 
373 inline
375 {
376  return m_choice == e_Author;
377 }
378 
379 ///////////////////////////////////////////////////////////
380 ////////////////// end of inline methods //////////////////
381 ///////////////////////////////////////////////////////////
382 
383 
384 
385 
386 
387 END_objects_SCOPE // namespace ncbi::objects::
388 
390 
391 
392 #endif // OBJECTS_MACRO_FIX_CAPS_ACTION_BASE_HPP
User-defined methods of the data storage class.
CFix_author_caps –.
CFix_caps_action_Base –.
CFix_pub_caps_action –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
char value[7]
Definition: config.c:431
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
ESource_qual
Access to ESource_qual's attributes (values, names) as defined in spec.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TPub & SetPub(void)
Select the variant.
TAuthor & SetAuthor(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
void SetMouse_strain(void)
Select the variant.
bool IsMouse_strain(void) const
Check if variant Mouse_strain is selected.
const TAuthor & GetAuthor(void) const
Get the variant data.
bool IsPub(void) const
Check if variant Pub is selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
E_Choice Which(void) const
Which variant is currently selected.
void SetSrc_country(void)
Select the variant.
TSrc_qual GetSrc_qual(void) const
Get the variant data.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
CFix_caps_action_Base & operator=(const CFix_caps_action_Base &)
bool IsSrc_country(void) const
Check if variant Src_country is selected.
static const char *const sm_SelectionNames[]
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsAuthor(void) const
Check if variant Author is selected.
virtual ~CFix_caps_action_Base(void)
CFix_author_caps TAuthor
E_Choice
Choice variants.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
virtual void Reset(void)
Reset the whole object.
const TPub & GetPub(void) const
Get the variant data.
CFix_pub_caps_action TPub
CFix_caps_action_Base(const CFix_caps_action_Base &)
TSrc_qual & SetSrc_qual(void)
Select the variant.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsSrc_qual(void) const
Check if variant Src_qual is selected.
@ e_not_set
No variant selected.
Modified on Sun Feb 25 03:08:08 2024 by modify_doxy.py rev. 669887