NCBI C++ ToolKit
RMReply_.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 RMReply_.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/remap/remap.asn">remap.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/remap/remap.def">remap.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_REMAP_RMREPLY_BASE_HPP
42 #define OBJECTS_REMAP_RMREPLY_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
49 #include <string>
50 
52 
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
56 #endif
57 BEGIN_objects_SCOPE // namespace ncbi::objects::
58 
59 
60 // forward declarations
61 class CRemap_result;
62 
63 
64 // generated classes
65 
66 
67 /** @addtogroup dataspec_NCBI_Remap
68  *
69  * @{
70  */
71 
72 /////////////////////////////////////////////////////////////////////////////
73 ///
74 /// CRMReply_Base --
75 ///
76 
78 {
80 public:
81  // constructor
82  CRMReply_Base(void);
83  // destructor
84  virtual ~CRMReply_Base(void);
85 
86  // type info
88 
89 
90  /// Choice variants.
91  enum E_Choice {
92  e_not_set = 0, ///< No variant selected
93  e_Error, ///< if nothing can be returned
94  e_Remap, ///< result of actual remapping
95  e_Maps_to_builds, ///< all the builds that the server knows how to map this build to
96  e_Maps_from_builds, ///< all the builds that the server knows how to map to this build
97  e_All_builds ///< all builds that the server knows of
98  };
99  /// Maximum+1 value of the choice variant enumerator.
101  e_MaxChoice = 6 ///< == e_All_builds+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
152  typedef string TError;
154  typedef list< string > TMaps_to_builds;
155  typedef list< string > TMaps_from_builds;
156  typedef list< string > TAll_builds;
157 
158  // getters
159  // setters
160 
161 
162  /// Check if variant Error is selected.
163  ///
164  /// Error type is defined as 'typedef string TError'.
165  /// @return
166  /// - true, if the variant is selected.
167  /// - false, otherwise.
168  bool IsError(void) const;
169 
170  /// Get the variant data.
171  ///
172  /// @return
173  /// Reference to the data.
174  const TError& GetError(void) const;
175 
176  /// Select the variant.
177  ///
178  /// @return
179  /// Reference to the variant data.
180  TError& SetError(void);
181 
182  /// Select the variant and set its data.
183  ///
184  /// @param value
185  /// Variant data.
186  void SetError(const TError& value);
187 
188 
189  /// Check if variant Remap is selected.
190  ///
191  /// Remap type is defined as 'typedef CRemap_result TRemap'.
192  /// @return
193  /// - true, if the variant is selected.
194  /// - false, otherwise.
195  bool IsRemap(void) const;
196 
197  /// Get the variant data.
198  ///
199  /// @return
200  /// Reference to the data.
201  const TRemap& GetRemap(void) const;
202 
203  /// Select the variant.
204  ///
205  /// @return
206  /// Reference to the variant data.
207  TRemap& SetRemap(void);
208  /// Select the variant and set its data.
209  ///
210  /// @param value
211  /// Reference to the data.
212  void SetRemap(TRemap& value);
213 
214 
215  /// Check if variant Maps_to_builds is selected.
216  ///
217  /// Maps_to_builds type is defined as 'typedef list< string > TMaps_to_builds'.
218  /// @return
219  /// - true, if the variant is selected.
220  /// - false, otherwise.
221  bool IsMaps_to_builds(void) const;
222 
223  /// Get the variant data.
224  ///
225  /// @return
226  /// Reference to the data.
227  const TMaps_to_builds& GetMaps_to_builds(void) const;
228 
229  /// Select the variant.
230  ///
231  /// @return
232  /// Reference to the variant data.
233  TMaps_to_builds& SetMaps_to_builds(void);
234 
235 
236  /// Check if variant Maps_from_builds is selected.
237  ///
238  /// Maps_from_builds type is defined as 'typedef list< string > TMaps_from_builds'.
239  /// @return
240  /// - true, if the variant is selected.
241  /// - false, otherwise.
242  bool IsMaps_from_builds(void) const;
243 
244  /// Get the variant data.
245  ///
246  /// @return
247  /// Reference to the data.
248  const TMaps_from_builds& GetMaps_from_builds(void) const;
249 
250  /// Select the variant.
251  ///
252  /// @return
253  /// Reference to the variant data.
254  TMaps_from_builds& SetMaps_from_builds(void);
255 
256 
257  /// Check if variant All_builds is selected.
258  ///
259  /// All_builds type is defined as 'typedef list< string > TAll_builds'.
260  /// @return
261  /// - true, if the variant is selected.
262  /// - false, otherwise.
263  bool IsAll_builds(void) const;
264 
265  /// Get the variant data.
266  ///
267  /// @return
268  /// Reference to the data.
269  const TAll_builds& GetAll_builds(void) const;
270 
271  /// Select the variant.
272  ///
273  /// @return
274  /// Reference to the variant data.
275  TAll_builds& SetAll_builds(void);
276 
277 
278 private:
279  // copy constructor and assignment operator
282  // choice state
284  // helper methods
285  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
286 
287  static const char* const sm_SelectionNames[];
288  // data
289  union {
290  NCBI_NS_NCBI::CUnionBuffer<TMaps_to_builds> m_Maps_to_builds;
291  NCBI_NS_NCBI::CUnionBuffer<TMaps_from_builds> m_Maps_from_builds;
292  NCBI_NS_NCBI::CUnionBuffer<TAll_builds> m_All_builds;
293  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
294  NCBI_NS_NCBI::CSerialObject *m_object;
295  };
296 };
297 
298 /* @} */
299 
300 
301 
302 
303 
304 ///////////////////////////////////////////////////////////
305 ///////////////////// inline methods //////////////////////
306 ///////////////////////////////////////////////////////////
307 inline
309 {
310  return m_choice;
311 }
312 
313 inline
315 {
316  if ( m_choice != index )
317  ThrowInvalidSelection(index);
318 }
319 
320 inline
321 void CRMReply_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
322 {
323  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
324  if ( m_choice != e_not_set )
325  ResetSelection();
326  DoSelect(index, pool);
327  }
328 }
329 
330 inline
331 void CRMReply_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
332 {
333  Select(index, reset, 0);
334 }
335 
336 inline
337 bool CRMReply_Base::IsError(void) const
338 {
339  return m_choice == e_Error;
340 }
341 
342 inline
344 {
346  return *m_string;
347 }
348 
349 inline
351 {
353  return *m_string;
354 }
355 
356 inline
357 bool CRMReply_Base::IsRemap(void) const
358 {
359  return m_choice == e_Remap;
360 }
361 
362 inline
364 {
365  return m_choice == e_Maps_to_builds;
366 }
367 
368 inline
370 {
372  return *m_Maps_to_builds;
373 }
374 
375 inline
377 {
379  return *m_Maps_to_builds;
380 }
381 
382 inline
384 {
385  return m_choice == e_Maps_from_builds;
386 }
387 
388 inline
390 {
392  return *m_Maps_from_builds;
393 }
394 
395 inline
397 {
399  return *m_Maps_from_builds;
400 }
401 
402 inline
404 {
405  return m_choice == e_All_builds;
406 }
407 
408 inline
410 {
412  return *m_All_builds;
413 }
414 
415 inline
417 {
419  return *m_All_builds;
420 }
421 
422 ///////////////////////////////////////////////////////////
423 ////////////////// end of inline methods //////////////////
424 ///////////////////////////////////////////////////////////
425 
426 
427 
428 
429 
430 END_objects_SCOPE // namespace ncbi::objects::
431 
433 
434 
435 #endif // OBJECTS_REMAP_RMREPLY_BASE_HPP
CRMReply_Base –.
Definition: RMReply_.hpp:78
CRemap_result –.
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
#define NCBI_REMAP_EXPORT
Definition: ncbi_export.h:728
CRMReply_Base(const CRMReply_Base &)
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
bool IsMaps_to_builds(void) const
Check if variant Maps_to_builds is selected.
Definition: RMReply_.hpp:363
const TMaps_to_builds & GetMaps_to_builds(void) const
Get the variant data.
Definition: RMReply_.hpp:369
const TAll_builds & GetAll_builds(void) const
Get the variant data.
Definition: RMReply_.hpp:409
list< string > TAll_builds
Definition: RMReply_.hpp:156
bool IsRemap(void) const
Check if variant Remap is selected.
Definition: RMReply_.hpp:357
E_Choice m_choice
Definition: RMReply_.hpp:283
NCBI_NS_NCBI::CUnionBuffer< TAll_builds > m_All_builds
Definition: RMReply_.hpp:292
TMaps_to_builds & SetMaps_to_builds(void)
Select the variant.
Definition: RMReply_.hpp:376
CSerialObject Tparent
Definition: RMReply_.hpp:79
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: RMReply_.hpp:293
TAll_builds & SetAll_builds(void)
Select the variant.
Definition: RMReply_.hpp:416
E_Choice Which(void) const
Which variant is currently selected.
Definition: RMReply_.hpp:308
TError & SetError(void)
Select the variant.
Definition: RMReply_.hpp:350
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: RMReply_.cpp:57
NCBI_NS_NCBI::CSerialObject * m_object
Definition: RMReply_.hpp:294
NCBI_NS_NCBI::CUnionBuffer< TMaps_to_builds > m_Maps_to_builds
Definition: RMReply_.hpp:290
E_Choice
Choice variants.
Definition: RMReply_.hpp:91
CRMReply_Base & operator=(const CRMReply_Base &)
CRemap_result TRemap
Definition: RMReply_.hpp:153
bool IsError(void) const
Check if variant Error is selected.
Definition: RMReply_.hpp:337
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: RMReply_.cpp:119
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
list< string > TMaps_to_builds
Definition: RMReply_.hpp:154
NCBI_NS_NCBI::CUnionBuffer< TMaps_to_builds > m_Maps_to_builds
Definition: RMReply_.hpp:290
NCBI_NS_NCBI::CUnionBuffer< TMaps_from_builds > m_Maps_from_builds
Definition: RMReply_.hpp:291
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: RMReply_.hpp:314
string TError
Definition: RMReply_.hpp:152
bool IsMaps_from_builds(void) const
Check if variant Maps_from_builds is selected.
Definition: RMReply_.hpp:383
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: RMReply_.hpp:100
DECLARE_INTERNAL_TYPE_INFO()
const TError & GetError(void) const
Get the variant data.
Definition: RMReply_.hpp:343
TMaps_from_builds & SetMaps_from_builds(void)
Select the variant.
Definition: RMReply_.hpp:396
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: RMReply_.hpp:293
bool IsAll_builds(void) const
Check if variant All_builds is selected.
Definition: RMReply_.hpp:403
NCBI_NS_NCBI::CUnionBuffer< TAll_builds > m_All_builds
Definition: RMReply_.hpp:292
NCBI_NS_NCBI::CUnionBuffer< TMaps_from_builds > m_Maps_from_builds
Definition: RMReply_.hpp:291
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: RMReply_.cpp:81
list< string > TMaps_from_builds
Definition: RMReply_.hpp:155
const TMaps_from_builds & GetMaps_from_builds(void) const
Get the variant data.
Definition: RMReply_.hpp:389
@ e_All_builds
all builds that the server knows of
Definition: RMReply_.hpp:97
@ e_not_set
No variant selected.
Definition: RMReply_.hpp:92
@ e_Error
if nothing can be returned
Definition: RMReply_.hpp:93
@ e_Maps_from_builds
all the builds that the server knows how to map to this build
Definition: RMReply_.hpp:96
@ e_Maps_to_builds
all the builds that the server knows how to map this build to
Definition: RMReply_.hpp:95
@ e_Remap
result of actual remapping
Definition: RMReply_.hpp:94
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Sep 04 15:00:30 2024 by modify_doxy.py rev. 669887