NCBI C++ ToolKit
GBenchServiceRequest_.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 GBenchServiceRequest_.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/gui/objects/gui_objects.asn">gui_objects.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/gui/objects/gui_objects.def">gui_objects.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 GUI_OBJECTS_GBENCHSERVICEREQUEST_BASE_HPP
42 #define GUI_OBJECTS_GBENCHSERVICEREQUEST_BASE_HPP
43 
44 // extra headers
45 #include <gui/gui_export.h>
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 // forward declarations
60 class CGBenchInitRequest;
62 class CUser_object;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_GBenchService
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 ///
75 /// A request is a choice of a few different entities
76 ///
77 ///
78 /// CGBenchServiceRequest_Base --
79 ///
80 
82 {
84 public:
85  // constructor
87  // destructor
88  virtual ~CGBenchServiceRequest_Base(void);
89 
90  // type info
92 
93 
94  /// Choice variants.
95  enum E_Choice {
96  e_not_set = 0, ///< No variant selected
100  e_Generic
101  };
102  /// Maximum+1 value of the choice variant enumerator.
104  e_MaxChoice = 5 ///< == e_Generic+1
105  };
106 
107  /// Reset the whole object
108  virtual void Reset(void);
109 
110  /// Reset the selection (set it to e_not_set).
111  virtual void ResetSelection(void);
112 
113  /// Which variant is currently selected.
114  ///
115  /// @return
116  /// Choice state enumerator.
117  E_Choice Which(void) const;
118 
119  /// Verify selection, throw exception if it differs from the expected.
120  ///
121  /// @param index
122  /// Expected selection.
123  void CheckSelected(E_Choice index) const;
124 
125  /// Throw 'InvalidSelection' exception.
126  ///
127  /// @param index
128  /// Expected selection.
129  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
130 
131  /// Retrieve selection name (for diagnostic purposes).
132  ///
133  /// @param index
134  /// One of possible selection states.
135  /// @return
136  /// Name string.
137  static string SelectionName(E_Choice index);
138 
139  /// Select the requested variant if needed.
140  ///
141  /// @param index
142  /// New selection state.
143  /// @param reset
144  /// Flag that defines the resetting of the variant data. The data will
145  /// be reset if either the current selection differs from the new one,
146  /// or the flag is set to eDoResetVariant.
148  /// Select the requested variant if needed,
149  /// allocating CObject variants from memory pool.
150  void Select(E_Choice index,
151  EResetVariant reset,
152  CObjectMemoryPool* pool);
153 
154  // types
159 
160  // getters
161  // setters
162 
163 
164  /// Check if variant Init is selected.
165  ///
166  /// Init type is defined as 'typedef CGBenchInitRequest TInit'.
167  /// @return
168  /// - true, if the variant is selected.
169  /// - false, otherwise.
170  bool IsInit(void) const;
171 
172  /// Get the variant data.
173  ///
174  /// @return
175  /// Reference to the data.
176  const TInit& GetInit(void) const;
177 
178  /// Select the variant.
179  ///
180  /// @return
181  /// Reference to the variant data.
182  TInit& SetInit(void);
183  /// Select the variant and set its data.
184  ///
185  /// @param value
186  /// Reference to the data.
187  void SetInit(TInit& value);
188 
189 
190  /// Check if variant Version_update is selected.
191  ///
192  /// Version_update type is defined as 'typedef CGBenchVersionRequest TVersion_update'.
193  /// @return
194  /// - true, if the variant is selected.
195  /// - false, otherwise.
196  bool IsVersion_update(void) const;
197 
198  /// Get the variant data.
199  ///
200  /// @return
201  /// Reference to the data.
202  const TVersion_update& GetVersion_update(void) const;
203 
204  /// Select the variant.
205  ///
206  /// @return
207  /// Reference to the variant data.
208  TVersion_update& SetVersion_update(void);
209  /// Select the variant and set its data.
210  ///
211  /// @param value
212  /// Reference to the data.
213  void SetVersion_update(TVersion_update& value);
214 
215 
216  /// Check if variant Feedback is selected.
217  ///
218  /// Feedback type is defined as 'typedef CGBenchFeedbackRequest TFeedback'.
219  /// @return
220  /// - true, if the variant is selected.
221  /// - false, otherwise.
222  bool IsFeedback(void) const;
223 
224  /// Get the variant data.
225  ///
226  /// @return
227  /// Reference to the data.
228  const TFeedback& GetFeedback(void) const;
229 
230  /// Select the variant.
231  ///
232  /// @return
233  /// Reference to the variant data.
234  TFeedback& SetFeedback(void);
235  /// Select the variant and set its data.
236  ///
237  /// @param value
238  /// Reference to the data.
239  void SetFeedback(TFeedback& value);
240 
241 
242  /// Check if variant Generic is selected.
243  ///
244  /// Generic type is defined as 'typedef CUser_object TGeneric'.
245  /// @return
246  /// - true, if the variant is selected.
247  /// - false, otherwise.
248  bool IsGeneric(void) const;
249 
250  /// Get the variant data.
251  ///
252  /// @return
253  /// Reference to the data.
254  const TGeneric& GetGeneric(void) const;
255 
256  /// Select the variant.
257  ///
258  /// @return
259  /// Reference to the variant data.
260  TGeneric& SetGeneric(void);
261  /// Select the variant and set its data.
262  ///
263  /// @param value
264  /// Reference to the data.
265  void SetGeneric(TGeneric& value);
266 
267 
268 private:
269  // copy constructor and assignment operator
272  // choice state
274  // helper methods
275  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
276 
277  static const char* const sm_SelectionNames[];
278  // data
279  NCBI_NS_NCBI::CSerialObject *m_object;
280 };
281 
282 /* @} */
283 
284 
285 
286 
287 
288 ///////////////////////////////////////////////////////////
289 ///////////////////// inline methods //////////////////////
290 ///////////////////////////////////////////////////////////
291 inline
293 {
294  return m_choice;
295 }
296 
297 inline
299 {
300  if ( m_choice != index )
301  ThrowInvalidSelection(index);
302 }
303 
304 inline
305 void CGBenchServiceRequest_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
306 {
307  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
308  if ( m_choice != e_not_set )
309  ResetSelection();
310  DoSelect(index, pool);
311  }
312 }
313 
314 inline
316 {
317  Select(index, reset, 0);
318 }
319 
320 inline
322 {
323  return m_choice == e_Init;
324 }
325 
326 inline
328 {
329  return m_choice == e_Version_update;
330 }
331 
332 inline
334 {
335  return m_choice == e_Feedback;
336 }
337 
338 inline
340 {
341  return m_choice == e_Generic;
342 }
343 
344 ///////////////////////////////////////////////////////////
345 ////////////////// end of inline methods //////////////////
346 ///////////////////////////////////////////////////////////
347 
348 
349 
350 
351 
352 END_objects_SCOPE // namespace ncbi::objects::
353 
355 
356 
357 #endif // GUI_OBJECTS_GBENCHSERVICEREQUEST_BASE_HPP
A request is a choice of a few different entities.
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_GUIOBJECTS_EXPORT
Definition: gui_export.h:511
CGBenchServiceRequest_Base & operator=(const CGBenchServiceRequest_Base &)
CGBenchVersionRequest TVersion_update
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsInit(void) const
Check if variant Init is selected.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
bool IsFeedback(void) const
Check if variant Feedback is selected.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsGeneric(void) const
Check if variant Generic is selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
CGBenchFeedbackRequest TFeedback
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
bool IsVersion_update(void) const
Check if variant Version_update is selected.
NCBI_NS_NCBI::CSerialObject * m_object
E_Choice Which(void) const
Which variant is currently selected.
CGBenchServiceRequest_Base(const CGBenchServiceRequest_Base &)
Defines to provide correct exporting from DLLs in Windows.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:37 2024 by modify_doxy.py rev. 669887