NCBI C++ ToolKit
Scaled_real_multi_data_.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 Scaled_real_multi_data_.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/seqtable/seqtable.asn">seqtable.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqtable/seqtable.def">seqtable.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_SEQTABLE_SCALED_REAL_MULTI_DATA_BASE_HPP
42 #define OBJECTS_SEQTABLE_SCALED_REAL_MULTI_DATA_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
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_SeqTable
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CScaled_real_multi_data_Base --
70 ///
71 
73 {
75 public:
76  // constructor
78  // destructor
79  virtual ~CScaled_real_multi_data_Base(void);
80 
81  // type info
83 
84  // types
85  typedef double TMul;
86  typedef double TAdd;
88 
89  // member index
90  enum class E_memberIndex {
91  e__allMandatory = 0,
92  e_mul,
93  e_add,
94  e_data
95  };
97 
98  // getters
99  // setters
100 
101  /// output data[i] = data[i]*mul+add
102  /// Check if a value has been assigned to Mul data member.
103  ///
104  /// Data member Mul is mandatory;
105  /// its type is defined as 'typedef double TMul'
106  /// @return
107  /// - true, if a value has been assigned.
108  /// - false, otherwise.
109  bool IsSetMul(void) const;
110 
111  /// Check if it is safe to call GetMul method.
112  ///
113  /// @return
114  /// - true, if the data member is getatable.
115  /// - false, otherwise.
116  bool CanGetMul(void) const;
117 
118  /// Reset Mul data member.
119  void ResetMul(void);
120 
121  /// Get the Mul member data.
122  ///
123  /// @return
124  /// Copy of the member data.
125  TMul GetMul(void) const;
126 
127  /// Assign a value to Mul data member.
128  ///
129  /// @param value
130  /// Value to assign
131  void SetMul(TMul value);
132 
133  /// Assign a value to Mul data member.
134  ///
135  /// @return
136  /// Reference to the data value.
137  TMul& SetMul(void);
138 
139  /// Check if a value has been assigned to Add data member.
140  ///
141  /// Data member Add is mandatory;
142  /// its type is defined as 'typedef double TAdd'
143  /// @return
144  /// - true, if a value has been assigned.
145  /// - false, otherwise.
146  bool IsSetAdd(void) const;
147 
148  /// Check if it is safe to call GetAdd method.
149  ///
150  /// @return
151  /// - true, if the data member is getatable.
152  /// - false, otherwise.
153  bool CanGetAdd(void) const;
154 
155  /// Reset Add data member.
156  void ResetAdd(void);
157 
158  /// Get the Add member data.
159  ///
160  /// @return
161  /// Copy of the member data.
162  TAdd GetAdd(void) const;
163 
164  /// Assign a value to Add data member.
165  ///
166  /// @param value
167  /// Value to assign
168  void SetAdd(TAdd value);
169 
170  /// Assign a value to Add data member.
171  ///
172  /// @return
173  /// Reference to the data value.
174  TAdd& SetAdd(void);
175 
176  /// Check if a value has been assigned to Data data member.
177  ///
178  /// Data member Data is mandatory;
179  /// its type is defined as 'typedef CSeqTable_multi_data TData'
180  /// @return
181  /// - true, if a value has been assigned.
182  /// - false, otherwise.
183  bool IsSetData(void) const;
184 
185  /// Check if it is safe to call GetData method.
186  ///
187  /// @return
188  /// - true, if the data member is getatable.
189  /// - false, otherwise.
190  bool CanGetData(void) const;
191 
192  /// Reset Data data member.
193  void ResetData(void);
194 
195  /// Get the Data member data.
196  ///
197  /// @return
198  /// Reference to the member data.
199  const TData& GetData(void) const;
200 
201  /// Assign a value to Data data member.
202  ///
203  /// @param value
204  /// Reference to value.
205  void SetData(TData& value);
206 
207  /// Assign a value to Data data member.
208  ///
209  /// @return
210  /// Reference to the data value.
211  TData& SetData(void);
212 
213  /// Reset the whole object
214  virtual void Reset(void);
215 
216 
217 private:
218  // Prohibit copy constructor and assignment operator
221 
222  // data
223  Uint4 m_set_State[1];
224  double m_Mul;
225  double m_Add;
227 };
228 
229 /* @} */
230 
231 
232 
233 
234 
235 ///////////////////////////////////////////////////////////
236 ///////////////////// inline methods //////////////////////
237 ///////////////////////////////////////////////////////////
238 inline
240 {
241  return ((m_set_State[0] & 0x3) != 0);
242 }
243 
244 inline
246 {
247  return IsSetMul();
248 }
249 
250 inline
252 {
253  m_Mul = 0;
254  m_set_State[0] &= ~0x3;
255 }
256 
257 inline
259 {
260  if (!CanGetMul()) {
261  ThrowUnassigned(0);
262  }
263  return m_Mul;
264 }
265 
266 inline
268 {
269  m_Mul = value;
270  m_set_State[0] |= 0x3;
271 }
272 
273 inline
275 {
276 #ifdef _DEBUG
277  if (!IsSetMul()) {
278  memset(&m_Mul,UnassignedByte(),sizeof(m_Mul));
279  }
280 #endif
281  m_set_State[0] |= 0x1;
282  return m_Mul;
283 }
284 
285 inline
287 {
288  return ((m_set_State[0] & 0xc) != 0);
289 }
290 
291 inline
293 {
294  return IsSetAdd();
295 }
296 
297 inline
299 {
300  m_Add = 0;
301  m_set_State[0] &= ~0xc;
302 }
303 
304 inline
306 {
307  if (!CanGetAdd()) {
308  ThrowUnassigned(1);
309  }
310  return m_Add;
311 }
312 
313 inline
315 {
316  m_Add = value;
317  m_set_State[0] |= 0xc;
318 }
319 
320 inline
322 {
323 #ifdef _DEBUG
324  if (!IsSetAdd()) {
325  memset(&m_Add,UnassignedByte(),sizeof(m_Add));
326  }
327 #endif
328  m_set_State[0] |= 0x4;
329  return m_Add;
330 }
331 
332 inline
334 {
335  return m_Data.NotEmpty();
336 }
337 
338 inline
340 {
341  return true;
342 }
343 
344 inline
346 {
347  if ( !m_Data ) {
348  const_cast<CScaled_real_multi_data_Base*>(this)->ResetData();
349  }
350  return (*m_Data);
351 }
352 
353 inline
355 {
356  if ( !m_Data ) {
357  ResetData();
358  }
359  return (*m_Data);
360 }
361 
362 ///////////////////////////////////////////////////////////
363 ////////////////// end of inline methods //////////////////
364 ///////////////////////////////////////////////////////////
365 
366 
367 
368 
369 
370 END_objects_SCOPE // namespace ncbi::objects::
371 
373 
374 
375 #endif // OBJECTS_SEQTABLE_SCALED_REAL_MULTI_DATA_BASE_HPP
CScaled_real_multi_data_Base –.
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
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
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:816
const TData & GetData(void) const
Get the Data member data.
TData & SetData(void)
Assign a value to Data data member.
void ResetMul(void)
Reset Mul data member.
CScaled_real_multi_data_Base & operator=(const CScaled_real_multi_data_Base &)
TMul & SetMul(void)
Assign a value to Mul data member.
bool IsSetAdd(void) const
Check if a value has been assigned to Add data member.
void ResetAdd(void)
Reset Add data member.
void ResetData(void)
Reset Data data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
CScaled_real_multi_data_Base(const CScaled_real_multi_data_Base &)
bool CanGetMul(void) const
Check if it is safe to call GetMul method.
TAdd GetAdd(void) const
Get the Add member data.
bool IsSetMul(void) const
output data[i] = data[i]*mul+add Check if a value has been assigned to Mul data member.
bool CanGetAdd(void) const
Check if it is safe to call GetAdd method.
TAdd & SetAdd(void)
Assign a value to Add data member.
TMul GetMul(void) const
Get the Mul member data.
bool CanGetData(void) const
Check if it is safe to call GetData method.
Modified on Thu Sep 21 03:46:35 2023 by modify_doxy.py rev. 669887