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