NCBI C++ ToolKit
Textseq_id_.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 Textseq_id_.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/seqloc/seqloc.asn">seqloc.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqloc/seqloc.def">seqloc.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_SEQLOC_TEXTSEQ_ID_BASE_HPP
42 #define OBJECTS_SEQLOC_TEXTSEQ_ID_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 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_Seqloc
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CTextseq_id_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CTextseq_id_Base(void);
78  // destructor
79  virtual ~CTextseq_id_Base(void);
80 
81  // type info
83 
84  // types
85  typedef string TName;
86  typedef string TAccession;
87  typedef string TRelease;
88  typedef int TVersion;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_name,
94  e_accession,
95  e_release,
96  e_version
97  };
99 
100  // getters
101  // setters
102 
103  /// Check if a value has been assigned to Name data member.
104  ///
105  /// Data member Name is optional;
106  /// its type is defined as 'typedef string TName'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetName(void) const;
111 
112  /// Check if it is safe to call GetName method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetName(void) const;
118 
119  /// Reset Name data member.
120  void ResetName(void);
121 
122  /// Get the Name member data.
123  ///
124  /// @return
125  /// Reference to the member data.
126  const TName& GetName(void) const;
127 
128  /// Assign a value to Name data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetName(const TName& value);
133  void SetName(TName&& value);
134 
135  /// Assign a value to Name data member.
136  ///
137  /// @return
138  /// Reference to the data value.
139  TName& SetName(void);
140 
141  /// Check if a value has been assigned to Accession data member.
142  ///
143  /// Data member Accession is optional;
144  /// its type is defined as 'typedef string TAccession'
145  /// @return
146  /// - true, if a value has been assigned.
147  /// - false, otherwise.
148  bool IsSetAccession(void) const;
149 
150  /// Check if it is safe to call GetAccession method.
151  ///
152  /// @return
153  /// - true, if the data member is getatable.
154  /// - false, otherwise.
155  bool CanGetAccession(void) const;
156 
157  /// Reset Accession data member.
158  void ResetAccession(void);
159 
160  /// Get the Accession member data.
161  ///
162  /// @return
163  /// Reference to the member data.
164  const TAccession& GetAccession(void) const;
165 
166  /// Assign a value to Accession data member.
167  ///
168  /// @param value
169  /// Value to assign
170  void SetAccession(const TAccession& value);
171  void SetAccession(TAccession&& value);
172 
173  /// Assign a value to Accession data member.
174  ///
175  /// @return
176  /// Reference to the data value.
177  TAccession& SetAccession(void);
178 
179  /// Check if a value has been assigned to Release data member.
180  ///
181  /// Data member Release is optional;
182  /// its type is defined as 'typedef string TRelease'
183  /// @return
184  /// - true, if a value has been assigned.
185  /// - false, otherwise.
186  bool IsSetRelease(void) const;
187 
188  /// Check if it is safe to call GetRelease method.
189  ///
190  /// @return
191  /// - true, if the data member is getatable.
192  /// - false, otherwise.
193  bool CanGetRelease(void) const;
194 
195  /// Reset Release data member.
196  void ResetRelease(void);
197 
198  /// Get the Release member data.
199  ///
200  /// @return
201  /// Reference to the member data.
202  const TRelease& GetRelease(void) const;
203 
204  /// Assign a value to Release data member.
205  ///
206  /// @param value
207  /// Value to assign
208  void SetRelease(const TRelease& value);
209  void SetRelease(TRelease&& value);
210 
211  /// Assign a value to Release data member.
212  ///
213  /// @return
214  /// Reference to the data value.
215  TRelease& SetRelease(void);
216 
217  /// Check if a value has been assigned to Version data member.
218  ///
219  /// Data member Version is optional;
220  /// its type is defined as 'typedef int TVersion'
221  /// @return
222  /// - true, if a value has been assigned.
223  /// - false, otherwise.
224  bool IsSetVersion(void) const;
225 
226  /// Check if it is safe to call GetVersion method.
227  ///
228  /// @return
229  /// - true, if the data member is getatable.
230  /// - false, otherwise.
231  bool CanGetVersion(void) const;
232 
233  /// Reset Version data member.
234  void ResetVersion(void);
235 
236  /// Get the Version member data.
237  ///
238  /// @return
239  /// Copy of the member data.
240  TVersion GetVersion(void) const;
241 
242  /// Assign a value to Version data member.
243  ///
244  /// @param value
245  /// Value to assign
246  void SetVersion(TVersion value);
247 
248  /// Assign a value to Version data member.
249  ///
250  /// @return
251  /// Reference to the data value.
252  TVersion& SetVersion(void);
253 
254  /// Reset the whole object
255  virtual void Reset(void);
256 
257 
258 private:
259  // Prohibit copy constructor and assignment operator
262 
263  // data
264  Uint4 m_set_State[1];
265  string m_Name;
266  string m_Accession;
267  string m_Release;
269 };
270 
271 /* @} */
272 
273 
274 
275 
276 
277 ///////////////////////////////////////////////////////////
278 ///////////////////// inline methods //////////////////////
279 ///////////////////////////////////////////////////////////
280 inline
282 {
283  return ((m_set_State[0] & 0x3) != 0);
284 }
285 
286 inline
288 {
289  return IsSetName();
290 }
291 
292 inline
294 {
295  if (!CanGetName()) {
296  ThrowUnassigned(0);
297  }
298  return m_Name;
299 }
300 
301 inline
303 {
304  m_Name = value;
305  m_set_State[0] |= 0x3;
306 }
307 
308 inline
310 {
311  m_Name = std::forward<CTextseq_id_Base::TName>(value);
312  m_set_State[0] |= 0x3;
313 }
314 
315 inline
317 {
318 #ifdef _DEBUG
319  if (!IsSetName()) {
321  }
322 #endif
323  m_set_State[0] |= 0x1;
324  return m_Name;
325 }
326 
327 inline
329 {
330  return ((m_set_State[0] & 0xc) != 0);
331 }
332 
333 inline
335 {
336  return IsSetAccession();
337 }
338 
339 inline
341 {
342  if (!CanGetAccession()) {
343  ThrowUnassigned(1);
344  }
345  return m_Accession;
346 }
347 
348 inline
350 {
351  m_Accession = value;
352  m_set_State[0] |= 0xc;
353 }
354 
355 inline
357 {
358  m_Accession = std::forward<CTextseq_id_Base::TAccession>(value);
359  m_set_State[0] |= 0xc;
360 }
361 
362 inline
364 {
365 #ifdef _DEBUG
366  if (!IsSetAccession()) {
368  }
369 #endif
370  m_set_State[0] |= 0x4;
371  return m_Accession;
372 }
373 
374 inline
376 {
377  return ((m_set_State[0] & 0x30) != 0);
378 }
379 
380 inline
382 {
383  return IsSetRelease();
384 }
385 
386 inline
388 {
389  if (!CanGetRelease()) {
390  ThrowUnassigned(2);
391  }
392  return m_Release;
393 }
394 
395 inline
397 {
398  m_Release = value;
399  m_set_State[0] |= 0x30;
400 }
401 
402 inline
404 {
405  m_Release = std::forward<CTextseq_id_Base::TRelease>(value);
406  m_set_State[0] |= 0x30;
407 }
408 
409 inline
411 {
412 #ifdef _DEBUG
413  if (!IsSetRelease()) {
415  }
416 #endif
417  m_set_State[0] |= 0x10;
418  return m_Release;
419 }
420 
421 inline
423 {
424  return ((m_set_State[0] & 0xc0) != 0);
425 }
426 
427 inline
429 {
430  return IsSetVersion();
431 }
432 
433 inline
435 {
436  m_Version = 0;
437  m_set_State[0] &= ~0xc0;
438 }
439 
440 inline
442 {
443  if (!CanGetVersion()) {
444  ThrowUnassigned(3);
445  }
446  return m_Version;
447 }
448 
449 inline
451 {
452  m_Version = value;
453  m_set_State[0] |= 0xc0;
454 }
455 
456 inline
458 {
459 #ifdef _DEBUG
460  if (!IsSetVersion()) {
461  memset(&m_Version,UnassignedByte(),sizeof(m_Version));
462  }
463 #endif
464  m_set_State[0] |= 0x40;
465  return m_Version;
466 }
467 
468 ///////////////////////////////////////////////////////////
469 ////////////////// end of inline methods //////////////////
470 ///////////////////////////////////////////////////////////
471 
472 
473 
474 
475 
476 END_objects_SCOPE // namespace ncbi::objects::
477 
479 
480 
481 #endif // OBJECTS_SEQLOC_TEXTSEQ_ID_BASE_HPP
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTextseq_id_Base –.
Definition: Textseq_id_.hpp:73
char value[7]
Definition: config.c:431
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
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_SEQLOC_EXPORT
Definition: ncbi_export.h:776
TName & SetName(void)
Assign a value to Name data member.
bool IsSetAccession(void) const
Check if a value has been assigned to Accession data member.
const TName & GetName(void) const
Get the Name member data.
void ResetVersion(void)
Reset Version data member.
Uint4 m_set_State[1]
bool CanGetName(void) const
Check if it is safe to call GetName method.
CSerialObject Tparent
Definition: Textseq_id_.hpp:74
Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
Definition: Textseq_id_.hpp:98
TVersion & SetVersion(void)
Assign a value to Version data member.
CTextseq_id_Base & operator=(const CTextseq_id_Base &)
TVersion GetVersion(void) const
Get the Version member data.
bool CanGetVersion(void) const
Check if it is safe to call GetVersion method.
bool IsSetRelease(void) const
Check if a value has been assigned to Release data member.
const TRelease & GetRelease(void) const
Get the Release member data.
TAccession & SetAccession(void)
Assign a value to Accession data member.
TRelease & SetRelease(void)
Assign a value to Release data member.
CTextseq_id_Base(const CTextseq_id_Base &)
bool CanGetRelease(void) const
Check if it is safe to call GetRelease method.
bool CanGetAccession(void) const
Check if it is safe to call GetAccession method.
bool IsSetVersion(void) const
Check if a value has been assigned to Version data member.
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
const TAccession & GetAccession(void) const
Get the Accession member data.
const CConstRef< CSeq_id > GetAccession(const CSeq_id_Handle &id_handle)
Modified on Sat Dec 02 09:23:23 2023 by modify_doxy.py rev. 669887