NCBI C++ ToolKit
SeqTestResults_.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 SeqTestResults_.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/seqtest/seqtest.asn">seqtest.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqtest/seqtest.def">seqtest.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_SEQTEST_SEQTESTRESULTS_BASE_HPP
42 #define OBJECTS_SEQTEST_SEQTESTRESULTS_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
56 class CSeq_align;
57 class CSeq_feat;
58 class CSeq_id;
60 
61 
62 // generated classes
63 
64 
65 /** @addtogroup dataspec_NCBI_SeqTest
66  *
67  * @{
68  */
69 
70 /////////////////////////////////////////////////////////////////////////////
71 ///
72 /// CSeqTestResults_Base --
73 ///
74 
76 {
78 public:
79  // constructor
81  // destructor
82  virtual ~CSeqTestResults_Base(void);
83 
84  // type info
86 
87  /////////////////////////////////////////////////////////////////////////////
88  ///
89  /// C_Source --
90  ///
91 
93  {
95  public:
96  // constructor
97  C_Source(void);
98  // destructor
99  ~C_Source(void);
100 
101  // type info
103 
104 
105  /// Choice variants.
106  enum E_Choice {
107  e_not_set = 0, ///< No variant selected
110  e_Seq_align
111  };
112  /// Maximum+1 value of the choice variant enumerator.
114  e_MaxChoice = 4 ///< == e_Seq_align+1
115  };
116 
117  /// Reset the whole object
118  void Reset(void);
119 
120  /// Reset the selection (set it to e_not_set).
121  void ResetSelection(void);
122 
123  /// Which variant is currently selected.
124  ///
125  /// @return
126  /// Choice state enumerator.
127  E_Choice Which(void) const;
128 
129  /// Verify selection, throw exception if it differs from the expected.
130  ///
131  /// @param index
132  /// Expected selection.
133  void CheckSelected(E_Choice index) const;
134 
135  /// Throw 'InvalidSelection' exception.
136  ///
137  /// @param index
138  /// Expected selection.
139  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
140 
141  /// Retrieve selection name (for diagnostic purposes).
142  ///
143  /// @param index
144  /// One of possible selection states.
145  /// @return
146  /// Name string.
147  static string SelectionName(E_Choice index);
148 
149  /// Select the requested variant if needed.
150  ///
151  /// @param index
152  /// New selection state.
153  /// @param reset
154  /// Flag that defines the resetting of the variant data. The data will
155  /// be reset if either the current selection differs from the new one,
156  /// or the flag is set to eDoResetVariant.
158  /// Select the requested variant if needed,
159  /// allocating CObject variants from memory pool.
160  void Select(E_Choice index,
161  EResetVariant reset,
162  CObjectMemoryPool* pool);
163 
164  // types
165  typedef CSeq_id TSeq_id;
168 
169  // getters
170  // setters
171 
172 
173  /// Check if variant Seq_id is selected.
174  ///
175  /// Seq_id type is defined as 'typedef CSeq_id TSeq_id'.
176  /// @return
177  /// - true, if the variant is selected.
178  /// - false, otherwise.
179  bool IsSeq_id(void) const;
180 
181  /// Get the variant data.
182  ///
183  /// @return
184  /// Reference to the data.
185  const TSeq_id& GetSeq_id(void) const;
186 
187  /// Select the variant.
188  ///
189  /// @return
190  /// Reference to the variant data.
191  TSeq_id& SetSeq_id(void);
192  /// Select the variant and set its data.
193  ///
194  /// @param value
195  /// Reference to the data.
196  void SetSeq_id(TSeq_id& value);
197 
198 
199  /// Check if variant Seq_feat is selected.
200  ///
201  /// Seq_feat type is defined as 'typedef CSeq_feat TSeq_feat'.
202  /// @return
203  /// - true, if the variant is selected.
204  /// - false, otherwise.
205  bool IsSeq_feat(void) const;
206 
207  /// Get the variant data.
208  ///
209  /// @return
210  /// Reference to the data.
211  const TSeq_feat& GetSeq_feat(void) const;
212 
213  /// Select the variant.
214  ///
215  /// @return
216  /// Reference to the variant data.
217  TSeq_feat& SetSeq_feat(void);
218  /// Select the variant and set its data.
219  ///
220  /// @param value
221  /// Reference to the data.
222  void SetSeq_feat(TSeq_feat& value);
223 
224 
225  /// Check if variant Seq_align is selected.
226  ///
227  /// Seq_align type is defined as 'typedef CSeq_align TSeq_align'.
228  /// @return
229  /// - true, if the variant is selected.
230  /// - false, otherwise.
231  bool IsSeq_align(void) const;
232 
233  /// Get the variant data.
234  ///
235  /// @return
236  /// Reference to the data.
237  const TSeq_align& GetSeq_align(void) const;
238 
239  /// Select the variant.
240  ///
241  /// @return
242  /// Reference to the variant data.
243  TSeq_align& SetSeq_align(void);
244  /// Select the variant and set its data.
245  ///
246  /// @param value
247  /// Reference to the data.
248  void SetSeq_align(TSeq_align& value);
249 
250 
251  private:
252  // copy constructor and assignment operator
253  C_Source(const C_Source& );
255  // choice state
257  // helper methods
258  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
259 
260  static const char* const sm_SelectionNames[];
261  // data
262  NCBI_NS_NCBI::CSerialObject *m_object;
263  };
264  // types
265  typedef C_Source TSource;
267 
268  // member index
269  enum class E_memberIndex {
270  e__allMandatory = 0,
271  e_source,
272  e_results
273  };
275 
276  // getters
277  // setters
278 
279  /// Check if a value has been assigned to Source data member.
280  ///
281  /// Data member Source is mandatory;
282  /// its type is defined as 'typedef C_Source TSource'
283  /// @return
284  /// - true, if a value has been assigned.
285  /// - false, otherwise.
286  bool IsSetSource(void) const;
287 
288  /// Check if it is safe to call GetSource method.
289  ///
290  /// @return
291  /// - true, if the data member is getatable.
292  /// - false, otherwise.
293  bool CanGetSource(void) const;
294 
295  /// Reset Source data member.
296  void ResetSource(void);
297 
298  /// Get the Source member data.
299  ///
300  /// @return
301  /// Reference to the member data.
302  const TSource& GetSource(void) const;
303 
304  /// Assign a value to Source data member.
305  ///
306  /// @param value
307  /// Reference to value.
308  void SetSource(TSource& value);
309 
310  /// Assign a value to Source data member.
311  ///
312  /// @return
313  /// Reference to the data value.
314  TSource& SetSource(void);
315 
316  /// Check if a value has been assigned to Results data member.
317  ///
318  /// Data member Results is mandatory;
319  /// its type is defined as 'typedef CSeq_test_result_set TResults'
320  /// @return
321  /// - true, if a value has been assigned.
322  /// - false, otherwise.
323  bool IsSetResults(void) const;
324 
325  /// Check if it is safe to call GetResults method.
326  ///
327  /// @return
328  /// - true, if the data member is getatable.
329  /// - false, otherwise.
330  bool CanGetResults(void) const;
331 
332  /// Reset Results data member.
333  void ResetResults(void);
334 
335  /// Get the Results member data.
336  ///
337  /// @return
338  /// Reference to the member data.
339  const TResults& GetResults(void) const;
340 
341  /// Assign a value to Results data member.
342  ///
343  /// @param value
344  /// Reference to value.
345  void SetResults(TResults& value);
346 
347  /// Assign a value to Results data member.
348  ///
349  /// @return
350  /// Reference to the data value.
351  TResults& SetResults(void);
352 
353  /// Reset the whole object
354  virtual void Reset(void);
355 
356 
357 private:
358  // Prohibit copy constructor and assignment operator
361 
362  // data
363  Uint4 m_set_State[1];
366 };
367 
368 /* @} */
369 
370 
371 
372 
373 
374 ///////////////////////////////////////////////////////////
375 ///////////////////// inline methods //////////////////////
376 ///////////////////////////////////////////////////////////
377 inline
379 {
380  return m_choice;
381 }
382 
383 inline
385 {
386  if ( m_choice != index )
387  ThrowInvalidSelection(index);
388 }
389 
390 inline
391 void CSeqTestResults_Base::C_Source::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
392 {
393  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
394  if ( m_choice != e_not_set )
395  ResetSelection();
396  DoSelect(index, pool);
397  }
398 }
399 
400 inline
402 {
403  Select(index, reset, 0);
404 }
405 
406 inline
408 {
409  return m_choice == e_Seq_id;
410 }
411 
412 inline
414 {
415  return m_choice == e_Seq_feat;
416 }
417 
418 inline
420 {
421  return m_choice == e_Seq_align;
422 }
423 
424 inline
426 {
427  return m_Source.NotEmpty();
428 }
429 
430 inline
432 {
433  return true;
434 }
435 
436 inline
438 {
439  if ( !m_Source ) {
440  const_cast<CSeqTestResults_Base*>(this)->ResetSource();
441  }
442  return (*m_Source);
443 }
444 
445 inline
447 {
448  if ( !m_Source ) {
449  ResetSource();
450  }
451  return (*m_Source);
452 }
453 
454 inline
456 {
457  return m_Results.NotEmpty();
458 }
459 
460 inline
462 {
463  return true;
464 }
465 
466 inline
468 {
469  if ( !m_Results ) {
470  const_cast<CSeqTestResults_Base*>(this)->ResetResults();
471  }
472  return (*m_Results);
473 }
474 
475 inline
477 {
478  if ( !m_Results ) {
479  ResetResults();
480  }
481  return (*m_Results);
482 }
483 
484 ///////////////////////////////////////////////////////////
485 ////////////////// end of inline methods //////////////////
486 ///////////////////////////////////////////////////////////
487 
488 
489 
490 
491 
492 END_objects_SCOPE // namespace ncbi::objects::
493 
495 
496 
497 #endif // OBJECTS_SEQTEST_SEQTESTRESULTS_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
CSeqTestResults_Base –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CSeq_test_result_set –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
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_SEQTEST_EXPORT
Definition: ncbi_export.h:817
CSeq_test_result_set TResults
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
CSeqTestResults_Base & operator=(const CSeqTestResults_Base &)
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
CRef< TSource > m_Source
CSeqTestResults_Base(const CSeqTestResults_Base &)
bool IsSeq_feat(void) const
Check if variant Seq_feat is selected.
NCBI_NS_NCBI::CSerialObject * m_object
void ResetResults(void)
Reset Results data member.
const TSource & GetSource(void) const
Get the Source member data.
bool IsSetResults(void) const
Check if a value has been assigned to Results data member.
C_Source & operator=(const C_Source &)
TSource & SetSource(void)
Assign a value to Source data member.
bool CanGetSource(void) const
Check if it is safe to call GetSource method.
const TResults & GetResults(void) const
Get the Results member data.
E_Choice Which(void) const
Which variant is currently selected.
TResults & SetResults(void)
Assign a value to Results data member.
bool CanGetResults(void) const
Check if it is safe to call GetResults method.
CRef< TResults > m_Results
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsSeq_id(void) const
Check if variant Seq_id is selected.
bool IsSeq_align(void) const
Check if variant Seq_align is selected.
bool IsSetSource(void) const
Check if a value has been assigned to Source data member.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
void ResetSource(void)
Reset Source data member.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue May 28 05:50:53 2024 by modify_doxy.py rev. 669887