NCBI C++ ToolKit
DummyObsoleteType_.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 DummyObsoleteType_.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/gbproj/gbproj.asn">gbproj.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/gbproj/gbproj.def">gbproj.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_GBPROJ_DUMMYOBSOLETETYPE_BASE_HPP
42 #define OBJECTS_GBPROJ_DUMMYOBSOLETETYPE_BASE_HPP
43 
44 // extra headers
46 
47 // standard includes
48 #include <serial/serialbase.hpp>
50 
51 #ifndef BEGIN_objects_SCOPE
52 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
53 # define END_objects_SCOPE END_SCOPE(objects)
54 #endif
55 BEGIN_objects_SCOPE // namespace ncbi::objects::
56 
57 
58 // generated classes
59 
60 
61 /** @addtogroup dataspec_NCBI_GBProject
62  *
63  * @{
64  */
65 
66 /////////////////////////////////////////////////////////////////////////////
67 /// A dummy type used for replacing 'removed' or deprecated optional fields that
68 /// have not been used and won't be used any more.
69 ///
70 /// CDummyObsoleteType_Base --
71 ///
72 
74 {
76 public:
77  // constructor
79  // destructor
80  virtual ~CDummyObsoleteType_Base(void);
81 
82  // type info
84 
85 
86  /// Choice variants.
87  enum E_Choice {
88  e_not_set = 0, ///< No variant selected
89  e_Null
90  };
91  /// Maximum+1 value of the choice variant enumerator.
93  e_MaxChoice = 2 ///< == e_Null+1
94  };
95 
96  /// Reset the whole object
97  virtual void Reset(void);
98 
99  /// Reset the selection (set it to e_not_set).
100  virtual void ResetSelection(void);
101 
102  /// Which variant is currently selected.
103  ///
104  /// @return
105  /// Choice state enumerator.
106  E_Choice Which(void) const;
107 
108  /// Verify selection, throw exception if it differs from the expected.
109  ///
110  /// @param index
111  /// Expected selection.
112  void CheckSelected(E_Choice index) const;
113 
114  /// Throw 'InvalidSelection' exception.
115  ///
116  /// @param index
117  /// Expected selection.
118  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
119 
120  /// Retrieve selection name (for diagnostic purposes).
121  ///
122  /// @param index
123  /// One of possible selection states.
124  /// @return
125  /// Name string.
126  static string SelectionName(E_Choice index);
127 
128  /// Select the requested variant if needed.
129  ///
130  /// @param index
131  /// New selection state.
132  /// @param reset
133  /// Flag that defines the resetting of the variant data. The data will
134  /// be reset if either the current selection differs from the new one,
135  /// or the flag is set to eDoResetVariant.
137  /// Select the requested variant if needed,
138  /// allocating CObject variants from memory pool.
139  void Select(E_Choice index,
140  EResetVariant reset,
141  CObjectMemoryPool* pool);
142 
143  // types
144 
145  // getters
146  // setters
147 
148 
149  /// Check if variant Null is selected.
150  ///
151  /// @return
152  /// - true, if the variant is selected.
153  /// - false, otherwise.
154  bool IsNull(void) const;
155 
156  /// Select the variant.
157  void SetNull(void);
158 
159 
160 private:
161  // copy constructor and assignment operator
164  // choice state
166  // helper methods
167  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
168 
169  static const char* const sm_SelectionNames[];
170  // data
171 };
172 
173 /* @} */
174 
175 
176 
177 
178 
179 ///////////////////////////////////////////////////////////
180 ///////////////////// inline methods //////////////////////
181 ///////////////////////////////////////////////////////////
182 inline
184 {
185  return m_choice;
186 }
187 
188 inline
190 {
191  if ( m_choice != index )
192  ThrowInvalidSelection(index);
193 }
194 
195 inline
196 void CDummyObsoleteType_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
197 {
198  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
199  if ( m_choice != e_not_set )
200  ResetSelection();
201  DoSelect(index, pool);
202  }
203 }
204 
205 inline
207 {
208  Select(index, reset, 0);
209 }
210 
211 inline
213 {
214  return m_choice == e_Null;
215 }
216 
217 inline
219 {
221 }
222 
223 ///////////////////////////////////////////////////////////
224 ////////////////// end of inline methods //////////////////
225 ///////////////////////////////////////////////////////////
226 
227 
228 
229 
230 
231 END_objects_SCOPE // namespace ncbi::objects::
232 
234 
235 
236 #endif // OBJECTS_GBPROJ_DUMMYOBSOLETETYPE_BASE_HPP
A dummy type used for replacing 'removed' or deprecated optional fields that have not been used and w...
Base class for all serializable objects.
Definition: serialbase.hpp:150
Defines to provide correct exporting from DLLs in Windows.
#define NCBI_GBPROJ_EXPORT
Definition: gbproj_export.h:69
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.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
CDummyObsoleteType_Base & operator=(const CDummyObsoleteType_Base &)
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsNull(void) const
Check if variant Null is selected.
CDummyObsoleteType_Base(const CDummyObsoleteType_Base &)
void SetNull(void)
Select the variant.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
E_Choice Which(void) const
Which variant is currently selected.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
@ e_not_set
No variant selected.
@ e_not_set
Modified on Thu May 23 12:29:18 2024 by modify_doxy.py rev. 669887