NCBI C++ ToolKit
GC_SeqIdAlias_.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 GC_SeqIdAlias_.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/genomecoll/genome_collection.asn">genome_collection.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/genomecoll/genome_collection.def">genome_collection.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_GENOMECOLL_GC_SEQIDALIAS_BASE_HPP
42 #define OBJECTS_GENOMECOLL_GC_SEQIDALIAS_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_id;
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_GenomeCollection
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// Seq-id-alias
69 /// a sequence has multiple seq-ids - refseq, genbank, local
70 /// and each one has both gi and accession.version
71 /// We cannot provide them as simply a list of seq-ids since it will be
72 /// unclear which gi goes with which accession, therefore we group the
73 /// related ones as alias pair.
74 ///
75 /// CGC_SeqIdAlias_Base --
76 ///
77 
79 {
81 public:
82  // constructor
83  CGC_SeqIdAlias_Base(void);
84  // destructor
85  virtual ~CGC_SeqIdAlias_Base(void);
86 
87  // type info
89 
90  enum ESimilarity {
91  eSimilarity_unknown = 0,
92  eSimilarity_identical = 1,
93  eSimilarity_different = 255
94  };
95 
96  /// Access to ESimilarity's attributes (values, names) as defined in spec
97  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ESimilarity)(void);
98 
99  // types
100  typedef CSeq_id TPublic;
101  typedef CSeq_id TGpipe;
102  typedef CSeq_id TGi;
103  typedef int TSimilarity;
104 
105  // member index
106  enum class E_memberIndex {
107  e__allMandatory = 0,
108  e_public,
109  e_gpipe,
110  e_gi,
111  e_similarity
112  };
114 
115  // getters
116  // setters
117 
118  /// the refseq/genbank accession
119  /// Check if a value has been assigned to Public data member.
120  ///
121  /// Data member Public is mandatory;
122  /// its type is defined as 'typedef CSeq_id TPublic'
123  /// @return
124  /// - true, if a value has been assigned.
125  /// - false, otherwise.
126  bool IsSetPublic(void) const;
127 
128  /// Check if it is safe to call GetPublic method.
129  ///
130  /// @return
131  /// - true, if the data member is getatable.
132  /// - false, otherwise.
133  bool CanGetPublic(void) const;
134 
135  /// Reset Public data member.
136  void ResetPublic(void);
137 
138  /// Get the Public member data.
139  ///
140  /// @return
141  /// Reference to the member data.
142  const TPublic& GetPublic(void) const;
143 
144  /// Assign a value to Public data member.
145  ///
146  /// @param value
147  /// Reference to value.
148  void SetPublic(TPublic& value);
149 
150  /// Assign a value to Public data member.
151  ///
152  /// @return
153  /// Reference to the data value.
154  TPublic& SetPublic(void);
155 
156  /// the gpipe accession
157  /// Check if a value has been assigned to Gpipe data member.
158  ///
159  /// Data member Gpipe is optional;
160  /// its type is defined as 'typedef CSeq_id TGpipe'
161  /// @return
162  /// - true, if a value has been assigned.
163  /// - false, otherwise.
164  bool IsSetGpipe(void) const;
165 
166  /// Check if it is safe to call GetGpipe method.
167  ///
168  /// @return
169  /// - true, if the data member is getatable.
170  /// - false, otherwise.
171  bool CanGetGpipe(void) const;
172 
173  /// Reset Gpipe data member.
174  void ResetGpipe(void);
175 
176  /// Get the Gpipe member data.
177  ///
178  /// @return
179  /// Reference to the member data.
180  const TGpipe& GetGpipe(void) const;
181 
182  /// Assign a value to Gpipe data member.
183  ///
184  /// @param value
185  /// Reference to value.
186  void SetGpipe(TGpipe& value);
187 
188  /// Assign a value to Gpipe data member.
189  ///
190  /// @return
191  /// Reference to the data value.
192  TGpipe& SetGpipe(void);
193 
194  /// optional since not all sequences have GIs
195  /// Similarity: relationship between this synonym to main seqid of the
196  /// GC-Sequence
197  /// Can be expanded to multiple level of identicality
198  /// can use bitmap to flag ambiguity between different levels
199  /// Check if a value has been assigned to Gi data member.
200  ///
201  /// Data member Gi is optional;
202  /// its type is defined as 'typedef CSeq_id TGi'
203  /// @return
204  /// - true, if a value has been assigned.
205  /// - false, otherwise.
206  bool IsSetGi(void) const;
207 
208  /// Check if it is safe to call GetGi method.
209  ///
210  /// @return
211  /// - true, if the data member is getatable.
212  /// - false, otherwise.
213  bool CanGetGi(void) const;
214 
215  /// Reset Gi data member.
216  void ResetGi(void);
217 
218  /// Get the Gi member data.
219  ///
220  /// @return
221  /// Reference to the member data.
222  const TGi& GetGi(void) const;
223 
224  /// Assign a value to Gi data member.
225  ///
226  /// @param value
227  /// Reference to value.
228  void SetGi(TGi& value);
229 
230  /// Assign a value to Gi data member.
231  ///
232  /// @return
233  /// Reference to the data value.
234  TGi& SetGi(void);
235 
236  /// Check if a value has been assigned to Similarity data member.
237  ///
238  /// Data member Similarity is mandatory;
239  /// its type is defined as 'typedef int TSimilarity'
240  /// @return
241  /// - true, if a value has been assigned.
242  /// - false, otherwise.
243  bool IsSetSimilarity(void) const;
244 
245  /// Check if it is safe to call GetSimilarity method.
246  ///
247  /// @return
248  /// - true, if the data member is getatable.
249  /// - false, otherwise.
250  bool CanGetSimilarity(void) const;
251 
252  /// Reset Similarity data member.
253  void ResetSimilarity(void);
254 
255  /// Get the Similarity member data.
256  ///
257  /// @return
258  /// Copy of the member data.
259  TSimilarity GetSimilarity(void) const;
260 
261  /// Assign a value to Similarity data member.
262  ///
263  /// @param value
264  /// Value to assign
265  void SetSimilarity(TSimilarity value);
266 
267  /// Assign a value to Similarity data member.
268  ///
269  /// @return
270  /// Reference to the data value.
271  TSimilarity& SetSimilarity(void);
272 
273  /// Reset the whole object
274  virtual void Reset(void);
275 
276 
277 private:
278  // Prohibit copy constructor and assignment operator
281 
282  // data
283  Uint4 m_set_State[1];
288 };
289 
290 /* @} */
291 
292 
293 
294 
295 
296 ///////////////////////////////////////////////////////////
297 ///////////////////// inline methods //////////////////////
298 ///////////////////////////////////////////////////////////
299 inline
301 {
302  return m_Public.NotEmpty();
303 }
304 
305 inline
307 {
308  return true;
309 }
310 
311 inline
313 {
314  if ( !m_Public ) {
315  const_cast<CGC_SeqIdAlias_Base*>(this)->ResetPublic();
316  }
317  return (*m_Public);
318 }
319 
320 inline
322 {
323  if ( !m_Public ) {
324  ResetPublic();
325  }
326  return (*m_Public);
327 }
328 
329 inline
331 {
332  return m_Gpipe.NotEmpty();
333 }
334 
335 inline
337 {
338  return IsSetGpipe();
339 }
340 
341 inline
343 {
344  if (!CanGetGpipe()) {
345  ThrowUnassigned(1);
346  }
347  return (*m_Gpipe);
348 }
349 
350 inline
352 {
353  return m_Gi.NotEmpty();
354 }
355 
356 inline
358 {
359  return IsSetGi();
360 }
361 
362 inline
364 {
365  if (!CanGetGi()) {
366  ThrowUnassigned(2);
367  }
368  return (*m_Gi);
369 }
370 
371 inline
373 {
374  return ((m_set_State[0] & 0xc0) != 0);
375 }
376 
377 inline
379 {
380  return IsSetSimilarity();
381 }
382 
383 inline
385 {
386  m_Similarity = (ESimilarity)(0);
387  m_set_State[0] &= ~0xc0;
388 }
389 
390 inline
392 {
393  if (!CanGetSimilarity()) {
394  ThrowUnassigned(3);
395  }
396  return m_Similarity;
397 }
398 
399 inline
401 {
403  m_set_State[0] |= 0xc0;
404 }
405 
406 inline
408 {
409 #ifdef _DEBUG
410  if (!IsSetSimilarity()) {
411  memset(&m_Similarity,UnassignedByte(),sizeof(m_Similarity));
412  }
413 #endif
414  m_set_State[0] |= 0x40;
415  return m_Similarity;
416 }
417 
418 ///////////////////////////////////////////////////////////
419 ////////////////// end of inline methods //////////////////
420 ///////////////////////////////////////////////////////////
421 
422 
423 
424 
425 
426 END_objects_SCOPE // namespace ncbi::objects::
427 
429 
430 
431 #endif // OBJECTS_GENOMECOLL_GC_SEQIDALIAS_BASE_HPP
Seq-id-alias a sequence has multiple seq-ids - refseq, genbank, local and each one has both gi and ac...
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
char value[7]
Definition: config.c:431
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
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_GENOME_COLLECTION_EXPORT
Definition: ncbi_export.h:528
bool IsSetGpipe(void) const
the gpipe accession Check if a value has been assigned to Gpipe data member.
bool CanGetPublic(void) const
Check if it is safe to call GetPublic method.
const TGi & GetGi(void) const
Get the Gi member data.
bool IsSetPublic(void) const
the refseq/genbank accession Check if a value has been assigned to Public data member.
CRef< TPublic > m_Public
TPublic & SetPublic(void)
Assign a value to Public data member.
bool CanGetGi(void) const
Check if it is safe to call GetGi method.
void ResetSimilarity(void)
Reset Similarity data member.
CGC_SeqIdAlias_Base(const CGC_SeqIdAlias_Base &)
bool IsSetGi(void) const
optional since not all sequences have GIs Similarity: relationship between this synonym to main seqid...
bool IsSetSimilarity(void) const
Check if a value has been assigned to Similarity data member.
CRef< TGpipe > m_Gpipe
const TGpipe & GetGpipe(void) const
Get the Gpipe member data.
bool CanGetSimilarity(void) const
Check if it is safe to call GetSimilarity method.
TSimilarity & SetSimilarity(void)
Assign a value to Similarity data member.
const TPublic & GetPublic(void) const
Get the Public member data.
CGC_SeqIdAlias_Base & operator=(const CGC_SeqIdAlias_Base &)
void ResetPublic(void)
Reset Public data member.
CSerialObject Tparent
Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
bool CanGetGpipe(void) const
Check if it is safe to call GetGpipe method.
TSimilarity GetSimilarity(void) const
Get the Similarity member data.
Modified on Wed Nov 29 02:20:51 2023 by modify_doxy.py rev. 669887