NCBI C++ ToolKit
Cache_blob_.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 Cache_blob_.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/objtools/data_loaders/asn_cache/cache_blob.asn">cache_blob.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objtools/data_loaders/asn_cache/cache_blob.def">cache_blob.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 OBJTOOLS_DATA_LOADERS_ASN_CACHE_CACHE_BLOB_BASE_HPP
42 #define OBJTOOLS_DATA_LOADERS_ASN_CACHE_CACHE_BLOB_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_ASN_Cache
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CCache_blob_Base --
70 ///
71 
73 {
75 public:
76  // constructor
77  CCache_blob_Base(void);
78  // destructor
79  virtual ~CCache_blob_Base(void);
80 
81  // type info
83 
84  // types
85  typedef int TMagic;
86  typedef int TTimestamp;
87  typedef vector< char > TBlob;
88  typedef vector< char > TMd5_digest;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_magic,
95  e_blob,
97  };
99 
100  // getters
101  // setters
102 
103  /// Check if a value has been assigned to Magic data member.
104  ///
105  /// Data member Magic is mandatory;
106  /// its type is defined as 'typedef int TMagic'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetMagic(void) const;
111 
112  /// Check if it is safe to call GetMagic method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetMagic(void) const;
118 
119  /// Reset Magic data member.
120  void ResetMagic(void);
121 
122  /// Get the Magic member data.
123  ///
124  /// @return
125  /// Copy of the member data.
126  TMagic GetMagic(void) const;
127 
128  /// Assign a value to Magic data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetMagic(TMagic value);
133 
134  /// Assign a value to Magic data member.
135  ///
136  /// @return
137  /// Reference to the data value.
138  TMagic& SetMagic(void);
139 
140  /// Check if a value has been assigned to Timestamp data member.
141  ///
142  /// Data member Timestamp is mandatory;
143  /// its type is defined as 'typedef int TTimestamp'
144  /// @return
145  /// - true, if a value has been assigned.
146  /// - false, otherwise.
147  bool IsSetTimestamp(void) const;
148 
149  /// Check if it is safe to call GetTimestamp method.
150  ///
151  /// @return
152  /// - true, if the data member is getatable.
153  /// - false, otherwise.
154  bool CanGetTimestamp(void) const;
155 
156  /// Reset Timestamp data member.
157  void ResetTimestamp(void);
158 
159  /// Get the Timestamp member data.
160  ///
161  /// @return
162  /// Copy of the member data.
163  TTimestamp GetTimestamp(void) const;
164 
165  /// Assign a value to Timestamp data member.
166  ///
167  /// @param value
168  /// Value to assign
170 
171  /// Assign a value to Timestamp data member.
172  ///
173  /// @return
174  /// Reference to the data value.
175  TTimestamp& SetTimestamp(void);
176 
177  /// Check if a value has been assigned to Blob data member.
178  ///
179  /// Data member Blob is mandatory;
180  /// its type is defined as 'typedef vector< char > TBlob'
181  /// @return
182  /// - true, if a value has been assigned.
183  /// - false, otherwise.
184  bool IsSetBlob(void) const;
185 
186  /// Check if it is safe to call GetBlob method.
187  ///
188  /// @return
189  /// - true, if the data member is getatable.
190  /// - false, otherwise.
191  bool CanGetBlob(void) const;
192 
193  /// Reset Blob data member.
194  void ResetBlob(void);
195 
196  /// Get the Blob member data.
197  ///
198  /// @return
199  /// Reference to the member data.
200  const TBlob& GetBlob(void) const;
201 
202  /// Assign a value to Blob data member.
203  ///
204  /// @return
205  /// Reference to the data value.
206  TBlob& SetBlob(void);
207 
208  /// Check if a value has been assigned to Md5_digest data member.
209  ///
210  /// Data member Md5_digest is mandatory;
211  /// its type is defined as 'typedef vector< char > TMd5_digest'
212  /// @return
213  /// - true, if a value has been assigned.
214  /// - false, otherwise.
215  bool IsSetMd5_digest(void) const;
216 
217  /// Check if it is safe to call GetMd5_digest method.
218  ///
219  /// @return
220  /// - true, if the data member is getatable.
221  /// - false, otherwise.
222  bool CanGetMd5_digest(void) const;
223 
224  /// Reset Md5_digest data member.
225  void ResetMd5_digest(void);
226 
227  /// Get the Md5_digest member data.
228  ///
229  /// @return
230  /// Reference to the member data.
231  const TMd5_digest& GetMd5_digest(void) const;
232 
233  /// Assign a value to Md5_digest data member.
234  ///
235  /// @return
236  /// Reference to the data value.
237  TMd5_digest& SetMd5_digest(void);
238 
239  /// Reset the whole object
240  virtual void Reset(void);
241 
242 
243 private:
244  // Prohibit copy constructor and assignment operator
247 
248  // data
250  int m_Magic;
252  vector< char > m_Blob;
253  vector< char > m_Md5_digest;
254 };
255 
256 /* @} */
257 
258 
259 
260 
261 
262 ///////////////////////////////////////////////////////////
263 ///////////////////// inline methods //////////////////////
264 ///////////////////////////////////////////////////////////
265 inline
267 {
268  return ((m_set_State[0] & 0x3) != 0);
269 }
270 
271 inline
273 {
274  return IsSetMagic();
275 }
276 
277 inline
279 {
280  m_Magic = 0;
281  m_set_State[0] &= ~0x3;
282 }
283 
284 inline
286 {
287  if (!CanGetMagic()) {
288  ThrowUnassigned(0);
289  }
290  return m_Magic;
291 }
292 
293 inline
295 {
296  m_Magic = value;
297  m_set_State[0] |= 0x3;
298 }
299 
300 inline
302 {
303 #ifdef _DEBUG
304  if (!IsSetMagic()) {
305  memset(&m_Magic,UnassignedByte(),sizeof(m_Magic));
306  }
307 #endif
308  m_set_State[0] |= 0x1;
309  return m_Magic;
310 }
311 
312 inline
314 {
315  return ((m_set_State[0] & 0xc) != 0);
316 }
317 
318 inline
320 {
321  return IsSetTimestamp();
322 }
323 
324 inline
326 {
327  m_Timestamp = 0;
328  m_set_State[0] &= ~0xc;
329 }
330 
331 inline
333 {
334  if (!CanGetTimestamp()) {
335  ThrowUnassigned(1);
336  }
337  return m_Timestamp;
338 }
339 
340 inline
342 {
343  m_Timestamp = value;
344  m_set_State[0] |= 0xc;
345 }
346 
347 inline
349 {
350 #ifdef _DEBUG
351  if (!IsSetTimestamp()) {
352  memset(&m_Timestamp,UnassignedByte(),sizeof(m_Timestamp));
353  }
354 #endif
355  m_set_State[0] |= 0x4;
356  return m_Timestamp;
357 }
358 
359 inline
361 {
362  return ((m_set_State[0] & 0x30) != 0);
363 }
364 
365 inline
367 {
368  return IsSetBlob();
369 }
370 
371 inline
373 {
374  if (!CanGetBlob()) {
375  ThrowUnassigned(2);
376  }
377  return m_Blob;
378 }
379 
380 inline
382 {
383  m_set_State[0] |= 0x10;
384  return m_Blob;
385 }
386 
387 inline
389 {
390  return ((m_set_State[0] & 0xc0) != 0);
391 }
392 
393 inline
395 {
396  return IsSetMd5_digest();
397 }
398 
399 inline
401 {
402  if (!CanGetMd5_digest()) {
403  ThrowUnassigned(3);
404  }
405  return m_Md5_digest;
406 }
407 
408 inline
410 {
411  m_set_State[0] |= 0x40;
412  return m_Md5_digest;
413 }
414 
415 ///////////////////////////////////////////////////////////
416 ////////////////// end of inline methods //////////////////
417 ///////////////////////////////////////////////////////////
418 
419 
420 
421 
422 
423 END_objects_SCOPE // namespace ncbi::objects::
424 
426 
427 
428 #endif // OBJTOOLS_DATA_LOADERS_ASN_CACHE_CACHE_BLOB_BASE_HPP
CCache_blob_Base –.
Definition: Cache_blob_.hpp:73
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
Tparent::CMemberIndex< E_memberIndex, 5 > TmemberIndex
Definition: Cache_blob_.hpp:98
bool IsSetMd5_digest(void) const
Check if a value has been assigned to Md5_digest data member.
bool IsSetTimestamp(void) const
Check if a value has been assigned to Timestamp data member.
vector< char > m_Md5_digest
CSerialObject Tparent
Definition: Cache_blob_.hpp:74
void ResetMd5_digest(void)
Reset Md5_digest data member.
Definition: Cache_blob_.cpp:56
bool CanGetMd5_digest(void) const
Check if it is safe to call GetMd5_digest method.
CCache_blob_Base & operator=(const CCache_blob_Base &)
void ResetMagic(void)
Reset Magic data member.
bool CanGetBlob(void) const
Check if it is safe to call GetBlob method.
vector< char > m_Blob
TBlob & SetBlob(void)
Assign a value to Blob data member.
vector< char > TBlob
Definition: Cache_blob_.hpp:87
Uint4 m_set_State[1]
bool IsSetBlob(void) const
Check if a value has been assigned to Blob data member.
bool CanGetMagic(void) const
Check if it is safe to call GetMagic method.
TTimestamp & SetTimestamp(void)
Assign a value to Timestamp data member.
TMagic & SetMagic(void)
Assign a value to Magic data member.
TTimestamp GetTimestamp(void) const
Get the Timestamp member data.
bool CanGetTimestamp(void) const
Check if it is safe to call GetTimestamp method.
CCache_blob_Base(const CCache_blob_Base &)
virtual ~CCache_blob_Base(void)
Definition: Cache_blob_.cpp:91
bool IsSetMagic(void) const
Check if a value has been assigned to Magic data member.
void ResetTimestamp(void)
Reset Timestamp data member.
TMagic GetMagic(void) const
Get the Magic member data.
void ResetBlob(void)
Reset Blob data member.
Definition: Cache_blob_.cpp:50
vector< char > TMd5_digest
Definition: Cache_blob_.hpp:88
const TMd5_digest & GetMd5_digest(void) const
Get the Md5_digest member data.
TMd5_digest & SetMd5_digest(void)
Assign a value to Md5_digest data member.
const TBlob & GetBlob(void) const
Get the Blob member data.
virtual void Reset(void)
Reset the whole object.
Definition: Cache_blob_.cpp:62
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat Apr 20 12:15:50 2024 by modify_doxy.py rev. 669887