NCBI C++ ToolKit
PC_ID_.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 PC_ID_.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/pcsubstance/pcsubstance.asn">pcsubstance.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/pcsubstance/pcsubstance.def">pcsubstance.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_PCSUBSTANCE_PC_ID_BASE_HPP
42 #define OBJECTS_PCSUBSTANCE_PC_ID_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 // generated classes
56 
57 
58 /** @addtogroup dataspec_NCBI_PCSubstance
59  *
60  * @{
61  */
62 
63 /////////////////////////////////////////////////////////////////////////////
64 /// ID and Version Description Information
65 ///
66 /// CPC_ID_Base --
67 ///
68 
70 {
72 public:
73  // constructor
74  CPC_ID_Base(void);
75  // destructor
76  virtual ~CPC_ID_Base(void);
77 
78  // type info
80 
81  // types
82  typedef int TId;
83  typedef int TVersion;
84 
85  // member index
86  enum class E_memberIndex {
87  e__allMandatory = 0,
88  e_id,
89  e_version
90  };
92 
93  // getters
94  // setters
95 
96  /// Unique "Global" ID
97  /// Note: Must be greater than "0" or, if invalid, "0"
98  /// Check if a value has been assigned to Id data member.
99  ///
100  /// Data member Id is mandatory;
101  /// its type is defined as 'typedef int TId'
102  /// @return
103  /// - true, if a value has been assigned.
104  /// - false, otherwise.
105  bool IsSetId(void) const;
106 
107  /// Check if it is safe to call GetId method.
108  ///
109  /// @return
110  /// - true, if the data member is getatable.
111  /// - false, otherwise.
112  bool CanGetId(void) const;
113 
114  /// Reset Id data member.
115  void ResetId(void);
116 
117  /// Get the Id member data.
118  ///
119  /// @return
120  /// Copy of the member data.
121  TId GetId(void) const;
122 
123  /// Assign a value to Id data member.
124  ///
125  /// @param value
126  /// Value to assign
127  void SetId(TId value);
128 
129  /// Assign a value to Id data member.
130  ///
131  /// @return
132  /// Reference to the data value.
133  TId& SetId(void);
134 
135  /// Incremented when Depositor updates record
136  /// Note: For Internal Use (only?)
137  /// Check if a value has been assigned to Version data member.
138  ///
139  /// Data member Version is mandatory;
140  /// its type is defined as 'typedef int TVersion'
141  /// @return
142  /// - true, if a value has been assigned.
143  /// - false, otherwise.
144  bool IsSetVersion(void) const;
145 
146  /// Check if it is safe to call GetVersion method.
147  ///
148  /// @return
149  /// - true, if the data member is getatable.
150  /// - false, otherwise.
151  bool CanGetVersion(void) const;
152 
153  /// Reset Version data member.
154  void ResetVersion(void);
155 
156  /// Get the Version member data.
157  ///
158  /// @return
159  /// Copy of the member data.
160  TVersion GetVersion(void) const;
161 
162  /// Assign a value to Version data member.
163  ///
164  /// @param value
165  /// Value to assign
166  void SetVersion(TVersion value);
167 
168  /// Assign a value to Version data member.
169  ///
170  /// @return
171  /// Reference to the data value.
172  TVersion& SetVersion(void);
173 
174  /// Reset the whole object
175  virtual void Reset(void);
176 
177 
178 private:
179  // Prohibit copy constructor and assignment operator
182 
183  // data
184  Uint4 m_set_State[1];
185  int m_Id;
187 };
188 
189 /* @} */
190 
191 
192 
193 
194 
195 ///////////////////////////////////////////////////////////
196 ///////////////////// inline methods //////////////////////
197 ///////////////////////////////////////////////////////////
198 inline
199 bool CPC_ID_Base::IsSetId(void) const
200 {
201  return ((m_set_State[0] & 0x3) != 0);
202 }
203 
204 inline
205 bool CPC_ID_Base::CanGetId(void) const
206 {
207  return IsSetId();
208 }
209 
210 inline
212 {
213  m_Id = 0;
214  m_set_State[0] &= ~0x3;
215 }
216 
217 inline
219 {
220  if (!CanGetId()) {
221  ThrowUnassigned(0);
222  }
223  return m_Id;
224 }
225 
226 inline
228 {
229  m_Id = value;
230  m_set_State[0] |= 0x3;
231 }
232 
233 inline
235 {
236 #ifdef _DEBUG
237  if (!IsSetId()) {
238  memset(&m_Id,UnassignedByte(),sizeof(m_Id));
239  }
240 #endif
241  m_set_State[0] |= 0x1;
242  return m_Id;
243 }
244 
245 inline
247 {
248  return ((m_set_State[0] & 0xc) != 0);
249 }
250 
251 inline
253 {
254  return IsSetVersion();
255 }
256 
257 inline
259 {
260  m_Version = 0;
261  m_set_State[0] &= ~0xc;
262 }
263 
264 inline
266 {
267  if (!CanGetVersion()) {
268  ThrowUnassigned(1);
269  }
270  return m_Version;
271 }
272 
273 inline
275 {
276  m_Version = value;
277  m_set_State[0] |= 0xc;
278 }
279 
280 inline
282 {
283 #ifdef _DEBUG
284  if (!IsSetVersion()) {
285  memset(&m_Version,UnassignedByte(),sizeof(m_Version));
286  }
287 #endif
288  m_set_State[0] |= 0x4;
289  return m_Version;
290 }
291 
292 ///////////////////////////////////////////////////////////
293 ////////////////// end of inline methods //////////////////
294 ///////////////////////////////////////////////////////////
295 
296 
297 
298 
299 
300 END_objects_SCOPE // namespace ncbi::objects::
301 
303 
304 
305 #endif // OBJECTS_PCSUBSTANCE_PC_ID_BASE_HPP
ID and Version Description Information.
Definition: PC_ID_.hpp:70
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
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_PCSUBSTANCE_EXPORT
Definition: ncbi_export.h:688
int TVersion
Definition: PC_ID_.hpp:83
void ResetId(void)
Reset Id data member.
Definition: PC_ID_.hpp:211
CPC_ID_Base & operator=(const CPC_ID_Base &)
TVersion & SetVersion(void)
Assign a value to Version data member.
Definition: PC_ID_.hpp:281
int m_Version
Definition: PC_ID_.hpp:186
bool IsSetId(void) const
Unique "Global" ID Note: Must be greater than "0" or, if invalid, "0" Check if a value has been assig...
Definition: PC_ID_.hpp:199
void ResetVersion(void)
Reset Version data member.
Definition: PC_ID_.hpp:258
TId & SetId(void)
Assign a value to Id data member.
Definition: PC_ID_.hpp:234
TVersion GetVersion(void) const
Get the Version member data.
Definition: PC_ID_.hpp:265
bool IsSetVersion(void) const
Incremented when Depositor updates record Note: For Internal Use (only?) Check if a value has been as...
Definition: PC_ID_.hpp:246
TId GetId(void) const
Get the Id member data.
Definition: PC_ID_.hpp:218
CPC_ID_Base(const CPC_ID_Base &)
bool CanGetVersion(void) const
Check if it is safe to call GetVersion method.
Definition: PC_ID_.hpp:252
CSerialObject Tparent
Definition: PC_ID_.hpp:71
Uint4 m_set_State[1]
Definition: PC_ID_.hpp:184
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
Definition: PC_ID_.hpp:91
bool CanGetId(void) const
Check if it is safe to call GetId method.
Definition: PC_ID_.hpp:205
DECLARE_INTERNAL_TYPE_INFO()
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue Apr 23 07:39:35 2024 by modify_doxy.py rev. 669887