NCBI C++ ToolKit
ID2_Error_.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 ID2_Error_.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/id2/id2.asn">id2.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/id2/id2.def">id2.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_ID2_ID2_ERROR_BASE_HPP
42 #define OBJECTS_ID2_ID2_ERROR_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
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 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_ID2Access
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CID2_Error_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CID2_Error_Base(void);
78  // destructor
79  virtual ~CID2_Error_Base(void);
80 
81  // type info
83 
84  enum ESeverity {
85  eSeverity_warning = 1, ///< nothing harmful happened
86  eSeverity_failed_command = 2, ///< command cannot be completed this time
87  eSeverity_failed_connection = 3, ///< connection cannot be reused, reconnect is required
88  eSeverity_failed_server = 4, ///< server cannot be used for a while
89  eSeverity_no_data = 5, ///< resolve request gives no data probably temporarily (see retry-delay field)
90  eSeverity_restricted_data = 6, ///< data exists but client doesn't have permission to get it
91  eSeverity_unsupported_command = 7, ///< this request type is not supported by server
92  eSeverity_invalid_arguments = 8 ///< error in request packet, cannot retry
93  };
94 
95  /// Access to ESeverity's attributes (values, names) as defined in spec
96  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ESeverity)(void);
97 
98  // types
100  typedef int TRetry_delay;
101  typedef string TMessage;
102 
103  // member index
104  enum class E_memberIndex {
105  e__allMandatory = 0,
106  e_severity,
107  e_retry_delay,
108  e_message
109  };
111 
112  // getters
113  // setters
114 
115  /// Check if a value has been assigned to Severity data member.
116  ///
117  /// Data member Severity is mandatory;
118  /// its type is defined as 'typedef ESeverity TSeverity'
119  /// @return
120  /// - true, if a value has been assigned.
121  /// - false, otherwise.
122  bool IsSetSeverity(void) const;
123 
124  /// Check if it is safe to call GetSeverity method.
125  ///
126  /// @return
127  /// - true, if the data member is getatable.
128  /// - false, otherwise.
129  bool CanGetSeverity(void) const;
130 
131  /// Reset Severity data member.
132  void ResetSeverity(void);
133 
134  /// Get the Severity member data.
135  ///
136  /// @return
137  /// Copy of the member data.
138  TSeverity GetSeverity(void) const;
139 
140  /// Assign a value to Severity data member.
141  ///
142  /// @param value
143  /// Value to assign
144  void SetSeverity(TSeverity value);
145 
146  /// Assign a value to Severity data member.
147  ///
148  /// @return
149  /// Reference to the data value.
150  TSeverity& SetSeverity(void);
151 
152  /// client may retry the request after specified time in seconds
153  /// Check if a value has been assigned to Retry_delay data member.
154  ///
155  /// Data member Retry_delay is optional;
156  /// its type is defined as 'typedef int TRetry_delay'
157  /// @return
158  /// - true, if a value has been assigned.
159  /// - false, otherwise.
160  bool IsSetRetry_delay(void) const;
161 
162  /// Check if it is safe to call GetRetry_delay method.
163  ///
164  /// @return
165  /// - true, if the data member is getatable.
166  /// - false, otherwise.
167  bool CanGetRetry_delay(void) const;
168 
169  /// Reset Retry_delay data member.
170  void ResetRetry_delay(void);
171 
172  /// Get the Retry_delay member data.
173  ///
174  /// @return
175  /// Copy of the member data.
176  TRetry_delay GetRetry_delay(void) const;
177 
178  /// Assign a value to Retry_delay data member.
179  ///
180  /// @param value
181  /// Value to assign
182  void SetRetry_delay(TRetry_delay value);
183 
184  /// Assign a value to Retry_delay data member.
185  ///
186  /// @return
187  /// Reference to the data value.
188  TRetry_delay& SetRetry_delay(void);
189 
190  /// Check if a value has been assigned to Message data member.
191  ///
192  /// Data member Message is optional;
193  /// its type is defined as 'typedef string TMessage'
194  /// @return
195  /// - true, if a value has been assigned.
196  /// - false, otherwise.
197  bool IsSetMessage(void) const;
198 
199  /// Check if it is safe to call GetMessage method.
200  ///
201  /// @return
202  /// - true, if the data member is getatable.
203  /// - false, otherwise.
204  bool CanGetMessage(void) const;
205 
206  /// Reset Message data member.
207  void ResetMessage(void);
208 
209  /// Get the Message member data.
210  ///
211  /// @return
212  /// Reference to the member data.
213  const TMessage& GetMessage(void) const;
214 
215  /// Assign a value to Message data member.
216  ///
217  /// @param value
218  /// Value to assign
219  void SetMessage(const TMessage& value);
220  void SetMessage(TMessage&& value);
221 
222  /// Assign a value to Message data member.
223  ///
224  /// @return
225  /// Reference to the data value.
226  TMessage& SetMessage(void);
227 
228  /// Reset the whole object
229  virtual void Reset(void);
230 
231 
232 private:
233  // Prohibit copy constructor and assignment operator
236 
237  // data
238  Uint4 m_set_State[1];
241  string m_Message;
242 };
243 
244 /* @} */
245 
246 
247 
248 
249 
250 ///////////////////////////////////////////////////////////
251 ///////////////////// inline methods //////////////////////
252 ///////////////////////////////////////////////////////////
253 inline
255 {
256  return ((m_set_State[0] & 0x3) != 0);
257 }
258 
259 inline
261 {
262  return IsSetSeverity();
263 }
264 
265 inline
267 {
268  m_Severity = (ESeverity)(0);
269  m_set_State[0] &= ~0x3;
270 }
271 
272 inline
274 {
275  if (!CanGetSeverity()) {
276  ThrowUnassigned(0);
277  }
278  return m_Severity;
279 }
280 
281 inline
283 {
284  m_Severity = value;
285  m_set_State[0] |= 0x3;
286 }
287 
288 inline
290 {
291 #ifdef _DEBUG
292  if (!IsSetSeverity()) {
293  memset(&m_Severity,UnassignedByte(),sizeof(m_Severity));
294  }
295 #endif
296  m_set_State[0] |= 0x1;
297  return m_Severity;
298 }
299 
300 inline
302 {
303  return ((m_set_State[0] & 0xc) != 0);
304 }
305 
306 inline
308 {
309  return IsSetRetry_delay();
310 }
311 
312 inline
314 {
315  m_Retry_delay = 0;
316  m_set_State[0] &= ~0xc;
317 }
318 
319 inline
321 {
322  if (!CanGetRetry_delay()) {
323  ThrowUnassigned(1);
324  }
325  return m_Retry_delay;
326 }
327 
328 inline
330 {
332  m_set_State[0] |= 0xc;
333 }
334 
335 inline
337 {
338 #ifdef _DEBUG
339  if (!IsSetRetry_delay()) {
340  memset(&m_Retry_delay,UnassignedByte(),sizeof(m_Retry_delay));
341  }
342 #endif
343  m_set_State[0] |= 0x4;
344  return m_Retry_delay;
345 }
346 
347 inline
349 {
350  return ((m_set_State[0] & 0x30) != 0);
351 }
352 
353 inline
355 {
356  return IsSetMessage();
357 }
358 
359 inline
361 {
362  if (!CanGetMessage()) {
363  ThrowUnassigned(2);
364  }
365  return m_Message;
366 }
367 
368 inline
370 {
371  m_Message = value;
372  m_set_State[0] |= 0x30;
373 }
374 
375 inline
377 {
378  m_Message = std::forward<CID2_Error_Base::TMessage>(value);
379  m_set_State[0] |= 0x30;
380 }
381 
382 inline
384 {
385 #ifdef _DEBUG
386  if (!IsSetMessage()) {
388  }
389 #endif
390  m_set_State[0] |= 0x10;
391  return m_Message;
392 }
393 
394 ///////////////////////////////////////////////////////////
395 ////////////////// end of inline methods //////////////////
396 ///////////////////////////////////////////////////////////
397 
398 
399 
400 
401 
402 END_objects_SCOPE // namespace ncbi::objects::
403 
405 
406 
407 #endif // OBJECTS_ID2_ID2_ERROR_BASE_HPP
CID2_Error_Base –.
Definition: ID2_Error_.hpp:73
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
static string UnassignedString(void)
Definition: serialbase.hpp:175
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#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_ID2_EXPORT
Definition: ncbi_export.h:552
bool CanGetSeverity(void) const
Check if it is safe to call GetSeverity method.
Definition: ID2_Error_.hpp:260
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: ID2_Error_.hpp:110
bool CanGetMessage(void) const
Check if it is safe to call GetMessage method.
Definition: ID2_Error_.hpp:354
void ResetSeverity(void)
Reset Severity data member.
Definition: ID2_Error_.hpp:266
Uint4 m_set_State[1]
Definition: ID2_Error_.hpp:238
TRetry_delay GetRetry_delay(void) const
Get the Retry_delay member data.
Definition: ID2_Error_.hpp:320
TSeverity & SetSeverity(void)
Assign a value to Severity data member.
Definition: ID2_Error_.hpp:289
bool CanGetRetry_delay(void) const
Check if it is safe to call GetRetry_delay method.
Definition: ID2_Error_.hpp:307
bool IsSetSeverity(void) const
Check if a value has been assigned to Severity data member.
Definition: ID2_Error_.hpp:254
ESeverity TSeverity
Definition: ID2_Error_.hpp:99
bool IsSetRetry_delay(void) const
client may retry the request after specified time in seconds Check if a value has been assigned to Re...
Definition: ID2_Error_.hpp:301
CSerialObject Tparent
Definition: ID2_Error_.hpp:74
CID2_Error_Base & operator=(const CID2_Error_Base &)
TMessage & SetMessage(void)
Assign a value to Message data member.
Definition: ID2_Error_.hpp:383
CID2_Error_Base(const CID2_Error_Base &)
TRetry_delay & SetRetry_delay(void)
Assign a value to Retry_delay data member.
Definition: ID2_Error_.hpp:336
ESeverity m_Severity
Definition: ID2_Error_.hpp:239
const TMessage & GetMessage(void) const
Get the Message member data.
Definition: ID2_Error_.hpp:360
bool IsSetMessage(void) const
Check if a value has been assigned to Message data member.
Definition: ID2_Error_.hpp:348
TSeverity GetSeverity(void) const
Get the Severity member data.
Definition: ID2_Error_.hpp:273
void ResetRetry_delay(void)
Reset Retry_delay data member.
Definition: ID2_Error_.hpp:313
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Thu Jul 18 16:07:42 2024 by modify_doxy.py rev. 669887