NCBI C++ ToolKit
Annotdesc_.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 Annotdesc_.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/seq/seq.asn">seq.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seq/seq.def">seq.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_SEQ_ANNOTDESC_BASE_HPP
42 #define OBJECTS_SEQ_ANNOTDESC_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
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 CAlign_def;
61 class CDate;
62 class CPubdesc;
63 class CSeq_id;
64 class CSeq_loc;
65 class CUser_object;
66 
67 
68 // generated classes
69 
70 
71 /** @addtogroup dataspec_NCBI_Sequence
72  *
73  * @{
74  */
75 
76 /////////////////////////////////////////////////////////////////////////////
77 ///
78 /// CAnnotdesc_Base --
79 ///
80 
82 {
84 public:
85  // constructor
86  CAnnotdesc_Base(void);
87  // destructor
88  virtual ~CAnnotdesc_Base(void);
89 
90  // type info
92 
93 
94  /// Choice variants.
95  enum E_Choice {
96  e_not_set = 0, ///< No variant selected
97  e_Name, ///< a short name for this collection
98  e_Title, ///< a title for this collection
99  e_Comment, ///< a more extensive comment
100  e_Pub, ///< a reference to the publication
101  e_User, ///< user defined object
102  e_Create_date, ///< date entry first created/released
103  e_Update_date, ///< date of last update
104  e_Src, ///< source sequence from which annot came
105  e_Align, ///< definition of the SeqAligns
106  e_Region ///< all contents cover this region
107  };
108  /// Maximum+1 value of the choice variant enumerator.
110  e_MaxChoice = 11 ///< == e_Region+1
111  };
112 
113  /// Reset the whole object
114  virtual void Reset(void);
115 
116  /// Reset the selection (set it to e_not_set).
117  virtual void ResetSelection(void);
118 
119  /// Which variant is currently selected.
120  ///
121  /// @return
122  /// Choice state enumerator.
123  E_Choice Which(void) const;
124 
125  /// Verify selection, throw exception if it differs from the expected.
126  ///
127  /// @param index
128  /// Expected selection.
129  void CheckSelected(E_Choice index) const;
130 
131  /// Throw 'InvalidSelection' exception.
132  ///
133  /// @param index
134  /// Expected selection.
135  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
136 
137  /// Retrieve selection name (for diagnostic purposes).
138  ///
139  /// @param index
140  /// One of possible selection states.
141  /// @return
142  /// Name string.
143  static string SelectionName(E_Choice index);
144 
145  /// Select the requested variant if needed.
146  ///
147  /// @param index
148  /// New selection state.
149  /// @param reset
150  /// Flag that defines the resetting of the variant data. The data will
151  /// be reset if either the current selection differs from the new one,
152  /// or the flag is set to eDoResetVariant.
154  /// Select the requested variant if needed,
155  /// allocating CObject variants from memory pool.
156  void Select(E_Choice index,
157  EResetVariant reset,
158  CObjectMemoryPool* pool);
159 
160  // types
161  typedef string TName;
162  typedef string TTitle;
163  typedef string TComment;
164  typedef CPubdesc TPub;
168  typedef CSeq_id TSrc;
170  typedef CSeq_loc TRegion;
171 
172  // getters
173  // setters
174 
175 
176  /// Check if variant Name is selected.
177  ///
178  /// Name type is defined as 'typedef string TName'.
179  /// @return
180  /// - true, if the variant is selected.
181  /// - false, otherwise.
182  bool IsName(void) const;
183 
184  /// Get the variant data.
185  ///
186  /// @return
187  /// Reference to the data.
188  const TName& GetName(void) const;
189 
190  /// Select the variant.
191  ///
192  /// @return
193  /// Reference to the variant data.
194  TName& SetName(void);
195 
196  /// Select the variant and set its data.
197  ///
198  /// @param value
199  /// Variant data.
200  void SetName(const TName& value);
201 
202 
203  /// Check if variant Title is selected.
204  ///
205  /// Title type is defined as 'typedef string TTitle'.
206  /// @return
207  /// - true, if the variant is selected.
208  /// - false, otherwise.
209  bool IsTitle(void) const;
210 
211  /// Get the variant data.
212  ///
213  /// @return
214  /// Reference to the data.
215  const TTitle& GetTitle(void) const;
216 
217  /// Select the variant.
218  ///
219  /// @return
220  /// Reference to the variant data.
221  TTitle& SetTitle(void);
222 
223  /// Select the variant and set its data.
224  ///
225  /// @param value
226  /// Variant data.
227  void SetTitle(const TTitle& value);
228 
229 
230  /// Check if variant Comment is selected.
231  ///
232  /// Comment type is defined as 'typedef string TComment'.
233  /// @return
234  /// - true, if the variant is selected.
235  /// - false, otherwise.
236  bool IsComment(void) const;
237 
238  /// Get the variant data.
239  ///
240  /// @return
241  /// Reference to the data.
242  const TComment& GetComment(void) const;
243 
244  /// Select the variant.
245  ///
246  /// @return
247  /// Reference to the variant data.
248  TComment& SetComment(void);
249 
250  /// Select the variant and set its data.
251  ///
252  /// @param value
253  /// Variant data.
254  void SetComment(const TComment& value);
255 
256 
257  /// Check if variant Pub is selected.
258  ///
259  /// Pub type is defined as 'typedef CPubdesc TPub'.
260  /// @return
261  /// - true, if the variant is selected.
262  /// - false, otherwise.
263  bool IsPub(void) const;
264 
265  /// Get the variant data.
266  ///
267  /// @return
268  /// Reference to the data.
269  const TPub& GetPub(void) const;
270 
271  /// Select the variant.
272  ///
273  /// @return
274  /// Reference to the variant data.
275  TPub& SetPub(void);
276  /// Select the variant and set its data.
277  ///
278  /// @param value
279  /// Reference to the data.
280  void SetPub(TPub& value);
281 
282 
283  /// Check if variant User is selected.
284  ///
285  /// User type is defined as 'typedef CUser_object TUser'.
286  /// @return
287  /// - true, if the variant is selected.
288  /// - false, otherwise.
289  bool IsUser(void) const;
290 
291  /// Get the variant data.
292  ///
293  /// @return
294  /// Reference to the data.
295  const TUser& GetUser(void) const;
296 
297  /// Select the variant.
298  ///
299  /// @return
300  /// Reference to the variant data.
301  TUser& SetUser(void);
302  /// Select the variant and set its data.
303  ///
304  /// @param value
305  /// Reference to the data.
306  void SetUser(TUser& value);
307 
308 
309  /// Check if variant Create_date is selected.
310  ///
311  /// Create_date type is defined as 'typedef CDate TCreate_date'.
312  /// @return
313  /// - true, if the variant is selected.
314  /// - false, otherwise.
315  bool IsCreate_date(void) const;
316 
317  /// Get the variant data.
318  ///
319  /// @return
320  /// Reference to the data.
321  const TCreate_date& GetCreate_date(void) const;
322 
323  /// Select the variant.
324  ///
325  /// @return
326  /// Reference to the variant data.
327  TCreate_date& SetCreate_date(void);
328  /// Select the variant and set its data.
329  ///
330  /// @param value
331  /// Reference to the data.
332  void SetCreate_date(TCreate_date& value);
333 
334 
335  /// Check if variant Update_date is selected.
336  ///
337  /// Update_date type is defined as 'typedef CDate TUpdate_date'.
338  /// @return
339  /// - true, if the variant is selected.
340  /// - false, otherwise.
341  bool IsUpdate_date(void) const;
342 
343  /// Get the variant data.
344  ///
345  /// @return
346  /// Reference to the data.
347  const TUpdate_date& GetUpdate_date(void) const;
348 
349  /// Select the variant.
350  ///
351  /// @return
352  /// Reference to the variant data.
353  TUpdate_date& SetUpdate_date(void);
354  /// Select the variant and set its data.
355  ///
356  /// @param value
357  /// Reference to the data.
358  void SetUpdate_date(TUpdate_date& value);
359 
360 
361  /// Check if variant Src is selected.
362  ///
363  /// Src type is defined as 'typedef CSeq_id TSrc'.
364  /// @return
365  /// - true, if the variant is selected.
366  /// - false, otherwise.
367  bool IsSrc(void) const;
368 
369  /// Get the variant data.
370  ///
371  /// @return
372  /// Reference to the data.
373  const TSrc& GetSrc(void) const;
374 
375  /// Select the variant.
376  ///
377  /// @return
378  /// Reference to the variant data.
379  TSrc& SetSrc(void);
380  /// Select the variant and set its data.
381  ///
382  /// @param value
383  /// Reference to the data.
384  void SetSrc(TSrc& value);
385 
386 
387  /// Check if variant Align is selected.
388  ///
389  /// Align type is defined as 'typedef CAlign_def TAlign'.
390  /// @return
391  /// - true, if the variant is selected.
392  /// - false, otherwise.
393  bool IsAlign(void) const;
394 
395  /// Get the variant data.
396  ///
397  /// @return
398  /// Reference to the data.
399  const TAlign& GetAlign(void) const;
400 
401  /// Select the variant.
402  ///
403  /// @return
404  /// Reference to the variant data.
405  TAlign& SetAlign(void);
406  /// Select the variant and set its data.
407  ///
408  /// @param value
409  /// Reference to the data.
410  void SetAlign(TAlign& value);
411 
412 
413  /// Check if variant Region is selected.
414  ///
415  /// Region type is defined as 'typedef CSeq_loc TRegion'.
416  /// @return
417  /// - true, if the variant is selected.
418  /// - false, otherwise.
419  bool IsRegion(void) const;
420 
421  /// Get the variant data.
422  ///
423  /// @return
424  /// Reference to the data.
425  const TRegion& GetRegion(void) const;
426 
427  /// Select the variant.
428  ///
429  /// @return
430  /// Reference to the variant data.
431  TRegion& SetRegion(void);
432  /// Select the variant and set its data.
433  ///
434  /// @param value
435  /// Reference to the data.
436  void SetRegion(TRegion& value);
437 
438 
439 private:
440  // copy constructor and assignment operator
443  // choice state
445  // helper methods
446  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
447 
448  static const char* const sm_SelectionNames[];
449  // data
450  union {
451  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
452  NCBI_NS_NCBI::CSerialObject *m_object;
453  };
454 };
455 
456 /* @} */
457 
458 
459 
460 
461 
462 ///////////////////////////////////////////////////////////
463 ///////////////////// inline methods //////////////////////
464 ///////////////////////////////////////////////////////////
465 inline
467 {
468  return m_choice;
469 }
470 
471 inline
473 {
474  if ( m_choice != index )
475  ThrowInvalidSelection(index);
476 }
477 
478 inline
479 void CAnnotdesc_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
480 {
481  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
482  if ( m_choice != e_not_set )
483  ResetSelection();
484  DoSelect(index, pool);
485  }
486 }
487 
488 inline
489 void CAnnotdesc_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
490 {
491  Select(index, reset, 0);
492 }
493 
494 inline
495 bool CAnnotdesc_Base::IsName(void) const
496 {
497  return m_choice == e_Name;
498 }
499 
500 inline
502 {
504  return *m_string;
505 }
506 
507 inline
509 {
511  return *m_string;
512 }
513 
514 inline
515 bool CAnnotdesc_Base::IsTitle(void) const
516 {
517  return m_choice == e_Title;
518 }
519 
520 inline
522 {
524  return *m_string;
525 }
526 
527 inline
529 {
531  return *m_string;
532 }
533 
534 inline
536 {
537  return m_choice == e_Comment;
538 }
539 
540 inline
542 {
544  return *m_string;
545 }
546 
547 inline
549 {
551  return *m_string;
552 }
553 
554 inline
555 bool CAnnotdesc_Base::IsPub(void) const
556 {
557  return m_choice == e_Pub;
558 }
559 
560 inline
561 bool CAnnotdesc_Base::IsUser(void) const
562 {
563  return m_choice == e_User;
564 }
565 
566 inline
568 {
569  return m_choice == e_Create_date;
570 }
571 
572 inline
574 {
575  return m_choice == e_Update_date;
576 }
577 
578 inline
579 bool CAnnotdesc_Base::IsSrc(void) const
580 {
581  return m_choice == e_Src;
582 }
583 
584 inline
585 bool CAnnotdesc_Base::IsAlign(void) const
586 {
587  return m_choice == e_Align;
588 }
589 
590 inline
592 {
593  return m_choice == e_Region;
594 }
595 
596 ///////////////////////////////////////////////////////////
597 ////////////////// end of inline methods //////////////////
598 ///////////////////////////////////////////////////////////
599 
600 
601 
602 
603 
604 END_objects_SCOPE // namespace ncbi::objects::
605 
607 
608 
609 #endif // OBJECTS_SEQ_ANNOTDESC_BASE_HPP
CAlign_def –.
Definition: Align_def.hpp:66
CAnnotdesc_Base –.
Definition: Annotdesc_.hpp:82
Definition: Date.hpp:53
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
Base class for all serializable objects.
Definition: serialbase.hpp:150
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
#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_SEQ_EXPORT
Definition: ncbi_export.h:825
TTitle & SetTitle(void)
Select the variant.
Definition: Annotdesc_.hpp:528
bool IsCreate_date(void) const
Check if variant Create_date is selected.
Definition: Annotdesc_.hpp:567
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
Definition: Annotdesc_.hpp:472
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
Definition: Annotdesc_.hpp:109
CAlign_def TAlign
Definition: Annotdesc_.hpp:169
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
Definition: Annotdesc_.cpp:139
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
TName & SetName(void)
Select the variant.
Definition: Annotdesc_.hpp:508
E_Choice Which(void) const
Which variant is currently selected.
Definition: Annotdesc_.hpp:466
TComment & SetComment(void)
Select the variant.
Definition: Annotdesc_.hpp:548
bool IsComment(void) const
Check if variant Comment is selected.
Definition: Annotdesc_.hpp:535
CUser_object TUser
Definition: Annotdesc_.hpp:165
bool IsRegion(void) const
Check if variant Region is selected.
Definition: Annotdesc_.hpp:591
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
CSeq_loc TRegion
Definition: Annotdesc_.hpp:170
bool IsUpdate_date(void) const
Check if variant Update_date is selected.
Definition: Annotdesc_.hpp:573
CSerialObject Tparent
Definition: Annotdesc_.hpp:83
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
Definition: Annotdesc_.cpp:85
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
Definition: Annotdesc_.cpp:62
bool IsUser(void) const
Check if variant User is selected.
Definition: Annotdesc_.hpp:561
E_Choice
Choice variants.
Definition: Annotdesc_.hpp:95
const TTitle & GetTitle(void) const
Get the variant data.
Definition: Annotdesc_.hpp:521
bool IsSrc(void) const
Check if variant Src is selected.
Definition: Annotdesc_.hpp:579
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Annotdesc_.hpp:451
CAnnotdesc_Base(const CAnnotdesc_Base &)
CAnnotdesc_Base & operator=(const CAnnotdesc_Base &)
const TComment & GetComment(void) const
Get the variant data.
Definition: Annotdesc_.hpp:541
bool IsTitle(void) const
Check if variant Title is selected.
Definition: Annotdesc_.hpp:515
const TName & GetName(void) const
Get the variant data.
Definition: Annotdesc_.hpp:501
bool IsPub(void) const
Check if variant Pub is selected.
Definition: Annotdesc_.hpp:555
E_Choice m_choice
Definition: Annotdesc_.hpp:444
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
Definition: Annotdesc_.hpp:451
bool IsAlign(void) const
Check if variant Align is selected.
Definition: Annotdesc_.hpp:585
bool IsName(void) const
Check if variant Name is selected.
Definition: Annotdesc_.hpp:495
NCBI_NS_NCBI::CSerialObject * m_object
Definition: Annotdesc_.hpp:452
@ e_Comment
a more extensive comment
Definition: Annotdesc_.hpp:99
@ e_Pub
a reference to the publication
Definition: Annotdesc_.hpp:100
@ e_Align
definition of the SeqAligns
Definition: Annotdesc_.hpp:105
@ e_Region
all contents cover this region
Definition: Annotdesc_.hpp:106
@ e_Update_date
date of last update
Definition: Annotdesc_.hpp:103
@ e_Create_date
date entry first created/released
Definition: Annotdesc_.hpp:102
@ e_Name
a short name for this collection
Definition: Annotdesc_.hpp:97
@ e_Title
a title for this collection
Definition: Annotdesc_.hpp:98
@ e_User
user defined object
Definition: Annotdesc_.hpp:101
@ e_Src
source sequence from which annot came
Definition: Annotdesc_.hpp:104
@ e_not_set
No variant selected.
Definition: Annotdesc_.hpp:96
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static void SetTitle(CRef< CSeq_entry > entry, string title)
Modified on Thu Apr 25 08:20:35 2024 by modify_doxy.py rev. 669887