NCBI C++ ToolKit
Scaled_int_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_int_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_INT_MULTI_DATA_BASE_HPP
42 #define OBJECTS_SEQTABLE_SCALED_INT_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_int_multi_data_Base --
70 ///
71 
73 {
75 public:
76  // constructor
78  // destructor
79  virtual ~CScaled_int_multi_data_Base(void);
80 
81  // type info
83 
84  // types
85  typedef int TMul;
86  typedef int TAdd;
88  typedef Int8 TMin;
89  typedef Int8 TMax;
90 
91  // member index
92  enum class E_memberIndex {
93  e__allMandatory = 0,
94  e_mul,
95  e_add,
96  e_data,
97  e_min,
98  e_max
99  };
101 
102  // getters
103  // setters
104 
105  /// output data[i] = data[i]*mul+add
106  /// Check if a value has been assigned to Mul data member.
107  ///
108  /// Data member Mul is mandatory;
109  /// its type is defined as 'typedef int TMul'
110  /// @return
111  /// - true, if a value has been assigned.
112  /// - false, otherwise.
113  bool IsSetMul(void) const;
114 
115  /// Check if it is safe to call GetMul method.
116  ///
117  /// @return
118  /// - true, if the data member is getatable.
119  /// - false, otherwise.
120  bool CanGetMul(void) const;
121 
122  /// Reset Mul data member.
123  void ResetMul(void);
124 
125  /// Get the Mul member data.
126  ///
127  /// @return
128  /// Copy of the member data.
129  TMul GetMul(void) const;
130 
131  /// Assign a value to Mul data member.
132  ///
133  /// @param value
134  /// Value to assign
135  void SetMul(TMul value);
136 
137  /// Assign a value to Mul data member.
138  ///
139  /// @return
140  /// Reference to the data value.
141  TMul& SetMul(void);
142 
143  /// Check if a value has been assigned to Add data member.
144  ///
145  /// Data member Add is mandatory;
146  /// its type is defined as 'typedef int TAdd'
147  /// @return
148  /// - true, if a value has been assigned.
149  /// - false, otherwise.
150  bool IsSetAdd(void) const;
151 
152  /// Check if it is safe to call GetAdd method.
153  ///
154  /// @return
155  /// - true, if the data member is getatable.
156  /// - false, otherwise.
157  bool CanGetAdd(void) const;
158 
159  /// Reset Add data member.
160  void ResetAdd(void);
161 
162  /// Get the Add member data.
163  ///
164  /// @return
165  /// Copy of the member data.
166  TAdd GetAdd(void) const;
167 
168  /// Assign a value to Add data member.
169  ///
170  /// @param value
171  /// Value to assign
172  void SetAdd(TAdd value);
173 
174  /// Assign a value to Add data member.
175  ///
176  /// @return
177  /// Reference to the data value.
178  TAdd& SetAdd(void);
179 
180  /// Check if a value has been assigned to Data data member.
181  ///
182  /// Data member Data is mandatory;
183  /// its type is defined as 'typedef CSeqTable_multi_data TData'
184  /// @return
185  /// - true, if a value has been assigned.
186  /// - false, otherwise.
187  bool IsSetData(void) const;
188 
189  /// Check if it is safe to call GetData method.
190  ///
191  /// @return
192  /// - true, if the data member is getatable.
193  /// - false, otherwise.
194  bool CanGetData(void) const;
195 
196  /// Reset Data data member.
197  void ResetData(void);
198 
199  /// Get the Data member data.
200  ///
201  /// @return
202  /// Reference to the member data.
203  const TData& GetData(void) const;
204 
205  /// Assign a value to Data data member.
206  ///
207  /// @param value
208  /// Reference to value.
209  void SetData(TData& value);
210 
211  /// Assign a value to Data data member.
212  ///
213  /// @return
214  /// Reference to the data value.
215  TData& SetData(void);
216 
217  /// min/max scaled value
218  /// should be set if scaled values may not fit in 32-bit signed integer
219  /// Check if a value has been assigned to Min data member.
220  ///
221  /// Data member Min is optional;
222  /// its type is defined as 'typedef Int8 TMin'
223  /// @return
224  /// - true, if a value has been assigned.
225  /// - false, otherwise.
226  bool IsSetMin(void) const;
227 
228  /// Check if it is safe to call GetMin method.
229  ///
230  /// @return
231  /// - true, if the data member is getatable.
232  /// - false, otherwise.
233  bool CanGetMin(void) const;
234 
235  /// Reset Min data member.
236  void ResetMin(void);
237 
238  /// Get the Min member data.
239  ///
240  /// @return
241  /// Copy of the member data.
242  TMin GetMin(void) const;
243 
244  /// Assign a value to Min data member.
245  ///
246  /// @param value
247  /// Value to assign
248  void SetMin(TMin value);
249 
250  /// Assign a value to Min data member.
251  ///
252  /// @return
253  /// Reference to the data value.
254  TMin& SetMin(void);
255 
256  /// Check if a value has been assigned to Max data member.
257  ///
258  /// Data member Max is optional;
259  /// its type is defined as 'typedef Int8 TMax'
260  /// @return
261  /// - true, if a value has been assigned.
262  /// - false, otherwise.
263  bool IsSetMax(void) const;
264 
265  /// Check if it is safe to call GetMax method.
266  ///
267  /// @return
268  /// - true, if the data member is getatable.
269  /// - false, otherwise.
270  bool CanGetMax(void) const;
271 
272  /// Reset Max data member.
273  void ResetMax(void);
274 
275  /// Get the Max member data.
276  ///
277  /// @return
278  /// Copy of the member data.
279  TMax GetMax(void) const;
280 
281  /// Assign a value to Max data member.
282  ///
283  /// @param value
284  /// Value to assign
285  void SetMax(TMax value);
286 
287  /// Assign a value to Max data member.
288  ///
289  /// @return
290  /// Reference to the data value.
291  TMax& SetMax(void);
292 
293  /// Reset the whole object
294  virtual void Reset(void);
295 
296 
297 private:
298  // Prohibit copy constructor and assignment operator
301 
302  // data
303  Uint4 m_set_State[1];
304  int m_Mul;
305  int m_Add;
309 };
310 
311 /* @} */
312 
313 
314 
315 
316 
317 ///////////////////////////////////////////////////////////
318 ///////////////////// inline methods //////////////////////
319 ///////////////////////////////////////////////////////////
320 inline
322 {
323  return ((m_set_State[0] & 0x3) != 0);
324 }
325 
326 inline
328 {
329  return IsSetMul();
330 }
331 
332 inline
334 {
335  m_Mul = 0;
336  m_set_State[0] &= ~0x3;
337 }
338 
339 inline
341 {
342  if (!CanGetMul()) {
343  ThrowUnassigned(0);
344  }
345  return m_Mul;
346 }
347 
348 inline
350 {
351  m_Mul = value;
352  m_set_State[0] |= 0x3;
353 }
354 
355 inline
357 {
358 #ifdef _DEBUG
359  if (!IsSetMul()) {
360  memset(&m_Mul,UnassignedByte(),sizeof(m_Mul));
361  }
362 #endif
363  m_set_State[0] |= 0x1;
364  return m_Mul;
365 }
366 
367 inline
369 {
370  return ((m_set_State[0] & 0xc) != 0);
371 }
372 
373 inline
375 {
376  return IsSetAdd();
377 }
378 
379 inline
381 {
382  m_Add = 0;
383  m_set_State[0] &= ~0xc;
384 }
385 
386 inline
388 {
389  if (!CanGetAdd()) {
390  ThrowUnassigned(1);
391  }
392  return m_Add;
393 }
394 
395 inline
397 {
398  m_Add = value;
399  m_set_State[0] |= 0xc;
400 }
401 
402 inline
404 {
405 #ifdef _DEBUG
406  if (!IsSetAdd()) {
407  memset(&m_Add,UnassignedByte(),sizeof(m_Add));
408  }
409 #endif
410  m_set_State[0] |= 0x4;
411  return m_Add;
412 }
413 
414 inline
416 {
417  return m_Data.NotEmpty();
418 }
419 
420 inline
422 {
423  return true;
424 }
425 
426 inline
428 {
429  if ( !m_Data ) {
430  const_cast<CScaled_int_multi_data_Base*>(this)->ResetData();
431  }
432  return (*m_Data);
433 }
434 
435 inline
437 {
438  if ( !m_Data ) {
439  ResetData();
440  }
441  return (*m_Data);
442 }
443 
444 inline
446 {
447  return ((m_set_State[0] & 0xc0) != 0);
448 }
449 
450 inline
452 {
453  return IsSetMin();
454 }
455 
456 inline
458 {
459  m_Min = 0;
460  m_set_State[0] &= ~0xc0;
461 }
462 
463 inline
465 {
466  if (!CanGetMin()) {
467  ThrowUnassigned(3);
468  }
469  return m_Min;
470 }
471 
472 inline
474 {
475  m_Min = value;
476  m_set_State[0] |= 0xc0;
477 }
478 
479 inline
481 {
482 #ifdef _DEBUG
483  if (!IsSetMin()) {
484  memset(&m_Min,UnassignedByte(),sizeof(m_Min));
485  }
486 #endif
487  m_set_State[0] |= 0x40;
488  return m_Min;
489 }
490 
491 inline
493 {
494  return ((m_set_State[0] & 0x300) != 0);
495 }
496 
497 inline
499 {
500  return IsSetMax();
501 }
502 
503 inline
505 {
506  m_Max = 0;
507  m_set_State[0] &= ~0x300;
508 }
509 
510 inline
512 {
513  if (!CanGetMax()) {
514  ThrowUnassigned(4);
515  }
516  return m_Max;
517 }
518 
519 inline
521 {
522  m_Max = value;
523  m_set_State[0] |= 0x300;
524 }
525 
526 inline
528 {
529 #ifdef _DEBUG
530  if (!IsSetMax()) {
531  memset(&m_Max,UnassignedByte(),sizeof(m_Max));
532  }
533 #endif
534  m_set_State[0] |= 0x100;
535  return m_Max;
536 }
537 
538 ///////////////////////////////////////////////////////////
539 ////////////////// end of inline methods //////////////////
540 ///////////////////////////////////////////////////////////
541 
542 
543 
544 
545 
546 END_objects_SCOPE // namespace ncbi::objects::
547 
549 
550 
551 #endif // OBJECTS_SEQTABLE_SCALED_INT_MULTI_DATA_BASE_HPP
CScaled_int_multi_data_Base –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
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
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#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
bool IsSetAdd(void) const
Check if a value has been assigned to Add data member.
TMul & SetMul(void)
Assign a value to Mul data member.
TAdd GetAdd(void) const
Get the Add member data.
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
TMax & SetMax(void)
Assign a value to Max data member.
void ResetMax(void)
Reset Max data member.
bool IsSetMax(void) const
Check if a value has been assigned to Max data member.
bool CanGetMax(void) const
Check if it is safe to call GetMax method.
bool CanGetMul(void) const
Check if it is safe to call GetMul method.
TMul GetMul(void) const
Get the Mul member data.
bool CanGetAdd(void) const
Check if it is safe to call GetAdd method.
TMax GetMax(void) const
Get the Max member data.
bool CanGetData(void) const
Check if it is safe to call GetData method.
void ResetMin(void)
Reset Min data member.
CScaled_int_multi_data_Base & operator=(const CScaled_int_multi_data_Base &)
bool IsSetMul(void) const
output data[i] = data[i]*mul+add Check if a value has been assigned to Mul data member.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
bool IsSetMin(void) const
min/max scaled value should be set if scaled values may not fit in 32-bit signed integer Check if a v...
TAdd & SetAdd(void)
Assign a value to Add data member.
const TData & GetData(void) const
Get the Data member data.
void ResetData(void)
Reset Data data member.
TMin GetMin(void) const
Get the Min member data.
CScaled_int_multi_data_Base(const CScaled_int_multi_data_Base &)
bool CanGetMin(void) const
Check if it is safe to call GetMin method.
TData & SetData(void)
Assign a value to Data data member.
void ResetMul(void)
Reset Mul data member.
void ResetAdd(void)
Reset Add data member.
TMin & SetMin(void)
Assign a value to Min data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Apr 17 13:08:37 2024 by modify_doxy.py rev. 669887