NCBI C++ ToolKit
Subsequence_.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 Subsequence_.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/varrep/varrep.asn">varrep.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/varrep/varrep.def">varrep.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_VARREP_SUBSEQUENCE_BASE_HPP
42 #define OBJECTS_VARREP_SUBSEQUENCE_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
50 
52 
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
56 #endif
57 BEGIN_objects_SCOPE // namespace ncbi::objects::
58 
59 
60 // forward declarations
61 class CSeqInterval;
62 
63 
64 // generated classes
65 
66 
67 /** @addtogroup dataspec_NCBI_VariationIRep
68  *
69  * @{
70  */
71 
72 /////////////////////////////////////////////////////////////////////////////
73 ///
74 /// CSubsequence_Base --
75 ///
76 
78 {
80 public:
81  // constructor
82  CSubsequence_Base(void);
83  // destructor
84  virtual ~CSubsequence_Base(void);
85 
86  // type info
88 
89  // types
90  typedef string TIdentifier;
91  typedef int TType;
92  typedef CSeqInterval TInt;
93 
94  // member index
95  enum class E_memberIndex {
96  e__allMandatory = 0,
98  e_type,
99  e_int
100  };
102 
103  // getters
104  // setters
105 
106  /// For example, an accession id
107  /// Check if a value has been assigned to Identifier data member.
108  ///
109  /// Data member Identifier is mandatory;
110  /// its type is defined as 'typedef string TIdentifier'
111  /// @return
112  /// - true, if a value has been assigned.
113  /// - false, otherwise.
114  bool IsSetIdentifier(void) const;
115 
116  /// Check if it is safe to call GetIdentifier method.
117  ///
118  /// @return
119  /// - true, if the data member is getatable.
120  /// - false, otherwise.
121  bool CanGetIdentifier(void) const;
122 
123  /// Reset Identifier data member.
124  void ResetIdentifier(void);
125 
126  /// Get the Identifier member data.
127  ///
128  /// @return
129  /// Reference to the member data.
130  const TIdentifier& GetIdentifier(void) const;
131 
132  /// Assign a value to Identifier data member.
133  ///
134  /// @param value
135  /// Value to assign
136  void SetIdentifier(const TIdentifier& value);
138 
139  /// Assign a value to Identifier data member.
140  ///
141  /// @return
142  /// Reference to the data value.
143  TIdentifier& SetIdentifier(void);
144 
145  /// Check if a value has been assigned to Type data member.
146  ///
147  /// Data member Type is mandatory;
148  /// its type is defined as 'typedef int TType'
149  /// @return
150  /// - true, if a value has been assigned.
151  /// - false, otherwise.
152  bool IsSetType(void) const;
153 
154  /// Check if it is safe to call GetType method.
155  ///
156  /// @return
157  /// - true, if the data member is getatable.
158  /// - false, otherwise.
159  bool CanGetType(void) const;
160 
161  /// Reset Type data member.
162  void ResetType(void);
163 
164  /// Get the Type member data.
165  ///
166  /// @return
167  /// Copy of the member data.
168  TType GetType(void) const;
169 
170  /// Assign a value to Type data member.
171  ///
172  /// @param value
173  /// Value to assign
174  void SetType(TType value);
175 
176  /// Assign a value to Type data member.
177  ///
178  /// @return
179  /// Reference to the data value.
180  TType& SetType(void);
181 
182  /// Check if a value has been assigned to Int data member.
183  ///
184  /// Data member Int is mandatory;
185  /// its type is defined as 'typedef CSeqInterval TInt'
186  /// @return
187  /// - true, if a value has been assigned.
188  /// - false, otherwise.
189  bool IsSetInt(void) const;
190 
191  /// Check if it is safe to call GetInt method.
192  ///
193  /// @return
194  /// - true, if the data member is getatable.
195  /// - false, otherwise.
196  bool CanGetInt(void) const;
197 
198  /// Reset Int data member.
199  void ResetInt(void);
200 
201  /// Get the Int member data.
202  ///
203  /// @return
204  /// Reference to the member data.
205  const TInt& GetInt(void) const;
206 
207  /// Assign a value to Int data member.
208  ///
209  /// @param value
210  /// Reference to value.
211  void SetInt(TInt& value);
212 
213  /// Assign a value to Int data member.
214  ///
215  /// @return
216  /// Reference to the data value.
217  TInt& SetInt(void);
218 
219  /// Reset the whole object
220  virtual void Reset(void);
221 
222 
223 private:
224  // Prohibit copy constructor and assignment operator
227 
228  // data
230  string m_Identifier;
231  int m_Type;
233 };
234 
235 /* @} */
236 
237 
238 
239 
240 
241 ///////////////////////////////////////////////////////////
242 ///////////////////// inline methods //////////////////////
243 ///////////////////////////////////////////////////////////
244 inline
246 {
247  return ((m_set_State[0] & 0x3) != 0);
248 }
249 
250 inline
252 {
253  return IsSetIdentifier();
254 }
255 
256 inline
258 {
259  if (!CanGetIdentifier()) {
260  ThrowUnassigned(0);
261  }
262  return m_Identifier;
263 }
264 
265 inline
267 {
269  m_set_State[0] |= 0x3;
270 }
271 
272 inline
274 {
275  m_Identifier = std::forward<CSubsequence_Base::TIdentifier>(value);
276  m_set_State[0] |= 0x3;
277 }
278 
279 inline
281 {
282 #ifdef _DEBUG
283  if (!IsSetIdentifier()) {
285  }
286 #endif
287  m_set_State[0] |= 0x1;
288  return m_Identifier;
289 }
290 
291 inline
293 {
294  return ((m_set_State[0] & 0xc) != 0);
295 }
296 
297 inline
299 {
300  return IsSetType();
301 }
302 
303 inline
305 {
306  m_Type = (int)(0);
307  m_set_State[0] &= ~0xc;
308 }
309 
310 inline
312 {
313  if (!CanGetType()) {
314  ThrowUnassigned(1);
315  }
316  return m_Type;
317 }
318 
319 inline
321 {
322  m_Type = value;
323  m_set_State[0] |= 0xc;
324 }
325 
326 inline
328 {
329 #ifdef _DEBUG
330  if (!IsSetType()) {
331  memset(&m_Type,UnassignedByte(),sizeof(m_Type));
332  }
333 #endif
334  m_set_State[0] |= 0x4;
335  return m_Type;
336 }
337 
338 inline
340 {
341  return m_Int.NotEmpty();
342 }
343 
344 inline
346 {
347  return true;
348 }
349 
350 inline
352 {
353  if ( !m_Int ) {
354  const_cast<CSubsequence_Base*>(this)->ResetInt();
355  }
356  return (*m_Int);
357 }
358 
359 inline
361 {
362  if ( !m_Int ) {
363  ResetInt();
364  }
365  return (*m_Int);
366 }
367 
368 ///////////////////////////////////////////////////////////
369 ////////////////// end of inline methods //////////////////
370 ///////////////////////////////////////////////////////////
371 
372 
373 
374 
375 
376 END_objects_SCOPE // namespace ncbi::objects::
377 
379 
380 
381 #endif // OBJECTS_VARREP_SUBSEQUENCE_BASE_HPP
User-defined methods of the data storage class.
CRef –.
Definition: ncbiobj.hpp:618
CSeqInterval –.
Definition: SeqInterval.hpp:66
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSubsequence_Base –.
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
void ResetType(void)
Reset Type data member.
CSubsequence_Base(const CSubsequence_Base &)
TType GetType(void) const
Get the Type member data.
CRef< TInt > m_Int
TIdentifier & SetIdentifier(void)
Assign a value to Identifier data member.
TType & SetType(void)
Assign a value to Type data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
virtual ~CSubsequence_Base(void)
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
bool IsSetIdentifier(void) const
For example, an accession id Check if a value has been assigned to Identifier data member.
virtual void Reset(void)
Reset the whole object.
bool IsSetInt(void) const
Check if a value has been assigned to Int data member.
bool CanGetInt(void) const
Check if it is safe to call GetInt method.
bool CanGetIdentifier(void) const
Check if it is safe to call GetIdentifier method.
CSubsequence_Base & operator=(const CSubsequence_Base &)
TInt & SetInt(void)
Assign a value to Int data member.
CSerialObject Tparent
const TInt & GetInt(void) const
Get the Int member data.
CSeqInterval TInt
const TIdentifier & GetIdentifier(void) const
Get the Identifier member data.
void ResetIdentifier(void)
Reset Identifier data member.
void ResetInt(void)
Reset Int data member.
bool CanGetType(void) const
Check if it is safe to call GetType method.
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Jun 19 16:59:28 2024 by modify_doxy.py rev. 669887