NCBI C++ ToolKit
ID2S_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 ID2S_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/seqsplit/seqsplit.asn">seqsplit.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqsplit/seqsplit.def">seqsplit.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_SEQSPLIT_ID2S_INTERVAL_BASE_HPP
42 #define OBJECTS_SEQSPLIT_ID2S_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_Seq_split
59  *
60  * @{
61  */
62 
63 /////////////////////////////////////////////////////////////////////////////
64 ///
65 /// CID2S_Interval_Base --
66 ///
67 
69 {
71 public:
72  // constructor
73  CID2S_Interval_Base(void);
74  // destructor
75  virtual ~CID2S_Interval_Base(void);
76 
77  // type info
79 
80  // types
81  typedef TSeqPos TStart;
82  typedef TSeqPos TLength;
83 
84  // member index
85  enum class E_memberIndex {
86  e__allMandatory = 0,
87  e_start,
88  e_length
89  };
91 
92  // getters
93  // setters
94 
95  /// Check if a value has been assigned to Start data member.
96  ///
97  /// Data member Start is mandatory;
98  /// its type is defined as 'typedef TSeqPos TStart'
99  /// @return
100  /// - true, if a value has been assigned.
101  /// - false, otherwise.
102  bool IsSetStart(void) const;
103 
104  /// Check if it is safe to call GetStart method.
105  ///
106  /// @return
107  /// - true, if the data member is getatable.
108  /// - false, otherwise.
109  bool CanGetStart(void) const;
110 
111  /// Reset Start data member.
112  void ResetStart(void);
113 
114  /// Get the Start member data.
115  ///
116  /// @return
117  /// Copy of the member data.
118  TStart GetStart(void) const;
119 
120  /// Assign a value to Start data member.
121  ///
122  /// @param value
123  /// Value to assign
124  void SetStart(TStart value);
125 
126  /// Assign a value to Start data member.
127  ///
128  /// @return
129  /// Reference to the data value.
130  TStart& SetStart(void);
131 
132  /// Check if a value has been assigned to Length data member.
133  ///
134  /// Data member Length is optional with default 1;
135  /// its type is defined as 'typedef TSeqPos TLength'
136  /// @return
137  /// - true, if a value has been assigned.
138  /// - false, otherwise.
139  bool IsSetLength(void) const;
140 
141  /// Check if it is safe to call GetLength method.
142  ///
143  /// @return
144  /// - true, if the data member is getatable.
145  /// - false, otherwise.
146  bool CanGetLength(void) const;
147 
148  /// Reset Length data member.
149  void ResetLength(void);
150 
151  /// Assign default value to Length data member.
152  void SetDefaultLength(void);
153 
154  /// Get the Length member data.
155  ///
156  /// @return
157  /// Copy of the member data.
158  TLength GetLength(void) const;
159 
160  /// Assign a value to Length data member.
161  ///
162  /// @param value
163  /// Value to assign
164  void SetLength(TLength value);
165 
166  /// Assign a value to Length data member.
167  ///
168  /// @return
169  /// Reference to the data value.
170  TLength& SetLength(void);
171 
172  /// Reset the whole object
173  virtual void Reset(void);
174 
175 
176 private:
177  // Prohibit copy constructor and assignment operator
180 
181  // data
182  Uint4 m_set_State[1];
185 };
186 
187 /* @} */
188 
189 
190 
191 
192 
193 ///////////////////////////////////////////////////////////
194 ///////////////////// inline methods //////////////////////
195 ///////////////////////////////////////////////////////////
196 inline
198 {
199  return ((m_set_State[0] & 0x3) != 0);
200 }
201 
202 inline
204 {
205  return IsSetStart();
206 }
207 
208 inline
210 {
211  m_Start = 0;
212  m_set_State[0] &= ~0x3;
213 }
214 
215 inline
217 {
218  if (!CanGetStart()) {
219  ThrowUnassigned(0);
220  }
221  return m_Start;
222 }
223 
224 inline
226 {
227  m_Start = value;
228  m_set_State[0] |= 0x3;
229 }
230 
231 inline
233 {
234 #ifdef _DEBUG
235  if (!IsSetStart()) {
236  memset(&m_Start,UnassignedByte(),sizeof(m_Start));
237  }
238 #endif
239  m_set_State[0] |= 0x1;
240  return m_Start;
241 }
242 
243 inline
245 {
246  return ((m_set_State[0] & 0xc) != 0);
247 }
248 
249 inline
251 {
252  return true;
253 }
254 
255 inline
257 {
258  m_Length = 1;
259  m_set_State[0] &= ~0xc;
260 }
261 
262 inline
264 {
265  ResetLength();
266 }
267 
268 inline
270 {
271  return m_Length;
272 }
273 
274 inline
276 {
277  m_Length = value;
278  m_set_State[0] |= 0xc;
279 }
280 
281 inline
283 {
284 #ifdef _DEBUG
285  if (!IsSetLength()) {
286  memset(&m_Length,UnassignedByte(),sizeof(m_Length));
287  }
288 #endif
289  m_set_State[0] |= 0x4;
290  return m_Length;
291 }
292 
293 ///////////////////////////////////////////////////////////
294 ////////////////// end of inline methods //////////////////
295 ///////////////////////////////////////////////////////////
296 
297 
298 
299 
300 
301 END_objects_SCOPE // namespace ncbi::objects::
302 
304 
305 
306 #endif // OBJECTS_SEQSPLIT_ID2S_INTERVAL_BASE_HPP
CID2S_Interval_Base –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
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_ID2_EXPORT
Definition: ncbi_export.h:552
bool IsSetLength(void) const
Check if a value has been assigned to Length data member.
TLength GetLength(void) const
Get the Length member data.
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
TStart GetStart(void) const
Get the Start member data.
void ResetStart(void)
Reset Start data member.
CID2S_Interval_Base(const CID2S_Interval_Base &)
bool CanGetStart(void) const
Check if it is safe to call GetStart method.
TLength & SetLength(void)
Assign a value to Length data member.
TStart & SetStart(void)
Assign a value to Start data member.
bool CanGetLength(void) const
Check if it is safe to call GetLength method.
void SetDefaultLength(void)
Assign default value to Length data member.
void ResetLength(void)
Reset Length data member.
CSerialObject Tparent
bool IsSetStart(void) const
Check if a value has been assigned to Start data member.
CID2S_Interval_Base & operator=(const CID2S_Interval_Base &)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sun May 19 04:41:17 2024 by modify_doxy.py rev. 669887