NCBI C++ ToolKit
Seq_submit_.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 Seq_submit_.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/submit/submit.asn">submit.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/submit/submit.def">submit.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_SUBMIT_SEQ_SUBMIT_BASE_HPP
42 #define OBJECTS_SUBMIT_SEQ_SUBMIT_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 CSeq_annot;
61 class CSeq_entry;
62 class CSeq_id;
63 class CSubmit_block;
64 
65 
66 // generated classes
67 
68 
69 /** @addtogroup dataspec_NCBI_Submit
70  *
71  * @{
72  */
73 
74 /////////////////////////////////////////////////////////////////////////////
75 /// deletions of entries
76 ///
77 /// CSeq_submit_Base --
78 ///
79 
81 {
83 public:
84  // constructor
85  CSeq_submit_Base(void);
86  // destructor
87  virtual ~CSeq_submit_Base(void);
88 
89  // type info
91 
92  /////////////////////////////////////////////////////////////////////////////
93  ///
94  /// C_Data --
95  ///
96 
98  {
100  public:
101  // constructor
102  C_Data(void);
103  // destructor
104  ~C_Data(void);
105 
106  // type info
108 
109 
110  /// Choice variants.
111  enum E_Choice {
112  e_not_set = 0, ///< No variant selected
113  e_Entrys, ///< sequence(s)
114  e_Annots, ///< annotation(s)
115  e_Delete
116  };
117  /// Maximum+1 value of the choice variant enumerator.
119  e_MaxChoice = 4 ///< == e_Delete+1
120  };
121 
122  /// Reset the whole object
123  void Reset(void);
124 
125  /// Reset the selection (set it to e_not_set).
126  void ResetSelection(void);
127 
128  /// Which variant is currently selected.
129  ///
130  /// @return
131  /// Choice state enumerator.
132  E_Choice Which(void) const;
133 
134  /// Verify selection, throw exception if it differs from the expected.
135  ///
136  /// @param index
137  /// Expected selection.
138  void CheckSelected(E_Choice index) const;
139 
140  /// Throw 'InvalidSelection' exception.
141  ///
142  /// @param index
143  /// Expected selection.
144  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
145 
146  /// Retrieve selection name (for diagnostic purposes).
147  ///
148  /// @param index
149  /// One of possible selection states.
150  /// @return
151  /// Name string.
152  static string SelectionName(E_Choice index);
153 
154  /// Select the requested variant if needed.
155  ///
156  /// @param index
157  /// New selection state.
158  /// @param reset
159  /// Flag that defines the resetting of the variant data. The data will
160  /// be reset if either the current selection differs from the new one,
161  /// or the flag is set to eDoResetVariant.
163  /// Select the requested variant if needed,
164  /// allocating CObject variants from memory pool.
165  void Select(E_Choice index,
166  EResetVariant reset,
167  CObjectMemoryPool* pool);
168 
169  // types
170  typedef list< CRef< CSeq_entry > > TEntrys;
171  typedef list< CRef< CSeq_annot > > TAnnots;
172  typedef list< CRef< CSeq_id > > TDelete;
173 
174  // getters
175  // setters
176 
177 
178  /// Check if variant Entrys is selected.
179  ///
180  /// Entrys type is defined as 'typedef list< CRef< CSeq_entry > > TEntrys'.
181  /// @return
182  /// - true, if the variant is selected.
183  /// - false, otherwise.
184  bool IsEntrys(void) const;
185 
186  /// Get the variant data.
187  ///
188  /// @return
189  /// Reference to the data.
190  const TEntrys& GetEntrys(void) const;
191 
192  /// Select the variant.
193  ///
194  /// @return
195  /// Reference to the variant data.
196  TEntrys& SetEntrys(void);
197 
198 
199  /// Check if variant Annots is selected.
200  ///
201  /// Annots type is defined as 'typedef list< CRef< CSeq_annot > > TAnnots'.
202  /// @return
203  /// - true, if the variant is selected.
204  /// - false, otherwise.
205  bool IsAnnots(void) const;
206 
207  /// Get the variant data.
208  ///
209  /// @return
210  /// Reference to the data.
211  const TAnnots& GetAnnots(void) const;
212 
213  /// Select the variant.
214  ///
215  /// @return
216  /// Reference to the variant data.
217  TAnnots& SetAnnots(void);
218 
219 
220  /// Check if variant Delete is selected.
221  ///
222  /// Delete type is defined as 'typedef list< CRef< CSeq_id > > TDelete'.
223  /// @return
224  /// - true, if the variant is selected.
225  /// - false, otherwise.
226  bool IsDelete(void) const;
227 
228  /// Get the variant data.
229  ///
230  /// @return
231  /// Reference to the data.
232  const TDelete& GetDelete(void) const;
233 
234  /// Select the variant.
235  ///
236  /// @return
237  /// Reference to the variant data.
238  TDelete& SetDelete(void);
239 
240 
241  private:
242  // copy constructor and assignment operator
243  C_Data(const C_Data& );
245  // choice state
247  // helper methods
248  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
249 
250  static const char* const sm_SelectionNames[];
251  // data
252  union {
253  NCBI_NS_NCBI::CUnionBuffer<TEntrys> m_Entrys;
254  NCBI_NS_NCBI::CUnionBuffer<TAnnots> m_Annots;
255  NCBI_NS_NCBI::CUnionBuffer<TDelete> m_Delete;
257  };
258  };
259  // types
261  typedef C_Data TData;
262 
263  // member index
264  enum class E_memberIndex {
265  e__allMandatory = 0,
266  e_sub,
267  e_data
268  };
270 
271  // getters
272  // setters
273 
274  /// Check if a value has been assigned to Sub data member.
275  ///
276  /// Data member Sub is mandatory;
277  /// its type is defined as 'typedef CSubmit_block TSub'
278  /// @return
279  /// - true, if a value has been assigned.
280  /// - false, otherwise.
281  bool IsSetSub(void) const;
282 
283  /// Check if it is safe to call GetSub method.
284  ///
285  /// @return
286  /// - true, if the data member is getatable.
287  /// - false, otherwise.
288  bool CanGetSub(void) const;
289 
290  /// Reset Sub data member.
291  void ResetSub(void);
292 
293  /// Get the Sub member data.
294  ///
295  /// @return
296  /// Reference to the member data.
297  const TSub& GetSub(void) const;
298 
299  /// Assign a value to Sub data member.
300  ///
301  /// @param value
302  /// Reference to value.
303  void SetSub(TSub& value);
304 
305  /// Assign a value to Sub data member.
306  ///
307  /// @return
308  /// Reference to the data value.
309  TSub& SetSub(void);
310 
311  /// Check if a value has been assigned to Data data member.
312  ///
313  /// Data member Data is mandatory;
314  /// its type is defined as 'typedef C_Data TData'
315  /// @return
316  /// - true, if a value has been assigned.
317  /// - false, otherwise.
318  bool IsSetData(void) const;
319 
320  /// Check if it is safe to call GetData method.
321  ///
322  /// @return
323  /// - true, if the data member is getatable.
324  /// - false, otherwise.
325  bool CanGetData(void) const;
326 
327  /// Reset Data data member.
328  void ResetData(void);
329 
330  /// Get the Data member data.
331  ///
332  /// @return
333  /// Reference to the member data.
334  const TData& GetData(void) const;
335 
336  /// Assign a value to Data data member.
337  ///
338  /// @param value
339  /// Reference to value.
340  void SetData(TData& value);
341 
342  /// Assign a value to Data data member.
343  ///
344  /// @return
345  /// Reference to the data value.
346  TData& SetData(void);
347 
348  /// Reset the whole object
349  virtual void Reset(void);
350 
351 
352 private:
353  // Prohibit copy constructor and assignment operator
356 
357  // data
358  Uint4 m_set_State[1];
361 };
362 
363 /* @} */
364 
365 
366 
367 
368 
369 ///////////////////////////////////////////////////////////
370 ///////////////////// inline methods //////////////////////
371 ///////////////////////////////////////////////////////////
372 inline
374 {
375  return m_choice;
376 }
377 
378 inline
380 {
381  if ( m_choice != index )
382  ThrowInvalidSelection(index);
383 }
384 
385 inline
386 void CSeq_submit_Base::C_Data::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
387 {
388  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
389  if ( m_choice != e_not_set )
390  ResetSelection();
391  DoSelect(index, pool);
392  }
393 }
394 
395 inline
397 {
398  Select(index, reset, 0);
399 }
400 
401 inline
403 {
404  return m_choice == e_Entrys;
405 }
406 
407 inline
409 {
410  CheckSelected(e_Entrys);
411  return *m_Entrys;
412 }
413 
414 inline
416 {
417  Select(e_Entrys, NCBI_NS_NCBI::eDoNotResetVariant);
418  return *m_Entrys;
419 }
420 
421 inline
423 {
424  return m_choice == e_Annots;
425 }
426 
427 inline
429 {
430  CheckSelected(e_Annots);
431  return *m_Annots;
432 }
433 
434 inline
436 {
437  Select(e_Annots, NCBI_NS_NCBI::eDoNotResetVariant);
438  return *m_Annots;
439 }
440 
441 inline
443 {
444  return m_choice == e_Delete;
445 }
446 
447 inline
449 {
450  CheckSelected(e_Delete);
451  return *m_Delete;
452 }
453 
454 inline
456 {
457  Select(e_Delete, NCBI_NS_NCBI::eDoNotResetVariant);
458  return *m_Delete;
459 }
460 
461 inline
463 {
464  return m_Sub.NotEmpty();
465 }
466 
467 inline
469 {
470  return true;
471 }
472 
473 inline
475 {
476  if ( !m_Sub ) {
477  const_cast<CSeq_submit_Base*>(this)->ResetSub();
478  }
479  return (*m_Sub);
480 }
481 
482 inline
484 {
485  if ( !m_Sub ) {
486  ResetSub();
487  }
488  return (*m_Sub);
489 }
490 
491 inline
493 {
494  return m_Data.NotEmpty();
495 }
496 
497 inline
499 {
500  return true;
501 }
502 
503 inline
505 {
506  if ( !m_Data ) {
507  const_cast<CSeq_submit_Base*>(this)->ResetData();
508  }
509  return (*m_Data);
510 }
511 
512 inline
514 {
515  if ( !m_Data ) {
516  ResetData();
517  }
518  return (*m_Data);
519 }
520 
521 ///////////////////////////////////////////////////////////
522 ////////////////// end of inline methods //////////////////
523 ///////////////////////////////////////////////////////////
524 
525 
526 
527 
528 
529 END_objects_SCOPE // namespace ncbi::objects::
530 
532 
533 
534 #endif // OBJECTS_SUBMIT_SEQ_SUBMIT_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
Definition: Seq_entry.hpp:56
deletions of entries
Definition: Seq_submit_.hpp:81
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSubmit_block –.
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
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_SUBMIT_EXPORT
Definition: ncbi_export.h:849
TEntrys & SetEntrys(void)
Select the variant.
CSubmit_block TSub
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
bool IsAnnots(void) const
Check if variant Annots is selected.
list< CRef< CSeq_entry > > TEntrys
NCBI_NS_NCBI::CUnionBuffer< TAnnots > m_Annots
void ResetSub(void)
Reset Sub data member.
E_Choice
Choice variants.
TDelete & SetDelete(void)
Select the variant.
TData & SetData(void)
Assign a value to Data data member.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
list< CRef< CSeq_annot > > TAnnots
E_Choice Which(void) const
Which variant is currently selected.
const TDelete & GetDelete(void) const
Get the variant data.
C_Data(const C_Data &)
NCBI_NS_NCBI::CUnionBuffer< TEntrys > m_Entrys
CSerialObject Tparent
Definition: Seq_submit_.hpp:82
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
const TEntrys & GetEntrys(void) const
Get the variant data.
CSeq_submit_Base(const CSeq_submit_Base &)
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
TSub & SetSub(void)
Assign a value to Sub data member.
const TAnnots & GetAnnots(void) const
Get the variant data.
TAnnots & SetAnnots(void)
Select the variant.
C_Data & operator=(const C_Data &)
const TData & GetData(void) const
Get the Data member data.
CRef< TSub > m_Sub
const TSub & GetSub(void) const
Get the Sub member data.
void ResetData(void)
Reset Data data member.
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 > > TDelete
bool IsSetSub(void) const
Check if a value has been assigned to Sub data member.
bool IsEntrys(void) const
Check if variant Entrys is selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool CanGetSub(void) const
Check if it is safe to call GetSub method.
NCBI_NS_NCBI::CUnionBuffer< TDelete > m_Delete
CRef< TData > m_Data
bool IsDelete(void) const
Check if variant Delete is selected.
bool CanGetData(void) const
Check if it is safe to call GetData method.
CSeq_submit_Base & operator=(const CSeq_submit_Base &)
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Apr 17 13:08:32 2024 by modify_doxy.py rev. 669887