NCBI C++ ToolKit
Num_real_.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 Num_real_.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_NUM_REAL_BASE_HPP
42 #define OBJECTS_SEQ_NUM_REAL_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_Sequence
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// mapping to floating point system
69 ///
70 /// CNum_real_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CNum_real_Base(void);
79  // destructor
80  virtual ~CNum_real_Base(void);
81 
82  // type info
84 
85  // types
86  typedef double TA;
87  typedef double TB;
88  typedef string TUnits;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_a,
94  e_b,
95  e_units
96  };
98 
99  // getters
100  // setters
101 
102  /// from an integer system used by Bioseq
103  /// Check if a value has been assigned to A data member.
104  ///
105  /// Data member A is mandatory;
106  /// its type is defined as 'typedef double TA'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetA(void) const;
111 
112  /// Check if it is safe to call GetA method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetA(void) const;
118 
119  /// Reset A data member.
120  void ResetA(void);
121 
122  /// Get the A member data.
123  ///
124  /// @return
125  /// Copy of the member data.
126  TA GetA(void) const;
127 
128  /// Assign a value to A data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetA(TA value);
133 
134  /// Assign a value to A data member.
135  ///
136  /// @return
137  /// Reference to the data value.
138  TA& SetA(void);
139 
140  /// position = (a * int_position) + b
141  /// Check if a value has been assigned to B data member.
142  ///
143  /// Data member B is mandatory;
144  /// its type is defined as 'typedef double TB'
145  /// @return
146  /// - true, if a value has been assigned.
147  /// - false, otherwise.
148  bool IsSetB(void) const;
149 
150  /// Check if it is safe to call GetB method.
151  ///
152  /// @return
153  /// - true, if the data member is getatable.
154  /// - false, otherwise.
155  bool CanGetB(void) const;
156 
157  /// Reset B data member.
158  void ResetB(void);
159 
160  /// Get the B member data.
161  ///
162  /// @return
163  /// Copy of the member data.
164  TB GetB(void) const;
165 
166  /// Assign a value to B data member.
167  ///
168  /// @param value
169  /// Value to assign
170  void SetB(TB value);
171 
172  /// Assign a value to B data member.
173  ///
174  /// @return
175  /// Reference to the data value.
176  TB& SetB(void);
177 
178  /// Check if a value has been assigned to Units data member.
179  ///
180  /// Data member Units is optional;
181  /// its type is defined as 'typedef string TUnits'
182  /// @return
183  /// - true, if a value has been assigned.
184  /// - false, otherwise.
185  bool IsSetUnits(void) const;
186 
187  /// Check if it is safe to call GetUnits method.
188  ///
189  /// @return
190  /// - true, if the data member is getatable.
191  /// - false, otherwise.
192  bool CanGetUnits(void) const;
193 
194  /// Reset Units data member.
195  void ResetUnits(void);
196 
197  /// Get the Units member data.
198  ///
199  /// @return
200  /// Reference to the member data.
201  const TUnits& GetUnits(void) const;
202 
203  /// Assign a value to Units data member.
204  ///
205  /// @param value
206  /// Value to assign
207  void SetUnits(const TUnits& value);
208  void SetUnits(TUnits&& value);
209 
210  /// Assign a value to Units data member.
211  ///
212  /// @return
213  /// Reference to the data value.
214  TUnits& SetUnits(void);
215 
216  /// Reset the whole object
217  virtual void Reset(void);
218 
219 
220 private:
221  // Prohibit copy constructor and assignment operator
224 
225  // data
226  Uint4 m_set_State[1];
227  double m_A;
228  double m_B;
229  string m_Units;
230 };
231 
232 /* @} */
233 
234 
235 
236 
237 
238 ///////////////////////////////////////////////////////////
239 ///////////////////// inline methods //////////////////////
240 ///////////////////////////////////////////////////////////
241 inline
242 bool CNum_real_Base::IsSetA(void) const
243 {
244  return ((m_set_State[0] & 0x3) != 0);
245 }
246 
247 inline
248 bool CNum_real_Base::CanGetA(void) const
249 {
250  return IsSetA();
251 }
252 
253 inline
255 {
256  m_A = 0;
257  m_set_State[0] &= ~0x3;
258 }
259 
260 inline
262 {
263  if (!CanGetA()) {
264  ThrowUnassigned(0);
265  }
266  return m_A;
267 }
268 
269 inline
271 {
272  m_A = value;
273  m_set_State[0] |= 0x3;
274 }
275 
276 inline
278 {
279 #ifdef _DEBUG
280  if (!IsSetA()) {
281  memset(&m_A,UnassignedByte(),sizeof(m_A));
282  }
283 #endif
284  m_set_State[0] |= 0x1;
285  return m_A;
286 }
287 
288 inline
289 bool CNum_real_Base::IsSetB(void) const
290 {
291  return ((m_set_State[0] & 0xc) != 0);
292 }
293 
294 inline
295 bool CNum_real_Base::CanGetB(void) const
296 {
297  return IsSetB();
298 }
299 
300 inline
302 {
303  m_B = 0;
304  m_set_State[0] &= ~0xc;
305 }
306 
307 inline
309 {
310  if (!CanGetB()) {
311  ThrowUnassigned(1);
312  }
313  return m_B;
314 }
315 
316 inline
318 {
319  m_B = value;
320  m_set_State[0] |= 0xc;
321 }
322 
323 inline
325 {
326 #ifdef _DEBUG
327  if (!IsSetB()) {
328  memset(&m_B,UnassignedByte(),sizeof(m_B));
329  }
330 #endif
331  m_set_State[0] |= 0x4;
332  return m_B;
333 }
334 
335 inline
337 {
338  return ((m_set_State[0] & 0x30) != 0);
339 }
340 
341 inline
343 {
344  return IsSetUnits();
345 }
346 
347 inline
349 {
350  if (!CanGetUnits()) {
351  ThrowUnassigned(2);
352  }
353  return m_Units;
354 }
355 
356 inline
358 {
359  m_Units = value;
360  m_set_State[0] |= 0x30;
361 }
362 
363 inline
365 {
366  m_Units = std::forward<CNum_real_Base::TUnits>(value);
367  m_set_State[0] |= 0x30;
368 }
369 
370 inline
372 {
373 #ifdef _DEBUG
374  if (!IsSetUnits()) {
376  }
377 #endif
378  m_set_State[0] |= 0x10;
379  return m_Units;
380 }
381 
382 ///////////////////////////////////////////////////////////
383 ////////////////// end of inline methods //////////////////
384 ///////////////////////////////////////////////////////////
385 
386 
387 
388 
389 
390 END_objects_SCOPE // namespace ncbi::objects::
391 
393 
394 
395 #endif // OBJECTS_SEQ_NUM_REAL_BASE_HPP
mapping to floating point system
Definition: Num_real_.hpp:74
Base class for all serializable objects.
Definition: serialbase.hpp:150
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_SEQ_EXPORT
Definition: ncbi_export.h:825
CNum_real_Base & operator=(const CNum_real_Base &)
void ResetB(void)
Reset B data member.
Definition: Num_real_.hpp:301
TB & SetB(void)
Assign a value to B data member.
Definition: Num_real_.hpp:324
TB GetB(void) const
Get the B member data.
Definition: Num_real_.hpp:308
bool CanGetUnits(void) const
Check if it is safe to call GetUnits method.
Definition: Num_real_.hpp:342
bool IsSetA(void) const
from an integer system used by Bioseq Check if a value has been assigned to A data member.
Definition: Num_real_.hpp:242
TA GetA(void) const
Get the A member data.
Definition: Num_real_.hpp:261
TA & SetA(void)
Assign a value to A data member.
Definition: Num_real_.hpp:277
CNum_real_Base(const CNum_real_Base &)
bool CanGetA(void) const
Check if it is safe to call GetA method.
Definition: Num_real_.hpp:248
const TUnits & GetUnits(void) const
Get the Units member data.
Definition: Num_real_.hpp:348
TUnits & SetUnits(void)
Assign a value to Units data member.
Definition: Num_real_.hpp:371
Uint4 m_set_State[1]
Definition: Num_real_.hpp:226
void ResetA(void)
Reset A data member.
Definition: Num_real_.hpp:254
bool CanGetB(void) const
Check if it is safe to call GetB method.
Definition: Num_real_.hpp:295
bool IsSetUnits(void) const
Check if a value has been assigned to Units data member.
Definition: Num_real_.hpp:336
CSerialObject Tparent
Definition: Num_real_.hpp:75
bool IsSetB(void) const
position = (a * int_position) + b Check if a value has been assigned to B data member.
Definition: Num_real_.hpp:289
DECLARE_INTERNAL_TYPE_INFO()
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: Num_real_.hpp:97
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:58:10 2024 by modify_doxy.py rev. 669887