NCBI C++ ToolKit
ID2_Request_Get_Blob_Info_.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_Request_Get_Blob_Info_.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_REQUEST_GET_BLOB_INFO_BASE_HPP
42 #define OBJECTS_ID2_ID2_REQUEST_GET_BLOB_INFO_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
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 CID2_Blob_Id;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_ID2Access
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 /// Return some information related to the blob.
75 /// This request with be replied with one or more of:
76 /// ID2-Reply-Get-Blob-Seq-ids - if requested by get-seq-ids field
77 /// ID2-Reply-Get-Blob - if requested by get-data field
78 /// ID2S-Reply-Get-Split-Info
79 /// ID2S-Reply-Get-Chunk
80 /// Last two can be sent in addition to ID2-Reply-Get-Blob
81 /// if the blob is split on the server.
82 /// The replies are made separate to allow server to create replies easier
83 /// from precalculated data. Each of these replies have ID2-Reply-Data field.
84 ///
85 /// CID2_Request_Get_Blob_Info_Base --
86 ///
87 
89 {
91 public:
92  // constructor
94  // destructor
95  virtual ~CID2_Request_Get_Blob_Info_Base(void);
96 
97  // type info
99 
100  /////////////////////////////////////////////////////////////////////////////
101  /// id can be supplied by inner request
102  ///
103  /// C_Blob_id --
104  ///
105 
107  {
109  public:
110  // constructor
111  C_Blob_id(void);
112  // destructor
113  ~C_Blob_id(void);
114 
115  // type info
117 
118  /////////////////////////////////////////////////////////////////////////////
119  /// generate blob-ids from request
120  ///
121  /// C_Resolve --
122  ///
123 
125  {
127  public:
128  // constructor
129  C_Resolve(void);
130  // destructor
131  ~C_Resolve(void);
132 
133  // type info
135 
136  // types
138  typedef list< CRef< CID2_Blob_Id > > TExclude_blobs;
139 
140  // member index
141  enum class E_memberIndex {
142  e__allMandatory = 0,
143  e_request,
144  e_exclude_blobs
145  };
147 
148  // getters
149  // setters
150 
151  /// Check if a value has been assigned to Request data member.
152  ///
153  /// Data member Request is mandatory;
154  /// its type is defined as 'typedef CID2_Request_Get_Blob_Id TRequest'
155  /// @return
156  /// - true, if a value has been assigned.
157  /// - false, otherwise.
158  bool IsSetRequest(void) const;
159 
160  /// Check if it is safe to call GetRequest method.
161  ///
162  /// @return
163  /// - true, if the data member is getatable.
164  /// - false, otherwise.
165  bool CanGetRequest(void) const;
166 
167  /// Reset Request data member.
168  void ResetRequest(void);
169 
170  /// Get the Request member data.
171  ///
172  /// @return
173  /// Reference to the member data.
174  const TRequest& GetRequest(void) const;
175 
176  /// Assign a value to Request data member.
177  ///
178  /// @param value
179  /// Reference to value.
180  void SetRequest(TRequest& value);
181 
182  /// Assign a value to Request data member.
183  ///
184  /// @return
185  /// Reference to the data value.
186  TRequest& SetRequest(void);
187 
188  /// server will not send blobs listed here
189  /// Check if a value has been assigned to Exclude_blobs data member.
190  ///
191  /// Data member Exclude_blobs is optional;
192  /// its type is defined as 'typedef list< CRef< CID2_Blob_Id > > TExclude_blobs'
193  /// @return
194  /// - true, if a value has been assigned.
195  /// - false, otherwise.
196  bool IsSetExclude_blobs(void) const;
197 
198  /// Check if it is safe to call GetExclude_blobs method.
199  ///
200  /// @return
201  /// - true, if the data member is getatable.
202  /// - false, otherwise.
203  bool CanGetExclude_blobs(void) const;
204 
205  /// Reset Exclude_blobs data member.
206  void ResetExclude_blobs(void);
207 
208  /// Get the Exclude_blobs member data.
209  ///
210  /// @return
211  /// Reference to the member data.
212  const TExclude_blobs& GetExclude_blobs(void) const;
213 
214  /// Assign a value to Exclude_blobs data member.
215  ///
216  /// @return
217  /// Reference to the data value.
218  TExclude_blobs& SetExclude_blobs(void);
219 
220  /// Reset the whole object
221  void Reset(void);
222 
223 
224  private:
225  // Prohibit copy constructor and assignment operator
228 
229  // data
230  Uint4 m_set_State[1];
232  list< CRef< CID2_Blob_Id > > m_Exclude_blobs;
233  };
234 
235  /// Choice variants.
236  enum E_Choice {
237  e_not_set = 0, ///< No variant selected
238  e_Blob_id, ///< id can be supplied by inner request
239  e_Resolve
240  };
241  /// Maximum+1 value of the choice variant enumerator.
243  e_MaxChoice = 3 ///< == e_Resolve+1
244  };
245 
246  /// Reset the whole object
247  void Reset(void);
248 
249  /// Reset the selection (set it to e_not_set).
250  void ResetSelection(void);
251 
252  /// Which variant is currently selected.
253  ///
254  /// @return
255  /// Choice state enumerator.
256  E_Choice Which(void) const;
257 
258  /// Verify selection, throw exception if it differs from the expected.
259  ///
260  /// @param index
261  /// Expected selection.
262  void CheckSelected(E_Choice index) const;
263 
264  /// Throw 'InvalidSelection' exception.
265  ///
266  /// @param index
267  /// Expected selection.
268  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
269 
270  /// Retrieve selection name (for diagnostic purposes).
271  ///
272  /// @param index
273  /// One of possible selection states.
274  /// @return
275  /// Name string.
276  static string SelectionName(E_Choice index);
277 
278  /// Select the requested variant if needed.
279  ///
280  /// @param index
281  /// New selection state.
282  /// @param reset
283  /// Flag that defines the resetting of the variant data. The data will
284  /// be reset if either the current selection differs from the new one,
285  /// or the flag is set to eDoResetVariant.
287  /// Select the requested variant if needed,
288  /// allocating CObject variants from memory pool.
289  void Select(E_Choice index,
290  EResetVariant reset,
291  CObjectMemoryPool* pool);
292 
293  // types
296 
297  // getters
298  // setters
299 
300 
301  /// Check if variant Blob_id is selected.
302  ///
303  /// Blob_id type is defined as 'typedef CID2_Blob_Id TBlob_id'.
304  /// @return
305  /// - true, if the variant is selected.
306  /// - false, otherwise.
307  bool IsBlob_id(void) const;
308 
309  /// Get the variant data.
310  ///
311  /// @return
312  /// Reference to the data.
313  const TBlob_id& GetBlob_id(void) const;
314 
315  /// Select the variant.
316  ///
317  /// @return
318  /// Reference to the variant data.
319  TBlob_id& SetBlob_id(void);
320  /// Select the variant and set its data.
321  ///
322  /// @param value
323  /// Reference to the data.
324  void SetBlob_id(TBlob_id& value);
325 
326 
327  /// Check if variant Resolve is selected.
328  ///
329  /// Resolve type is defined as 'typedef C_Resolve TResolve'.
330  /// @return
331  /// - true, if the variant is selected.
332  /// - false, otherwise.
333  bool IsResolve(void) const;
334 
335  /// Get the variant data.
336  ///
337  /// @return
338  /// Reference to the data.
339  const TResolve& GetResolve(void) const;
340 
341  /// Select the variant.
342  ///
343  /// @return
344  /// Reference to the variant data.
345  TResolve& SetResolve(void);
346  /// Select the variant and set its data.
347  ///
348  /// @param value
349  /// Reference to the data.
350  void SetResolve(TResolve& value);
351 
352 
353  private:
354  // copy constructor and assignment operator
357  // choice state
359  // helper methods
360  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
361 
362  static const char* const sm_SelectionNames[];
363  // data
364  NCBI_NS_NCBI::CSerialObject *m_object;
365  };
366  // types
369 
370  // member index
371  enum class E_memberIndex {
372  e__allMandatory = 0,
373  e_blob_id,
374  e_get_seq_ids,
375  e_get_data
376  };
378 
379  // getters
380  // setters
381 
382  /// Check if a value has been assigned to Blob_id data member.
383  ///
384  /// Data member Blob_id is mandatory;
385  /// its type is defined as 'typedef C_Blob_id TBlob_id'
386  /// @return
387  /// - true, if a value has been assigned.
388  /// - false, otherwise.
389  bool IsSetBlob_id(void) const;
390 
391  /// Check if it is safe to call GetBlob_id method.
392  ///
393  /// @return
394  /// - true, if the data member is getatable.
395  /// - false, otherwise.
396  bool CanGetBlob_id(void) const;
397 
398  /// Reset Blob_id data member.
399  void ResetBlob_id(void);
400 
401  /// Get the Blob_id member data.
402  ///
403  /// @return
404  /// Reference to the member data.
405  const TBlob_id& GetBlob_id(void) const;
406 
407  /// Assign a value to Blob_id data member.
408  ///
409  /// @param value
410  /// Reference to value.
411  void SetBlob_id(TBlob_id& value);
412 
413  /// Assign a value to Blob_id data member.
414  ///
415  /// @return
416  /// Reference to the data value.
417  TBlob_id& SetBlob_id(void);
418 
419  /// return in addition list of Seq-ids also resolving to this blob
420  /// Check if a value has been assigned to Get_seq_ids data member.
421  ///
422  /// Data member Get_seq_ids is optional
423  /// @return
424  /// - true, if a value has been assigned.
425  /// - false, otherwise.
426  bool IsSetGet_seq_ids(void) const;
427 
428  /// Check if value of Get_seq_ids member is getatable.
429  ///
430  /// @return
431  /// - false; the data member of type 'NULL' has no value.
432  bool CanGetGet_seq_ids(void) const;
433 
434  /// Reset Get_seq_ids data member.
435  void ResetGet_seq_ids(void);
436 
437  /// Set NULL data member (assign 'NULL' value to Get_seq_ids data member).
438  void SetGet_seq_ids(void);
439 
440  /// level of details requested immediately
441  /// server will send relevant chunks if blob is splitted
442  /// Check if a value has been assigned to Get_data data member.
443  ///
444  /// Data member Get_data is optional;
445  /// its type is defined as 'typedef CID2_Get_Blob_Details TGet_data'
446  /// @return
447  /// - true, if a value has been assigned.
448  /// - false, otherwise.
449  bool IsSetGet_data(void) const;
450 
451  /// Check if it is safe to call GetGet_data method.
452  ///
453  /// @return
454  /// - true, if the data member is getatable.
455  /// - false, otherwise.
456  bool CanGetGet_data(void) const;
457 
458  /// Reset Get_data data member.
459  void ResetGet_data(void);
460 
461  /// Get the Get_data member data.
462  ///
463  /// @return
464  /// Reference to the member data.
465  const TGet_data& GetGet_data(void) const;
466 
467  /// Assign a value to Get_data data member.
468  ///
469  /// @param value
470  /// Reference to value.
471  void SetGet_data(TGet_data& value);
472 
473  /// Assign a value to Get_data data member.
474  ///
475  /// @return
476  /// Reference to the data value.
477  TGet_data& SetGet_data(void);
478 
479  /// Reset the whole object
480  virtual void Reset(void);
481 
482 
483 private:
484  // Prohibit copy constructor and assignment operator
487 
488  // data
489  Uint4 m_set_State[1];
492 };
493 
494 /* @} */
495 
496 
497 
498 
499 
500 ///////////////////////////////////////////////////////////
501 ///////////////////// inline methods //////////////////////
502 ///////////////////////////////////////////////////////////
503 inline
505 {
506  return m_Request.NotEmpty();
507 }
508 
509 inline
511 {
512  return true;
513 }
514 
515 inline
517 {
518  if ( !m_Request ) {
519  const_cast<C_Resolve*>(this)->ResetRequest();
520  }
521  return (*m_Request);
522 }
523 
524 inline
526 {
527  if ( !m_Request ) {
528  ResetRequest();
529  }
530  return (*m_Request);
531 }
532 
533 inline
535 {
536  return ((m_set_State[0] & 0xc) != 0);
537 }
538 
539 inline
541 {
542  return true;
543 }
544 
545 inline
547 {
548  return m_Exclude_blobs;
549 }
550 
551 inline
553 {
554  m_set_State[0] |= 0x4;
555  return m_Exclude_blobs;
556 }
557 
558 inline
560 {
561  return m_choice;
562 }
563 
564 inline
566 {
567  if ( m_choice != index )
568  ThrowInvalidSelection(index);
569 }
570 
571 inline
572 void CID2_Request_Get_Blob_Info_Base::C_Blob_id::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
573 {
574  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
575  if ( m_choice != e_not_set )
576  ResetSelection();
577  DoSelect(index, pool);
578  }
579 }
580 
581 inline
583 {
584  Select(index, reset, 0);
585 }
586 
587 inline
589 {
590  return m_choice == e_Blob_id;
591 }
592 
593 inline
595 {
596  return m_choice == e_Resolve;
597 }
598 
599 inline
601 {
602  return m_Blob_id.NotEmpty();
603 }
604 
605 inline
607 {
608  return true;
609 }
610 
611 inline
613 {
614  if ( !m_Blob_id ) {
615  const_cast<CID2_Request_Get_Blob_Info_Base*>(this)->ResetBlob_id();
616  }
617  return (*m_Blob_id);
618 }
619 
620 inline
622 {
623  if ( !m_Blob_id ) {
624  ResetBlob_id();
625  }
626  return (*m_Blob_id);
627 }
628 
629 inline
631 {
632  return ((m_set_State[0] & 0xc) != 0);
633 }
634 
635 inline
637 {
638  return false;
639 }
640 
641 inline
643 {
644  m_set_State[0] &= ~0xc;
645 }
646 
647 inline
649 {
650  m_set_State[0] |= 0xc;
651 }
652 
653 inline
655 {
656  return m_Get_data.NotEmpty();
657 }
658 
659 inline
661 {
662  return IsSetGet_data();
663 }
664 
665 inline
667 {
668  if (!CanGetGet_data()) {
669  ThrowUnassigned(2);
670  }
671  return (*m_Get_data);
672 }
673 
674 ///////////////////////////////////////////////////////////
675 ////////////////// end of inline methods //////////////////
676 ///////////////////////////////////////////////////////////
677 
678 
679 
680 
681 
682 END_objects_SCOPE // namespace ncbi::objects::
683 
685 
686 
687 #endif // OBJECTS_ID2_ID2_REQUEST_GET_BLOB_INFO_BASE_HPP
CID2_Blob_Id –.
Definition: ID2_Blob_Id.hpp:66
CID2_Get_Blob_Details –.
CID2_Request_Get_Blob_Id –.
Return some information related to the blob.
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
void ThrowUnassigned(TMemberIndex index) const
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
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 CanGetExclude_blobs(void) const
Check if it is safe to call GetExclude_blobs method.
bool CanGetBlob_id(void) const
Check if it is safe to call GetBlob_id method.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
TRequest & SetRequest(void)
Assign a value to Request data member.
CID2_Request_Get_Blob_Info_Base & operator=(const CID2_Request_Get_Blob_Info_Base &)
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
void ResetGet_seq_ids(void)
Reset Get_seq_ids data member.
bool IsResolve(void) const
Check if variant Resolve is selected.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
CID2_Request_Get_Blob_Info_Base(const CID2_Request_Get_Blob_Info_Base &)
TBlob_id & SetBlob_id(void)
Assign a value to Blob_id data member.
bool IsSetGet_seq_ids(void) const
return in addition list of Seq-ids also resolving to this blob Check if a value has been assigned to ...
bool IsSetExclude_blobs(void) const
server will not send blobs listed here Check if a value has been assigned to Exclude_blobs data membe...
bool IsSetRequest(void) const
Check if a value has been assigned to Request data member.
void SetGet_seq_ids(void)
Set NULL data member (assign 'NULL' value to Get_seq_ids data member).
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
const TRequest & GetRequest(void) const
Get the Request member data.
const TExclude_blobs & GetExclude_blobs(void) const
Get the Exclude_blobs member data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
C_Blob_id & operator=(const C_Blob_id &)
bool CanGetGet_data(void) const
Check if it is safe to call GetGet_data method.
bool IsSetGet_data(void) const
level of details requested immediately server will send relevant chunks if blob is splitted Check if ...
void ResetBlob_id(void)
Reset Blob_id data member.
const TGet_data & GetGet_data(void) const
Get the Get_data member data.
bool CanGetGet_seq_ids(void) const
Check if value of Get_seq_ids member is getatable.
E_Choice Which(void) const
Which variant is currently selected.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsBlob_id(void) const
Check if variant Blob_id is selected.
const TBlob_id & GetBlob_id(void) const
Get the Blob_id member data.
bool CanGetRequest(void) const
Check if it is safe to call GetRequest method.
bool IsSetBlob_id(void) const
Check if a value has been assigned to Blob_id data member.
TExclude_blobs & SetExclude_blobs(void)
Assign a value to Exclude_blobs data member.
@ e_Blob_id
id can be supplied by inner request
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Thu Jun 13 17:31:58 2024 by modify_doxy.py rev. 669887