NCBI C++ ToolKit
ID1server_back_.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_back_.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_BACK_BASE_HPP
42 #define OBJECTS_ID1_ID1SERVER_BACK_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 CID1SeqEntry_info;
61 class CID1Seq_hist;
62 class CID1blob_info;
63 class CSeq_entry;
64 class CSeq_id;
65 
66 
67 // generated classes
68 
69 
70 /** @addtogroup dataspec_NCBI_ID1Access
71  *
72  * @{
73  */
74 
75 /////////////////////////////////////////////////////////////////////////////
76 ///
77 /// CID1server_back_Base --
78 ///
79 
81 {
83 public:
84  // constructor
86  // destructor
87  virtual ~CID1server_back_Base(void);
88 
89  // type info
91 
92 
93  /// Choice variants.
94  enum E_Choice {
95  e_not_set = 0, ///< No variant selected
96  e_Init, ///< DlInit
99  e_Gotseqentry, ///< live
100  e_Gotdeadseqentry, ///< dead
101  e_Fini, ///< DlFini
104  e_Gihist, ///< because hand crafted Seq-hist does not follow same conventions
107  e_Gotblobinfo
108  };
109  /// Maximum+1 value of the choice variant enumerator.
111  e_MaxChoice = 13 ///< == e_Gotblobinfo+1
112  };
113 
114  /// Reset the whole object
115  virtual void Reset(void);
116 
117  /// Reset the selection (set it to e_not_set).
118  virtual void ResetSelection(void);
119 
120  /// Which variant is currently selected.
121  ///
122  /// @return
123  /// Choice state enumerator.
124  E_Choice Which(void) const;
125 
126  /// Verify selection, throw exception if it differs from the expected.
127  ///
128  /// @param index
129  /// Expected selection.
130  void CheckSelected(E_Choice index) const;
131 
132  /// Throw 'InvalidSelection' exception.
133  ///
134  /// @param index
135  /// Expected selection.
136  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
137 
138  /// Retrieve selection name (for diagnostic purposes).
139  ///
140  /// @param index
141  /// One of possible selection states.
142  /// @return
143  /// Name string.
144  static string SelectionName(E_Choice index);
145 
146  /// Select the requested variant if needed.
147  ///
148  /// @param index
149  /// New selection state.
150  /// @param reset
151  /// Flag that defines the resetting of the variant data. The data will
152  /// be reset if either the current selection differs from the new one,
153  /// or the flag is set to eDoResetVariant.
155  /// Select the requested variant if needed,
156  /// allocating CObject variants from memory pool.
157  void Select(E_Choice index,
158  EResetVariant reset,
159  CObjectMemoryPool* pool);
160 
161  // types
162  typedef int TError;
166  typedef int TGistate;
167  typedef list< CRef< CSeq_id > > TIds;
168  typedef list< CRef< CID1Seq_hist > > TGihist;
169  typedef list< CRef< CID1Seq_hist > > TGirevhist;
172 
173  // getters
174  // setters
175 
176 
177  /// Check if variant Init is selected.
178  ///
179  /// @return
180  /// - true, if the variant is selected.
181  /// - false, otherwise.
182  bool IsInit(void) const;
183 
184  /// Select the variant.
185  void SetInit(void);
186 
187 
188  /// Check if variant Error is selected.
189  ///
190  /// Error type is defined as 'typedef int TError'.
191  /// @return
192  /// - true, if the variant is selected.
193  /// - false, otherwise.
194  bool IsError(void) const;
195 
196  /// Get the variant data.
197  ///
198  /// @return
199  /// Copy of the variant data.
200  TError GetError(void) const;
201 
202  /// Select the variant.
203  ///
204  /// @return
205  /// Reference to the variant data.
206  TError& SetError(void);
207 
208  /// Select the variant and set its data.
209  ///
210  /// @param value
211  /// Variant data.
212  void SetError(TError value);
213 
214 
215  /// Check if variant Gotgi is selected.
216  ///
217  /// Gotgi type is defined as 'typedef NCBI_NS_NCBI::TGi TGotgi'.
218  /// @return
219  /// - true, if the variant is selected.
220  /// - false, otherwise.
221  bool IsGotgi(void) const;
222 
223  /// Get the variant data.
224  ///
225  /// @return
226  /// Copy of the variant data.
227  TGotgi GetGotgi(void) const;
228 
229  /// Select the variant.
230  ///
231  /// @return
232  /// Reference to the variant data.
233  TGotgi& SetGotgi(void);
234 
235  /// Select the variant and set its data.
236  ///
237  /// @param value
238  /// Variant data.
239  void SetGotgi(TGotgi value);
240 
241 
242  /// Check if variant Gotseqentry is selected.
243  ///
244  /// Gotseqentry type is defined as 'typedef CSeq_entry TGotseqentry'.
245  /// @return
246  /// - true, if the variant is selected.
247  /// - false, otherwise.
248  bool IsGotseqentry(void) const;
249 
250  /// Get the variant data.
251  ///
252  /// @return
253  /// Reference to the data.
254  const TGotseqentry& GetGotseqentry(void) const;
255 
256  /// Select the variant.
257  ///
258  /// @return
259  /// Reference to the variant data.
260  TGotseqentry& SetGotseqentry(void);
261  /// Select the variant and set its data.
262  ///
263  /// @param value
264  /// Reference to the data.
265  void SetGotseqentry(TGotseqentry& value);
266 
267 
268  /// Check if variant Gotdeadseqentry is selected.
269  ///
270  /// Gotdeadseqentry type is defined as 'typedef CSeq_entry TGotdeadseqentry'.
271  /// @return
272  /// - true, if the variant is selected.
273  /// - false, otherwise.
274  bool IsGotdeadseqentry(void) const;
275 
276  /// Get the variant data.
277  ///
278  /// @return
279  /// Reference to the data.
280  const TGotdeadseqentry& GetGotdeadseqentry(void) const;
281 
282  /// Select the variant.
283  ///
284  /// @return
285  /// Reference to the variant data.
286  TGotdeadseqentry& SetGotdeadseqentry(void);
287  /// Select the variant and set its data.
288  ///
289  /// @param value
290  /// Reference to the data.
291  void SetGotdeadseqentry(TGotdeadseqentry& value);
292 
293 
294  /// Check if variant Fini is selected.
295  ///
296  /// @return
297  /// - true, if the variant is selected.
298  /// - false, otherwise.
299  bool IsFini(void) const;
300 
301  /// Select the variant.
302  void SetFini(void);
303 
304 
305  /// Check if variant Gistate is selected.
306  ///
307  /// Gistate type is defined as 'typedef int TGistate'.
308  /// @return
309  /// - true, if the variant is selected.
310  /// - false, otherwise.
311  bool IsGistate(void) const;
312 
313  /// Get the variant data.
314  ///
315  /// @return
316  /// Copy of the variant data.
317  TGistate GetGistate(void) const;
318 
319  /// Select the variant.
320  ///
321  /// @return
322  /// Reference to the variant data.
323  TGistate& SetGistate(void);
324 
325  /// Select the variant and set its data.
326  ///
327  /// @param value
328  /// Variant data.
329  void SetGistate(TGistate value);
330 
331 
332  /// Check if variant Ids is selected.
333  ///
334  /// Ids type is defined as 'typedef list< CRef< CSeq_id > > TIds'.
335  /// @return
336  /// - true, if the variant is selected.
337  /// - false, otherwise.
338  bool IsIds(void) const;
339 
340  /// Get the variant data.
341  ///
342  /// @return
343  /// Reference to the data.
344  const TIds& GetIds(void) const;
345 
346  /// Select the variant.
347  ///
348  /// @return
349  /// Reference to the variant data.
350  TIds& SetIds(void);
351 
352 
353  /// Check if variant Gihist is selected.
354  ///
355  /// Gihist type is defined as 'typedef list< CRef< CID1Seq_hist > > TGihist'.
356  /// @return
357  /// - true, if the variant is selected.
358  /// - false, otherwise.
359  bool IsGihist(void) const;
360 
361  /// Get the variant data.
362  ///
363  /// @return
364  /// Reference to the data.
365  const TGihist& GetGihist(void) const;
366 
367  /// Select the variant.
368  ///
369  /// @return
370  /// Reference to the variant data.
371  TGihist& SetGihist(void);
372 
373 
374  /// Check if variant Girevhist is selected.
375  ///
376  /// Girevhist type is defined as 'typedef list< CRef< CID1Seq_hist > > TGirevhist'.
377  /// @return
378  /// - true, if the variant is selected.
379  /// - false, otherwise.
380  bool IsGirevhist(void) const;
381 
382  /// Get the variant data.
383  ///
384  /// @return
385  /// Reference to the data.
386  const TGirevhist& GetGirevhist(void) const;
387 
388  /// Select the variant.
389  ///
390  /// @return
391  /// Reference to the variant data.
392  TGirevhist& SetGirevhist(void);
393 
394 
395  /// Check if variant Gotsewithinfo is selected.
396  ///
397  /// Gotsewithinfo type is defined as 'typedef CID1SeqEntry_info TGotsewithinfo'.
398  /// @return
399  /// - true, if the variant is selected.
400  /// - false, otherwise.
401  bool IsGotsewithinfo(void) const;
402 
403  /// Get the variant data.
404  ///
405  /// @return
406  /// Reference to the data.
407  const TGotsewithinfo& GetGotsewithinfo(void) const;
408 
409  /// Select the variant.
410  ///
411  /// @return
412  /// Reference to the variant data.
413  TGotsewithinfo& SetGotsewithinfo(void);
414  /// Select the variant and set its data.
415  ///
416  /// @param value
417  /// Reference to the data.
418  void SetGotsewithinfo(TGotsewithinfo& value);
419 
420 
421  /// Check if variant Gotblobinfo is selected.
422  ///
423  /// Gotblobinfo type is defined as 'typedef CID1blob_info TGotblobinfo'.
424  /// @return
425  /// - true, if the variant is selected.
426  /// - false, otherwise.
427  bool IsGotblobinfo(void) const;
428 
429  /// Get the variant data.
430  ///
431  /// @return
432  /// Reference to the data.
433  const TGotblobinfo& GetGotblobinfo(void) const;
434 
435  /// Select the variant.
436  ///
437  /// @return
438  /// Reference to the variant data.
439  TGotblobinfo& SetGotblobinfo(void);
440  /// Select the variant and set its data.
441  ///
442  /// @param value
443  /// Reference to the data.
444  void SetGotblobinfo(TGotblobinfo& value);
445 
446 
447 private:
448  // copy constructor and assignment operator
451  // choice state
453  // helper methods
454  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
455 
456  static const char* const sm_SelectionNames[];
457  // data
458  union {
462  NCBI_NS_NCBI::CUnionBuffer<TIds> m_Ids;
463  NCBI_NS_NCBI::CUnionBuffer<TGihist> m_Gihist;
464  NCBI_NS_NCBI::CUnionBuffer<TGirevhist> m_Girevhist;
465  NCBI_NS_NCBI::CSerialObject *m_object;
466  };
467 };
468 
469 /* @} */
470 
471 
472 
473 
474 
475 ///////////////////////////////////////////////////////////
476 ///////////////////// inline methods //////////////////////
477 ///////////////////////////////////////////////////////////
478 inline
480 {
481  return m_choice;
482 }
483 
484 inline
486 {
487  if ( m_choice != index )
488  ThrowInvalidSelection(index);
489 }
490 
491 inline
492 void CID1server_back_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
493 {
494  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
495  if ( m_choice != e_not_set )
496  ResetSelection();
497  DoSelect(index, pool);
498  }
499 }
500 
501 inline
503 {
504  Select(index, reset, 0);
505 }
506 
507 inline
509 {
510  return m_choice == e_Init;
511 }
512 
513 inline
515 {
517 }
518 
519 inline
521 {
522  return m_choice == e_Error;
523 }
524 
525 inline
527 {
529  return m_Error;
530 }
531 
532 inline
534 {
536  return m_Error;
537 }
538 
539 inline
541 {
543  m_Error = value;
544 }
545 
546 inline
548 {
549  return m_choice == e_Gotgi;
550 }
551 
552 inline
554 {
556  return reinterpret_cast<const TGotgi&>(m_Gotgi);
557 }
558 
559 inline
561 {
563  return reinterpret_cast<TGotgi&>(m_Gotgi);
564 }
565 
566 inline
568 {
570  reinterpret_cast<TGotgi&>(m_Gotgi) = value;
571 }
572 
573 inline
575 {
576  return m_choice == e_Gotseqentry;
577 }
578 
579 inline
581 {
582  return m_choice == e_Gotdeadseqentry;
583 }
584 
585 inline
587 {
588  return m_choice == e_Fini;
589 }
590 
591 inline
593 {
595 }
596 
597 inline
599 {
600  return m_choice == e_Gistate;
601 }
602 
603 inline
605 {
607  return m_Gistate;
608 }
609 
610 inline
612 {
614  return m_Gistate;
615 }
616 
617 inline
619 {
621  m_Gistate = value;
622 }
623 
624 inline
626 {
627  return m_choice == e_Ids;
628 }
629 
630 inline
632 {
634  return *m_Ids;
635 }
636 
637 inline
639 {
641  return *m_Ids;
642 }
643 
644 inline
646 {
647  return m_choice == e_Gihist;
648 }
649 
650 inline
652 {
654  return *m_Gihist;
655 }
656 
657 inline
659 {
661  return *m_Gihist;
662 }
663 
664 inline
666 {
667  return m_choice == e_Girevhist;
668 }
669 
670 inline
672 {
674  return *m_Girevhist;
675 }
676 
677 inline
679 {
681  return *m_Girevhist;
682 }
683 
684 inline
686 {
687  return m_choice == e_Gotsewithinfo;
688 }
689 
690 inline
692 {
693  return m_choice == e_Gotblobinfo;
694 }
695 
696 ///////////////////////////////////////////////////////////
697 ////////////////// end of inline methods //////////////////
698 ///////////////////////////////////////////////////////////
699 
700 
701 
702 
703 
704 END_objects_SCOPE // namespace ncbi::objects::
705 
707 
708 
709 #endif // OBJECTS_ID1_ID1SERVER_BACK_BASE_HPP
CID1SeqEntry_info –.
CID1Seq_hist –.
Definition: ID1Seq_hist.hpp:66
CID1blob_info –.
CID1server_back_Base –.
Definition: Seq_entry.hpp:56
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 SetFini(void)
Select the variant.
NCBI_NS_NCBI::CUnionBuffer< TGirevhist > m_Girevhist
bool IsGotsewithinfo(void) const
Check if variant Gotsewithinfo is selected.
bool IsIds(void) const
Check if variant Ids is selected.
TIds & SetIds(void)
Select the variant.
bool IsGotseqentry(void) const
Check if variant Gotseqentry is selected.
TGotgi & SetGotgi(void)
Select the variant.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
E_Choice Which(void) const
Which variant is currently selected.
TError & SetError(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TError GetError(void) const
Get the variant data.
bool IsError(void) const
Check if variant Error is selected.
bool IsGotgi(void) const
Check if variant Gotgi is selected.
TGistate & SetGistate(void)
Select the variant.
list< CRef< CID1Seq_hist > > TGirevhist
NCBI_NS_NCBI::CUnionBuffer< TGirevhist > m_Girevhist
NCBI_NS_NCBI::CUnionBuffer< TIds > m_Ids
NCBI_NS_NCBI::CUnionBuffer< TGihist > m_Gihist
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsGistate(void) const
Check if variant Gistate is selected.
TGihist & SetGihist(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
NCBI_NS_NCBI::TGi TGotgi
bool IsFini(void) const
Check if variant Fini is selected.
list< CRef< CID1Seq_hist > > TGihist
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
NCBI_NS_NCBI::CUnionBuffer< TIds > m_Ids
TGotgi GetGotgi(void) const
Get the variant data.
CID1server_back_Base & operator=(const CID1server_back_Base &)
const TIds & GetIds(void) const
Get the variant data.
NCBI_NS_NCBI::CUnionBuffer< TGihist > m_Gihist
bool IsGihist(void) const
Check if variant Gihist is selected.
bool IsGotdeadseqentry(void) const
Check if variant Gotdeadseqentry is selected.
const TGirevhist & GetGirevhist(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
list< CRef< CSeq_id > > TIds
bool IsGotblobinfo(void) const
Check if variant Gotblobinfo is selected.
CID1blob_info TGotblobinfo
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool IsGirevhist(void) const
Check if variant Girevhist is selected.
E_Choice
Choice variants.
CID1SeqEntry_info TGotsewithinfo
bool IsInit(void) const
Check if variant Init is selected.
TGirevhist & SetGirevhist(void)
Select the variant.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
TGistate GetGistate(void) const
Get the variant data.
void SetInit(void)
Select the variant.
const TGihist & GetGihist(void) const
Get the variant data.
CID1server_back_Base(const CID1server_back_Base &)
@ e_not_set
No variant selected.
@ e_Gihist
because hand crafted Seq-hist does not follow same conventions
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
Modified on Sun Jul 14 05:01:40 2024 by modify_doxy.py rev. 669887