NCBI C++ ToolKit
BVector_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 BVector_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_BVECTOR_DATA_BASE_HPP
42 #define OBJECTS_SEQTABLE_BVECTOR_DATA_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <vector>
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_SeqTable
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 /// Class for serializing bm::bvector<>
69 /// see include/util/bitset/bm.h
70 /// Since bvector<> serialization doesn't keep size we have to add it explicitly
71 ///
72 /// CBVector_data_Base --
73 ///
74 
76 {
78 public:
79  // constructor
80  CBVector_data_Base(void);
81  // destructor
82  virtual ~CBVector_data_Base(void);
83 
84  // type info
86 
87  // types
88  typedef unsigned TSize;
89  typedef vector< char > TData;
90 
91  // member index
92  enum class E_memberIndex {
93  e__allMandatory = 0,
94  e_size,
95  e_data
96  };
98 
99  // getters
100  // setters
101 
102  /// Check if a value has been assigned to Size data member.
103  ///
104  /// Data member Size is mandatory;
105  /// its type is defined as 'typedef unsigned TSize'
106  /// @return
107  /// - true, if a value has been assigned.
108  /// - false, otherwise.
109  bool IsSetSize(void) const;
110 
111  /// Check if it is safe to call GetSize method.
112  ///
113  /// @return
114  /// - true, if the data member is getatable.
115  /// - false, otherwise.
116  bool CanGetSize(void) const;
117 
118  /// Reset Size data member.
119  void ResetSize(void);
120 
121  /// Get the Size member data.
122  ///
123  /// @return
124  /// Copy of the member data.
125  TSize GetSize(void) const;
126 
127  /// Assign a value to Size data member.
128  ///
129  /// @param value
130  /// Value to assign
131  void SetSize(TSize value);
132 
133  /// Assign a value to Size data member.
134  ///
135  /// @return
136  /// Reference to the data value.
137  TSize& SetSize(void);
138 
139  /// Check if a value has been assigned to Data data member.
140  ///
141  /// Data member Data is mandatory;
142  /// its type is defined as 'typedef vector< char > TData'
143  /// @return
144  /// - true, if a value has been assigned.
145  /// - false, otherwise.
146  bool IsSetData(void) const;
147 
148  /// Check if it is safe to call GetData method.
149  ///
150  /// @return
151  /// - true, if the data member is getatable.
152  /// - false, otherwise.
153  bool CanGetData(void) const;
154 
155  /// Reset Data data member.
156  void ResetData(void);
157 
158  /// Get the Data member data.
159  ///
160  /// @return
161  /// Reference to the member data.
162  const TData& GetData(void) const;
163 
164  /// Assign a value to Data data member.
165  ///
166  /// @return
167  /// Reference to the data value.
168  TData& SetData(void);
169 
170  /// Reset the whole object
171  virtual void Reset(void);
172 
173 
174 private:
175  // Prohibit copy constructor and assignment operator
178 
179  // data
180  Uint4 m_set_State[1];
181  unsigned m_Size;
182  vector< char > m_Data;
183 };
184 
185 /* @} */
186 
187 
188 
189 
190 
191 ///////////////////////////////////////////////////////////
192 ///////////////////// inline methods //////////////////////
193 ///////////////////////////////////////////////////////////
194 inline
196 {
197  return ((m_set_State[0] & 0x3) != 0);
198 }
199 
200 inline
202 {
203  return IsSetSize();
204 }
205 
206 inline
208 {
209  m_Size = 0;
210  m_set_State[0] &= ~0x3;
211 }
212 
213 inline
215 {
216  if (!CanGetSize()) {
217  ThrowUnassigned(0);
218  }
219  return m_Size;
220 }
221 
222 inline
224 {
225  m_Size = value;
226  m_set_State[0] |= 0x3;
227 }
228 
229 inline
231 {
232 #ifdef _DEBUG
233  if (!IsSetSize()) {
234  memset(&m_Size,UnassignedByte(),sizeof(m_Size));
235  }
236 #endif
237  m_set_State[0] |= 0x1;
238  return m_Size;
239 }
240 
241 inline
243 {
244  return ((m_set_State[0] & 0xc) != 0);
245 }
246 
247 inline
249 {
250  return IsSetData();
251 }
252 
253 inline
255 {
256  if (!CanGetData()) {
257  ThrowUnassigned(1);
258  }
259  return m_Data;
260 }
261 
262 inline
264 {
265  m_set_State[0] |= 0x4;
266  return m_Data;
267 }
268 
269 ///////////////////////////////////////////////////////////
270 ////////////////// end of inline methods //////////////////
271 ///////////////////////////////////////////////////////////
272 
273 
274 
275 
276 
277 END_objects_SCOPE // namespace ncbi::objects::
278 
280 
281 
282 #endif // OBJECTS_SEQTABLE_BVECTOR_DATA_BASE_HPP
Class for serializing bm::bvector<> see include/util/bitset/bm.h Since bvector<> serialization doesn'...
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
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
bool CanGetSize(void) const
Check if it is safe to call GetSize method.
void ResetSize(void)
Reset Size data member.
bool CanGetData(void) const
Check if it is safe to call GetData method.
TSize & SetSize(void)
Assign a value to Size data member.
CBVector_data_Base(const CBVector_data_Base &)
const TData & GetData(void) const
Get the Data member data.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
vector< char > m_Data
vector< char > TData
bool IsSetSize(void) const
Check if a value has been assigned to Size data member.
TData & SetData(void)
Assign a value to Data data member.
CSerialObject Tparent
TSize GetSize(void) const
Get the Size member data.
CBVector_data_Base & operator=(const CBVector_data_Base &)
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Apr 24 14:19:30 2024 by modify_doxy.py rev. 669887