NCBI C++ ToolKit
ID1server_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 ID1server_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/id1/id1.asn">id1.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/id1/id1.def">id1.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_ID1_ID1SERVER_REQUEST_BASE_HPP
42 #define OBJECTS_ID1_ID1SERVER_REQUEST_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
47 
48 #ifndef BEGIN_objects_SCOPE
49 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
50 # define END_objects_SCOPE END_SCOPE(objects)
51 #endif
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 
55 // forward declarations
57 class CSeq_id;
58 
59 
60 // generated classes
61 
62 
63 /** @addtogroup dataspec_NCBI_ID1Access
64  *
65  * @{
66  */
67 
68 /////////////////////////////////////////////////////////////////////////////
69 ///**********************************
70 /// requests
71 ///
72 ///
73 /// CID1server_request_Base --
74 ///
75 
77 {
79 public:
80  // constructor
82  // destructor
83  virtual ~CID1server_request_Base(void);
84 
85  // type info
87 
88 
89  /// Choice variants.
90  enum E_Choice {
91  e_not_set = 0, ///< No variant selected
92  e_Init, ///< DlInit
93  e_Getgi, ///< get a gi given a Seq-id
94  e_Getsefromgi, ///< given a gi, get the Seq-entry
95  e_Fini, ///< DlFini
96  e_Getseqidsfromgi, ///<get all Seq-ids of given gi
97  e_Getgihist, ///<get an historical list of gis
98  e_Getgirev, ///<get a revision history of gi
99  e_Getgistate, ///<get a state of gi
101  e_Getblobinfo
102  };
103  /// Maximum+1 value of the choice variant enumerator.
105  e_MaxChoice = 11 ///< == e_Getblobinfo+1
106  };
107 
108  /// Reset the whole object
109  virtual void Reset(void);
110 
111  /// Reset the selection (set it to e_not_set).
112  virtual void ResetSelection(void);
113 
114  /// Which variant is currently selected.
115  ///
116  /// @return
117  /// Choice state enumerator.
118  E_Choice Which(void) const;
119 
120  /// Verify selection, throw exception if it differs from the expected.
121  ///
122  /// @param index
123  /// Expected selection.
124  void CheckSelected(E_Choice index) const;
125 
126  /// Throw 'InvalidSelection' exception.
127  ///
128  /// @param index
129  /// Expected selection.
130  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
131 
132  /// Retrieve selection name (for diagnostic purposes).
133  ///
134  /// @param index
135  /// One of possible selection states.
136  /// @return
137  /// Name string.
138  static string SelectionName(E_Choice index);
139 
140  /// Select the requested variant if needed.
141  ///
142  /// @param index
143  /// New selection state.
144  /// @param reset
145  /// Flag that defines the resetting of the variant data. The data will
146  /// be reset if either the current selection differs from the new one,
147  /// or the flag is set to eDoResetVariant.
149  /// Select the requested variant if needed,
150  /// allocating CObject variants from memory pool.
151  void Select(E_Choice index,
152  EResetVariant reset,
153  CObjectMemoryPool* pool);
154 
155  // types
156  typedef CSeq_id TGetgi;
164 
165  // getters
166  // setters
167 
168 
169  /// Check if variant Init is selected.
170  ///
171  /// @return
172  /// - true, if the variant is selected.
173  /// - false, otherwise.
174  bool IsInit(void) const;
175 
176  /// Select the variant.
177  void SetInit(void);
178 
179 
180  /// Check if variant Getgi is selected.
181  ///
182  /// Getgi type is defined as 'typedef CSeq_id TGetgi'.
183  /// @return
184  /// - true, if the variant is selected.
185  /// - false, otherwise.
186  bool IsGetgi(void) const;
187 
188  /// Get the variant data.
189  ///
190  /// @return
191  /// Reference to the data.
192  const TGetgi& GetGetgi(void) const;
193 
194  /// Select the variant.
195  ///
196  /// @return
197  /// Reference to the variant data.
198  TGetgi& SetGetgi(void);
199  /// Select the variant and set its data.
200  ///
201  /// @param value
202  /// Reference to the data.
203  void SetGetgi(TGetgi& value);
204 
205 
206  /// Check if variant Getsefromgi is selected.
207  ///
208  /// Getsefromgi type is defined as 'typedef CID1server_maxcomplex TGetsefromgi'.
209  /// @return
210  /// - true, if the variant is selected.
211  /// - false, otherwise.
212  bool IsGetsefromgi(void) const;
213 
214  /// Get the variant data.
215  ///
216  /// @return
217  /// Reference to the data.
218  const TGetsefromgi& GetGetsefromgi(void) const;
219 
220  /// Select the variant.
221  ///
222  /// @return
223  /// Reference to the variant data.
224  TGetsefromgi& SetGetsefromgi(void);
225  /// Select the variant and set its data.
226  ///
227  /// @param value
228  /// Reference to the data.
229  void SetGetsefromgi(TGetsefromgi& value);
230 
231 
232  /// Check if variant Fini is selected.
233  ///
234  /// @return
235  /// - true, if the variant is selected.
236  /// - false, otherwise.
237  bool IsFini(void) const;
238 
239  /// Select the variant.
240  void SetFini(void);
241 
242 
243  /// Check if variant Getseqidsfromgi is selected.
244  ///
245  /// Getseqidsfromgi type is defined as 'typedef NCBI_NS_NCBI::TGi TGetseqidsfromgi'.
246  /// @return
247  /// - true, if the variant is selected.
248  /// - false, otherwise.
249  bool IsGetseqidsfromgi(void) const;
250 
251  /// Get the variant data.
252  ///
253  /// @return
254  /// Copy of the variant data.
255  TGetseqidsfromgi GetGetseqidsfromgi(void) const;
256 
257  /// Select the variant.
258  ///
259  /// @return
260  /// Reference to the variant data.
261  TGetseqidsfromgi& SetGetseqidsfromgi(void);
262 
263  /// Select the variant and set its data.
264  ///
265  /// @param value
266  /// Variant data.
267  void SetGetseqidsfromgi(TGetseqidsfromgi value);
268 
269 
270  /// Check if variant Getgihist is selected.
271  ///
272  /// Getgihist type is defined as 'typedef NCBI_NS_NCBI::TGi TGetgihist'.
273  /// @return
274  /// - true, if the variant is selected.
275  /// - false, otherwise.
276  bool IsGetgihist(void) const;
277 
278  /// Get the variant data.
279  ///
280  /// @return
281  /// Copy of the variant data.
282  TGetgihist GetGetgihist(void) const;
283 
284  /// Select the variant.
285  ///
286  /// @return
287  /// Reference to the variant data.
288  TGetgihist& SetGetgihist(void);
289 
290  /// Select the variant and set its data.
291  ///
292  /// @param value
293  /// Variant data.
294  void SetGetgihist(TGetgihist value);
295 
296 
297  /// Check if variant Getgirev is selected.
298  ///
299  /// Getgirev type is defined as 'typedef NCBI_NS_NCBI::TGi TGetgirev'.
300  /// @return
301  /// - true, if the variant is selected.
302  /// - false, otherwise.
303  bool IsGetgirev(void) const;
304 
305  /// Get the variant data.
306  ///
307  /// @return
308  /// Copy of the variant data.
309  TGetgirev GetGetgirev(void) const;
310 
311  /// Select the variant.
312  ///
313  /// @return
314  /// Reference to the variant data.
315  TGetgirev& SetGetgirev(void);
316 
317  /// Select the variant and set its data.
318  ///
319  /// @param value
320  /// Variant data.
321  void SetGetgirev(TGetgirev value);
322 
323 
324  /// Check if variant Getgistate is selected.
325  ///
326  /// Getgistate type is defined as 'typedef NCBI_NS_NCBI::TGi TGetgistate'.
327  /// @return
328  /// - true, if the variant is selected.
329  /// - false, otherwise.
330  bool IsGetgistate(void) const;
331 
332  /// Get the variant data.
333  ///
334  /// @return
335  /// Copy of the variant data.
336  TGetgistate GetGetgistate(void) const;
337 
338  /// Select the variant.
339  ///
340  /// @return
341  /// Reference to the variant data.
342  TGetgistate& SetGetgistate(void);
343 
344  /// Select the variant and set its data.
345  ///
346  /// @param value
347  /// Variant data.
348  void SetGetgistate(TGetgistate value);
349 
350 
351  /// Check if variant Getsewithinfo is selected.
352  ///
353  /// Getsewithinfo type is defined as 'typedef CID1server_maxcomplex TGetsewithinfo'.
354  /// @return
355  /// - true, if the variant is selected.
356  /// - false, otherwise.
357  bool IsGetsewithinfo(void) const;
358 
359  /// Get the variant data.
360  ///
361  /// @return
362  /// Reference to the data.
363  const TGetsewithinfo& GetGetsewithinfo(void) const;
364 
365  /// Select the variant.
366  ///
367  /// @return
368  /// Reference to the variant data.
369  TGetsewithinfo& SetGetsewithinfo(void);
370  /// Select the variant and set its data.
371  ///
372  /// @param value
373  /// Reference to the data.
374  void SetGetsewithinfo(TGetsewithinfo& value);
375 
376 
377  /// Check if variant Getblobinfo is selected.
378  ///
379  /// Getblobinfo type is defined as 'typedef CID1server_maxcomplex TGetblobinfo'.
380  /// @return
381  /// - true, if the variant is selected.
382  /// - false, otherwise.
383  bool IsGetblobinfo(void) const;
384 
385  /// Get the variant data.
386  ///
387  /// @return
388  /// Reference to the data.
389  const TGetblobinfo& GetGetblobinfo(void) const;
390 
391  /// Select the variant.
392  ///
393  /// @return
394  /// Reference to the variant data.
395  TGetblobinfo& SetGetblobinfo(void);
396  /// Select the variant and set its data.
397  ///
398  /// @param value
399  /// Reference to the data.
400  void SetGetblobinfo(TGetblobinfo& value);
401 
402 
403 private:
404  // copy constructor and assignment operator
407  // choice state
409  // helper methods
410  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
411 
412  static const char* const sm_SelectionNames[];
413  // data
414  union {
419  NCBI_NS_NCBI::CSerialObject *m_object;
420  };
421 };
422 
423 /* @} */
424 
425 
426 
427 
428 
429 ///////////////////////////////////////////////////////////
430 ///////////////////// inline methods //////////////////////
431 ///////////////////////////////////////////////////////////
432 inline
434 {
435  return m_choice;
436 }
437 
438 inline
440 {
441  if ( m_choice != index )
442  ThrowInvalidSelection(index);
443 }
444 
445 inline
446 void CID1server_request_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
447 {
448  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
449  if ( m_choice != e_not_set )
450  ResetSelection();
451  DoSelect(index, pool);
452  }
453 }
454 
455 inline
457 {
458  Select(index, reset, 0);
459 }
460 
461 inline
463 {
464  return m_choice == e_Init;
465 }
466 
467 inline
469 {
471 }
472 
473 inline
475 {
476  return m_choice == e_Getgi;
477 }
478 
479 inline
481 {
482  return m_choice == e_Getsefromgi;
483 }
484 
485 inline
487 {
488  return m_choice == e_Fini;
489 }
490 
491 inline
493 {
495 }
496 
497 inline
499 {
500  return m_choice == e_Getseqidsfromgi;
501 }
502 
503 inline
505 {
507  return reinterpret_cast<const TGetseqidsfromgi&>(m_Getseqidsfromgi);
508 }
509 
510 inline
512 {
514  return reinterpret_cast<TGetseqidsfromgi&>(m_Getseqidsfromgi);
515 }
516 
517 inline
519 {
521  reinterpret_cast<TGetseqidsfromgi&>(m_Getseqidsfromgi) = value;
522 }
523 
524 inline
526 {
527  return m_choice == e_Getgihist;
528 }
529 
530 inline
532 {
534  return reinterpret_cast<const TGetgihist&>(m_Getgihist);
535 }
536 
537 inline
539 {
541  return reinterpret_cast<TGetgihist&>(m_Getgihist);
542 }
543 
544 inline
546 {
548  reinterpret_cast<TGetgihist&>(m_Getgihist) = value;
549 }
550 
551 inline
553 {
554  return m_choice == e_Getgirev;
555 }
556 
557 inline
559 {
561  return reinterpret_cast<const TGetgirev&>(m_Getgirev);
562 }
563 
564 inline
566 {
568  return reinterpret_cast<TGetgirev&>(m_Getgirev);
569 }
570 
571 inline
573 {
575  reinterpret_cast<TGetgirev&>(m_Getgirev) = value;
576 }
577 
578 inline
580 {
581  return m_choice == e_Getgistate;
582 }
583 
584 inline
586 {
588  return reinterpret_cast<const TGetgistate&>(m_Getgistate);
589 }
590 
591 inline
593 {
595  return reinterpret_cast<TGetgistate&>(m_Getgistate);
596 }
597 
598 inline
600 {
602  reinterpret_cast<TGetgistate&>(m_Getgistate) = value;
603 }
604 
605 inline
607 {
608  return m_choice == e_Getsewithinfo;
609 }
610 
611 inline
613 {
614  return m_choice == e_Getblobinfo;
615 }
616 
617 ///////////////////////////////////////////////////////////
618 ////////////////// end of inline methods //////////////////
619 ///////////////////////////////////////////////////////////
620 
621 
622 
623 
624 
625 END_objects_SCOPE // namespace ncbi::objects::
626 
628 
629 
630 #endif // OBJECTS_ID1_ID1SERVER_REQUEST_BASE_HPP
CID1server_maxcomplex –.
********************************** requests
Base class for all serializable objects.
Definition: serialbase.hpp:150
Int8 TIntId
Definition: ncbimisc.hpp:999
CStrictId< SStrictId_Gi, SStrictId_Gi::TId > TGi
Definition: ncbimisc.hpp:1025
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_ID1_EXPORT
Definition: ncbi_export.h:544
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
TGetgirev GetGetgirev(void) const
Get the variant data.
CID1server_request_Base(const CID1server_request_Base &)
CID1server_maxcomplex TGetblobinfo
CID1server_maxcomplex TGetsefromgi
TGetgihist & SetGetgihist(void)
Select the variant.
bool IsGetblobinfo(void) const
Check if variant Getblobinfo is selected.
TGetgirev & SetGetgirev(void)
Select the variant.
TGetseqidsfromgi GetGetseqidsfromgi(void) const
Get the variant data.
void SetFini(void)
Select the variant.
TGetgihist GetGetgihist(void) const
Get the variant data.
void SetInit(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
TGetgistate & SetGetgistate(void)
Select the variant.
bool IsGetgirev(void) const
Check if variant Getgirev is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
bool IsFini(void) const
Check if variant Fini is selected.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsGetgistate(void) const
Check if variant Getgistate is selected.
E_Choice Which(void) const
Which variant is currently selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool IsGetgihist(void) const
Check if variant Getgihist is selected.
CID1server_request_Base & operator=(const CID1server_request_Base &)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsGetgi(void) const
Check if variant Getgi is selected.
NCBI_NS_NCBI::TGi TGetseqidsfromgi
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsGetsewithinfo(void) const
Check if variant Getsewithinfo is selected.
TGetgistate GetGetgistate(void) const
Get the variant data.
TGetseqidsfromgi & SetGetseqidsfromgi(void)
Select the variant.
bool IsGetsefromgi(void) const
Check if variant Getsefromgi is selected.
bool IsGetseqidsfromgi(void) const
Check if variant Getseqidsfromgi is selected.
bool IsInit(void) const
Check if variant Init is selected.
CID1server_maxcomplex TGetsewithinfo
@ e_Getgihist
get an historical list of gis
@ e_Getgi
get a gi given a Seq-id
@ e_Getgirev
get a revision history of gi
@ e_Getseqidsfromgi
get all Seq-ids of given gi
@ e_not_set
No variant selected.
@ e_Getsefromgi
given a gi, get the Seq-entry
@ e_Getgistate
get a state of gi
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue Jul 23 17:45:52 2024 by modify_doxy.py rev. 669887