NCBI C++ ToolKit
Location_interval_.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 Location_interval_.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/macro/macro.asn">macro.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/macro/macro.def">macro.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_MACRO_LOCATION_INTERVAL_BASE_HPP
42 #define OBJECTS_MACRO_LOCATION_INTERVAL_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_Macro
59  *
60  * @{
61  */
62 
63 /////////////////////////////////////////////////////////////////////////////
64 ///
65 /// CLocation_interval_Base --
66 ///
67 
69 {
71 public:
72  // constructor
74  // destructor
75  virtual ~CLocation_interval_Base(void);
76 
77  // type info
79 
80  // types
81  typedef int TFrom;
82  typedef int TTo;
83 
84  // member index
85  enum class E_memberIndex {
86  e__allMandatory = 0,
87  e_from,
88  e_to
89  };
91 
92  // getters
93  // setters
94 
95  /// Check if a value has been assigned to From data member.
96  ///
97  /// Data member From is mandatory;
98  /// its type is defined as 'typedef int TFrom'
99  /// @return
100  /// - true, if a value has been assigned.
101  /// - false, otherwise.
102  bool IsSetFrom(void) const;
103 
104  /// Check if it is safe to call GetFrom method.
105  ///
106  /// @return
107  /// - true, if the data member is getatable.
108  /// - false, otherwise.
109  bool CanGetFrom(void) const;
110 
111  /// Reset From data member.
112  void ResetFrom(void);
113 
114  /// Get the From member data.
115  ///
116  /// @return
117  /// Copy of the member data.
118  TFrom GetFrom(void) const;
119 
120  /// Assign a value to From data member.
121  ///
122  /// @param value
123  /// Value to assign
124  void SetFrom(TFrom value);
125 
126  /// Assign a value to From data member.
127  ///
128  /// @return
129  /// Reference to the data value.
130  TFrom& SetFrom(void);
131 
132  /// Check if a value has been assigned to To data member.
133  ///
134  /// Data member To is mandatory;
135  /// its type is defined as 'typedef int TTo'
136  /// @return
137  /// - true, if a value has been assigned.
138  /// - false, otherwise.
139  bool IsSetTo(void) const;
140 
141  /// Check if it is safe to call GetTo method.
142  ///
143  /// @return
144  /// - true, if the data member is getatable.
145  /// - false, otherwise.
146  bool CanGetTo(void) const;
147 
148  /// Reset To data member.
149  void ResetTo(void);
150 
151  /// Get the To member data.
152  ///
153  /// @return
154  /// Copy of the member data.
155  TTo GetTo(void) const;
156 
157  /// Assign a value to To data member.
158  ///
159  /// @param value
160  /// Value to assign
161  void SetTo(TTo value);
162 
163  /// Assign a value to To data member.
164  ///
165  /// @return
166  /// Reference to the data value.
167  TTo& SetTo(void);
168 
169  /// Reset the whole object
170  virtual void Reset(void);
171 
172 
173 private:
174  // Prohibit copy constructor and assignment operator
177 
178  // data
180  int m_From;
181  int m_To;
182 };
183 
184 /* @} */
185 
186 
187 
188 
189 
190 ///////////////////////////////////////////////////////////
191 ///////////////////// inline methods //////////////////////
192 ///////////////////////////////////////////////////////////
193 inline
195 {
196  return ((m_set_State[0] & 0x3) != 0);
197 }
198 
199 inline
201 {
202  return IsSetFrom();
203 }
204 
205 inline
207 {
208  m_From = 0;
209  m_set_State[0] &= ~0x3;
210 }
211 
212 inline
214 {
215  if (!CanGetFrom()) {
216  ThrowUnassigned(0);
217  }
218  return m_From;
219 }
220 
221 inline
223 {
224  m_From = value;
225  m_set_State[0] |= 0x3;
226 }
227 
228 inline
230 {
231 #ifdef _DEBUG
232  if (!IsSetFrom()) {
233  memset(&m_From,UnassignedByte(),sizeof(m_From));
234  }
235 #endif
236  m_set_State[0] |= 0x1;
237  return m_From;
238 }
239 
240 inline
242 {
243  return ((m_set_State[0] & 0xc) != 0);
244 }
245 
246 inline
248 {
249  return IsSetTo();
250 }
251 
252 inline
254 {
255  m_To = 0;
256  m_set_State[0] &= ~0xc;
257 }
258 
259 inline
261 {
262  if (!CanGetTo()) {
263  ThrowUnassigned(1);
264  }
265  return m_To;
266 }
267 
268 inline
270 {
271  m_To = value;
272  m_set_State[0] |= 0xc;
273 }
274 
275 inline
277 {
278 #ifdef _DEBUG
279  if (!IsSetTo()) {
280  memset(&m_To,UnassignedByte(),sizeof(m_To));
281  }
282 #endif
283  m_set_State[0] |= 0x4;
284  return m_To;
285 }
286 
287 ///////////////////////////////////////////////////////////
288 ////////////////// end of inline methods //////////////////
289 ///////////////////////////////////////////////////////////
290 
291 
292 
293 
294 
295 END_objects_SCOPE // namespace ncbi::objects::
296 
298 
299 
300 #endif // OBJECTS_MACRO_LOCATION_INTERVAL_BASE_HPP
CLocation_interval_Base –.
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, 3 > TmemberIndex
TFrom GetFrom(void) const
Get the From member data.
bool CanGetTo(void) const
Check if it is safe to call GetTo method.
void ResetFrom(void)
Reset From data member.
CLocation_interval_Base & operator=(const CLocation_interval_Base &)
bool CanGetFrom(void) const
Check if it is safe to call GetFrom method.
TFrom & SetFrom(void)
Assign a value to From data member.
virtual ~CLocation_interval_Base(void)
bool IsSetTo(void) const
Check if a value has been assigned to To data member.
TTo GetTo(void) const
Get the To member data.
CLocation_interval_Base(const CLocation_interval_Base &)
bool IsSetFrom(void) const
Check if a value has been assigned to From data member.
virtual void Reset(void)
Reset the whole object.
TTo & SetTo(void)
Assign a value to To data member.
void ResetTo(void)
Reset To data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat Jun 08 14:24:10 2024 by modify_doxy.py rev. 669887