NCBI C++ ToolKit
Entrez2_request_.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 Entrez2_request_.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/entrez2/entrez2.asn">entrez2.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/entrez2/entrez2.def">entrez2.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_ENTREZ2_ENTREZ2_REQUEST_BASE_HPP
42 #define OBJECTS_ENTREZ2_ENTREZ2_REQUEST_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 // forward declarations
60 class CE2Request;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_Entrez2
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///***************************************
73 /// Entrez2 Request types
74 ///***************************************
75 ///****************************************
76 /// The basic request wrapper leaves space for a version which
77 /// allow the server to support older clients
78 /// The tool parameter allows us to log the client types for
79 /// debugging and tuning
80 /// The cookie is a session ID returned by the first Entrez2-reply
81 ///****************************************
82 /// a standard request
83 ///
84 /// CEntrez2_request_Base --
85 ///
86 
88 {
90 public:
91  // constructor
93  // destructor
94  virtual ~CEntrez2_request_Base(void);
95 
96  // type info
98 
99  // types
101  typedef int TVersion;
102  typedef string TTool;
103  typedef string TCookie;
104  typedef bool TUse_history;
105 
106  // member index
107  enum class E_memberIndex {
108  e__allMandatory = 0,
109  e_request,
110  e_version,
111  e_tool,
112  e_cookie,
113  e_use_history
114  };
116 
117  // getters
118  // setters
119 
120  /// the actual request
121  /// Check if a value has been assigned to Request data member.
122  ///
123  /// Data member Request is mandatory;
124  /// its type is defined as 'typedef CE2Request TRequest'
125  /// @return
126  /// - true, if a value has been assigned.
127  /// - false, otherwise.
128  bool IsSetRequest(void) const;
129 
130  /// Check if it is safe to call GetRequest method.
131  ///
132  /// @return
133  /// - true, if the data member is getatable.
134  /// - false, otherwise.
135  bool CanGetRequest(void) const;
136 
137  /// Reset Request data member.
138  void ResetRequest(void);
139 
140  /// Get the Request member data.
141  ///
142  /// @return
143  /// Reference to the member data.
144  const TRequest& GetRequest(void) const;
145 
146  /// Assign a value to Request data member.
147  ///
148  /// @param value
149  /// Reference to value.
150  void SetRequest(TRequest& value);
151 
152  /// Assign a value to Request data member.
153  ///
154  /// @return
155  /// Reference to the data value.
156  TRequest& SetRequest(void);
157 
158  /// ASN1 spec version
159  /// Check if a value has been assigned to Version data member.
160  ///
161  /// Data member Version is mandatory;
162  /// its type is defined as 'typedef int TVersion'
163  /// @return
164  /// - true, if a value has been assigned.
165  /// - false, otherwise.
166  bool IsSetVersion(void) const;
167 
168  /// Check if it is safe to call GetVersion method.
169  ///
170  /// @return
171  /// - true, if the data member is getatable.
172  /// - false, otherwise.
173  bool CanGetVersion(void) const;
174 
175  /// Reset Version data member.
176  void ResetVersion(void);
177 
178  /// Get the Version member data.
179  ///
180  /// @return
181  /// Copy of the member data.
182  TVersion GetVersion(void) const;
183 
184  /// Assign a value to Version data member.
185  ///
186  /// @param value
187  /// Value to assign
188  void SetVersion(TVersion value);
189 
190  /// Assign a value to Version data member.
191  ///
192  /// @return
193  /// Reference to the data value.
194  TVersion& SetVersion(void);
195 
196  /// tool making request
197  /// Check if a value has been assigned to Tool data member.
198  ///
199  /// Data member Tool is optional;
200  /// its type is defined as 'typedef string TTool'
201  /// @return
202  /// - true, if a value has been assigned.
203  /// - false, otherwise.
204  bool IsSetTool(void) const;
205 
206  /// Check if it is safe to call GetTool method.
207  ///
208  /// @return
209  /// - true, if the data member is getatable.
210  /// - false, otherwise.
211  bool CanGetTool(void) const;
212 
213  /// Reset Tool data member.
214  void ResetTool(void);
215 
216  /// Get the Tool member data.
217  ///
218  /// @return
219  /// Reference to the member data.
220  const TTool& GetTool(void) const;
221 
222  /// Assign a value to Tool data member.
223  ///
224  /// @param value
225  /// Value to assign
226  void SetTool(const TTool& value);
227  void SetTool(TTool&& value);
228 
229  /// Assign a value to Tool data member.
230  ///
231  /// @return
232  /// Reference to the data value.
233  TTool& SetTool(void);
234 
235  /// history session cookie
236  /// Check if a value has been assigned to Cookie data member.
237  ///
238  /// Data member Cookie is optional;
239  /// its type is defined as 'typedef string TCookie'
240  /// @return
241  /// - true, if a value has been assigned.
242  /// - false, otherwise.
243  bool IsSetCookie(void) const;
244 
245  /// Check if it is safe to call GetCookie method.
246  ///
247  /// @return
248  /// - true, if the data member is getatable.
249  /// - false, otherwise.
250  bool CanGetCookie(void) const;
251 
252  /// Reset Cookie data member.
253  void ResetCookie(void);
254 
255  /// Get the Cookie member data.
256  ///
257  /// @return
258  /// Reference to the member data.
259  const TCookie& GetCookie(void) const;
260 
261  /// Assign a value to Cookie data member.
262  ///
263  /// @param value
264  /// Value to assign
265  void SetCookie(const TCookie& value);
266  void SetCookie(TCookie&& value);
267 
268  /// Assign a value to Cookie data member.
269  ///
270  /// @return
271  /// Reference to the data value.
272  TCookie& SetCookie(void);
273 
274  /// request should use history
275  /// Check if a value has been assigned to Use_history data member.
276  ///
277  /// Data member Use_history is optional with default false;
278  /// its type is defined as 'typedef bool TUse_history'
279  /// @return
280  /// - true, if a value has been assigned.
281  /// - false, otherwise.
282  bool IsSetUse_history(void) const;
283 
284  /// Check if it is safe to call GetUse_history method.
285  ///
286  /// @return
287  /// - true, if the data member is getatable.
288  /// - false, otherwise.
289  bool CanGetUse_history(void) const;
290 
291  /// Reset Use_history data member.
292  void ResetUse_history(void);
293 
294  /// Assign default value to Use_history data member.
295  void SetDefaultUse_history(void);
296 
297  /// Get the Use_history member data.
298  ///
299  /// @return
300  /// Copy of the member data.
301  TUse_history GetUse_history(void) const;
302 
303  /// Assign a value to Use_history data member.
304  ///
305  /// @param value
306  /// Value to assign
307  void SetUse_history(TUse_history value);
308 
309  /// Assign a value to Use_history data member.
310  ///
311  /// @return
312  /// Reference to the data value.
313  TUse_history& SetUse_history(void);
314 
315  /// Reset the whole object
316  virtual void Reset(void);
317 
318 
319 private:
320  // Prohibit copy constructor and assignment operator
323 
324  // data
325  Uint4 m_set_State[1];
328  string m_Tool;
329  string m_Cookie;
331 };
332 
333 /* @} */
334 
335 
336 
337 
338 
339 ///////////////////////////////////////////////////////////
340 ///////////////////// inline methods //////////////////////
341 ///////////////////////////////////////////////////////////
342 inline
344 {
345  return m_Request.NotEmpty();
346 }
347 
348 inline
350 {
351  return true;
352 }
353 
354 inline
356 {
357  if ( !m_Request ) {
358  const_cast<CEntrez2_request_Base*>(this)->ResetRequest();
359  }
360  return (*m_Request);
361 }
362 
363 inline
365 {
366  if ( !m_Request ) {
367  ResetRequest();
368  }
369  return (*m_Request);
370 }
371 
372 inline
374 {
375  return ((m_set_State[0] & 0xc) != 0);
376 }
377 
378 inline
380 {
381  return IsSetVersion();
382 }
383 
384 inline
386 {
387  m_Version = 0;
388  m_set_State[0] &= ~0xc;
389 }
390 
391 inline
393 {
394  if (!CanGetVersion()) {
395  ThrowUnassigned(1);
396  }
397  return m_Version;
398 }
399 
400 inline
402 {
403  m_Version = value;
404  m_set_State[0] |= 0xc;
405 }
406 
407 inline
409 {
410 #ifdef _DEBUG
411  if (!IsSetVersion()) {
412  memset(&m_Version,UnassignedByte(),sizeof(m_Version));
413  }
414 #endif
415  m_set_State[0] |= 0x4;
416  return m_Version;
417 }
418 
419 inline
421 {
422  return ((m_set_State[0] & 0x30) != 0);
423 }
424 
425 inline
427 {
428  return IsSetTool();
429 }
430 
431 inline
433 {
434  if (!CanGetTool()) {
435  ThrowUnassigned(2);
436  }
437  return m_Tool;
438 }
439 
440 inline
442 {
443  m_Tool = value;
444  m_set_State[0] |= 0x30;
445 }
446 
447 inline
449 {
450  m_Tool = std::forward<CEntrez2_request_Base::TTool>(value);
451  m_set_State[0] |= 0x30;
452 }
453 
454 inline
456 {
457 #ifdef _DEBUG
458  if (!IsSetTool()) {
460  }
461 #endif
462  m_set_State[0] |= 0x10;
463  return m_Tool;
464 }
465 
466 inline
468 {
469  return ((m_set_State[0] & 0xc0) != 0);
470 }
471 
472 inline
474 {
475  return IsSetCookie();
476 }
477 
478 inline
480 {
481  if (!CanGetCookie()) {
482  ThrowUnassigned(3);
483  }
484  return m_Cookie;
485 }
486 
487 inline
489 {
490  m_Cookie = value;
491  m_set_State[0] |= 0xc0;
492 }
493 
494 inline
496 {
497  m_Cookie = std::forward<CEntrez2_request_Base::TCookie>(value);
498  m_set_State[0] |= 0xc0;
499 }
500 
501 inline
503 {
504 #ifdef _DEBUG
505  if (!IsSetCookie()) {
507  }
508 #endif
509  m_set_State[0] |= 0x40;
510  return m_Cookie;
511 }
512 
513 inline
515 {
516  return ((m_set_State[0] & 0x300) != 0);
517 }
518 
519 inline
521 {
522  return true;
523 }
524 
525 inline
527 {
528  m_Use_history = false;
529  m_set_State[0] &= ~0x300;
530 }
531 
532 inline
534 {
536 }
537 
538 inline
540 {
541  return m_Use_history;
542 }
543 
544 inline
546 {
548  m_set_State[0] |= 0x300;
549 }
550 
551 inline
553 {
554 #ifdef _DEBUG
555  if (!IsSetUse_history()) {
556  memset(&m_Use_history,UnassignedByte(),sizeof(m_Use_history));
557  }
558 #endif
559  m_set_State[0] |= 0x100;
560  return m_Use_history;
561 }
562 
563 ///////////////////////////////////////////////////////////
564 ////////////////// end of inline methods //////////////////
565 ///////////////////////////////////////////////////////////
566 
567 
568 
569 
570 
571 END_objects_SCOPE // namespace ncbi::objects::
572 
574 
575 
576 #endif // OBJECTS_ENTREZ2_ENTREZ2_REQUEST_BASE_HPP
CE2Request –.
Definition: E2Request.hpp:66
*************************************** Entrez2 Request types ***************************************...
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
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_ENTREZ2_EXPORT
Definition: ncbi_export.h:464
bool IsSetRequest(void) const
the actual request Check if a value has been assigned to Request data member.
TRequest & SetRequest(void)
Assign a value to Request data member.
TVersion & SetVersion(void)
Assign a value to Version data member.
bool CanGetCookie(void) const
Check if it is safe to call GetCookie method.
bool CanGetTool(void) const
Check if it is safe to call GetTool method.
TUse_history & SetUse_history(void)
Assign a value to Use_history data member.
TTool & SetTool(void)
Assign a value to Tool data member.
CEntrez2_request_Base(const CEntrez2_request_Base &)
bool IsSetCookie(void) const
history session cookie Check if a value has been assigned to Cookie data member.
const TCookie & GetCookie(void) const
Get the Cookie member data.
TUse_history GetUse_history(void) const
Get the Use_history member data.
bool CanGetRequest(void) const
Check if it is safe to call GetRequest method.
bool CanGetUse_history(void) const
Check if it is safe to call GetUse_history method.
bool IsSetVersion(void) const
ASN1 spec version Check if a value has been assigned to Version data member.
TCookie & SetCookie(void)
Assign a value to Cookie data member.
void ResetRequest(void)
Reset Request data member.
CEntrez2_request_Base & operator=(const CEntrez2_request_Base &)
void SetDefaultUse_history(void)
Assign default value to Use_history data member.
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
const TTool & GetTool(void) const
Get the Tool member data.
bool IsSetTool(void) const
tool making request Check if a value has been assigned to Tool data member.
void ResetUse_history(void)
Reset Use_history data member.
const TRequest & GetRequest(void) const
Get the Request member data.
bool CanGetVersion(void) const
Check if it is safe to call GetVersion method.
void ResetVersion(void)
Reset Version data member.
CRef< TRequest > m_Request
bool IsSetUse_history(void) const
request should use history Check if a value has been assigned to Use_history data member.
TVersion GetVersion(void) const
Get the Version member data.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue Apr 23 07:40:38 2024 by modify_doxy.py rev. 669887