NCBI C++ ToolKit
ID2S_Seq_id_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_Seq_id_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_SEQ_ID_INTERVAL_BASE_HPP
42 #define OBJECTS_SEQSPLIT_ID2S_SEQ_ID_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 // forward declarations
56 class CSeq_id;
57 
58 
59 // generated classes
60 
61 
62 /** @addtogroup dataspec_NCBI_Seq_split
63  *
64  * @{
65  */
66 
67 /////////////////////////////////////////////////////////////////////////////
68 ///
69 /// CID2S_Seq_id_Interval_Base --
70 ///
71 
73 {
75 public:
76  // constructor
78  // destructor
79  virtual ~CID2S_Seq_id_Interval_Base(void);
80 
81  // type info
83 
84  // types
85  typedef CSeq_id TSeq_id;
86  typedef int TStart;
87  typedef int TLength;
88 
89  // member index
90  enum class E_memberIndex {
91  e__allMandatory = 0,
92  e_seq_id,
93  e_start,
94  e_length
95  };
97 
98  // getters
99  // setters
100 
101  /// Check if a value has been assigned to Seq_id data member.
102  ///
103  /// Data member Seq_id is mandatory;
104  /// its type is defined as 'typedef CSeq_id TSeq_id'
105  /// @return
106  /// - true, if a value has been assigned.
107  /// - false, otherwise.
108  bool IsSetSeq_id(void) const;
109 
110  /// Check if it is safe to call GetSeq_id method.
111  ///
112  /// @return
113  /// - true, if the data member is getatable.
114  /// - false, otherwise.
115  bool CanGetSeq_id(void) const;
116 
117  /// Reset Seq_id data member.
118  void ResetSeq_id(void);
119 
120  /// Get the Seq_id member data.
121  ///
122  /// @return
123  /// Reference to the member data.
124  const TSeq_id& GetSeq_id(void) const;
125 
126  /// Assign a value to Seq_id data member.
127  ///
128  /// @param value
129  /// Reference to value.
130  void SetSeq_id(TSeq_id& value);
131 
132  /// Assign a value to Seq_id data member.
133  ///
134  /// @return
135  /// Reference to the data value.
136  TSeq_id& SetSeq_id(void);
137 
138  /// Check if a value has been assigned to Start data member.
139  ///
140  /// Data member Start is mandatory;
141  /// its type is defined as 'typedef int TStart'
142  /// @return
143  /// - true, if a value has been assigned.
144  /// - false, otherwise.
145  bool IsSetStart(void) const;
146 
147  /// Check if it is safe to call GetStart method.
148  ///
149  /// @return
150  /// - true, if the data member is getatable.
151  /// - false, otherwise.
152  bool CanGetStart(void) const;
153 
154  /// Reset Start data member.
155  void ResetStart(void);
156 
157  /// Get the Start member data.
158  ///
159  /// @return
160  /// Copy of the member data.
161  TStart GetStart(void) const;
162 
163  /// Assign a value to Start data member.
164  ///
165  /// @param value
166  /// Value to assign
167  void SetStart(TStart value);
168 
169  /// Assign a value to Start data member.
170  ///
171  /// @return
172  /// Reference to the data value.
173  TStart& SetStart(void);
174 
175  /// Check if a value has been assigned to Length data member.
176  ///
177  /// Data member Length is optional with default 1;
178  /// its type is defined as 'typedef int TLength'
179  /// @return
180  /// - true, if a value has been assigned.
181  /// - false, otherwise.
182  bool IsSetLength(void) const;
183 
184  /// Check if it is safe to call GetLength method.
185  ///
186  /// @return
187  /// - true, if the data member is getatable.
188  /// - false, otherwise.
189  bool CanGetLength(void) const;
190 
191  /// Reset Length data member.
192  void ResetLength(void);
193 
194  /// Assign default value to Length data member.
195  void SetDefaultLength(void);
196 
197  /// Get the Length member data.
198  ///
199  /// @return
200  /// Copy of the member data.
201  TLength GetLength(void) const;
202 
203  /// Assign a value to Length data member.
204  ///
205  /// @param value
206  /// Value to assign
207  void SetLength(TLength value);
208 
209  /// Assign a value to Length data member.
210  ///
211  /// @return
212  /// Reference to the data value.
213  TLength& SetLength(void);
214 
215  /// Reset the whole object
216  virtual void Reset(void);
217 
218 
219 private:
220  // Prohibit copy constructor and assignment operator
223 
224  // data
225  Uint4 m_set_State[1];
227  int m_Start;
228  int m_Length;
229 };
230 
231 /* @} */
232 
233 
234 
235 
236 
237 ///////////////////////////////////////////////////////////
238 ///////////////////// inline methods //////////////////////
239 ///////////////////////////////////////////////////////////
240 inline
242 {
243  return m_Seq_id.NotEmpty();
244 }
245 
246 inline
248 {
249  return true;
250 }
251 
252 inline
254 {
255  if ( !m_Seq_id ) {
256  const_cast<CID2S_Seq_id_Interval_Base*>(this)->ResetSeq_id();
257  }
258  return (*m_Seq_id);
259 }
260 
261 inline
263 {
264  if ( !m_Seq_id ) {
265  ResetSeq_id();
266  }
267  return (*m_Seq_id);
268 }
269 
270 inline
272 {
273  return ((m_set_State[0] & 0xc) != 0);
274 }
275 
276 inline
278 {
279  return IsSetStart();
280 }
281 
282 inline
284 {
285  m_Start = 0;
286  m_set_State[0] &= ~0xc;
287 }
288 
289 inline
291 {
292  if (!CanGetStart()) {
293  ThrowUnassigned(1);
294  }
295  return m_Start;
296 }
297 
298 inline
300 {
301  m_Start = value;
302  m_set_State[0] |= 0xc;
303 }
304 
305 inline
307 {
308 #ifdef _DEBUG
309  if (!IsSetStart()) {
310  memset(&m_Start,UnassignedByte(),sizeof(m_Start));
311  }
312 #endif
313  m_set_State[0] |= 0x4;
314  return m_Start;
315 }
316 
317 inline
319 {
320  return ((m_set_State[0] & 0x30) != 0);
321 }
322 
323 inline
325 {
326  return true;
327 }
328 
329 inline
331 {
332  m_Length = 1;
333  m_set_State[0] &= ~0x30;
334 }
335 
336 inline
338 {
339  ResetLength();
340 }
341 
342 inline
344 {
345  return m_Length;
346 }
347 
348 inline
350 {
351  m_Length = value;
352  m_set_State[0] |= 0x30;
353 }
354 
355 inline
357 {
358 #ifdef _DEBUG
359  if (!IsSetLength()) {
360  memset(&m_Length,UnassignedByte(),sizeof(m_Length));
361  }
362 #endif
363  m_set_State[0] |= 0x10;
364  return m_Length;
365 }
366 
367 ///////////////////////////////////////////////////////////
368 ////////////////// end of inline methods //////////////////
369 ///////////////////////////////////////////////////////////
370 
371 
372 
373 
374 
375 END_objects_SCOPE // namespace ncbi::objects::
376 
378 
379 
380 #endif // OBJECTS_SEQSPLIT_ID2S_SEQ_ID_INTERVAL_BASE_HPP
CID2S_Seq_id_Interval_Base –.
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
char value[7]
Definition: config.c:431
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
TStart GetStart(void) const
Get the Start member data.
void SetDefaultLength(void)
Assign default value to Length data member.
TStart & SetStart(void)
Assign a value to Start data member.
void ResetSeq_id(void)
Reset Seq_id data member.
void ResetStart(void)
Reset Start data member.
bool CanGetSeq_id(void) const
Check if it is safe to call GetSeq_id method.
bool CanGetLength(void) const
Check if it is safe to call GetLength method.
CID2S_Seq_id_Interval_Base & operator=(const CID2S_Seq_id_Interval_Base &)
TSeq_id & SetSeq_id(void)
Assign a value to Seq_id data member.
const TSeq_id & GetSeq_id(void) const
Get the Seq_id member data.
CID2S_Seq_id_Interval_Base(const CID2S_Seq_id_Interval_Base &)
bool IsSetSeq_id(void) const
Check if a value has been assigned to Seq_id data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
TLength & SetLength(void)
Assign a value to Length data member.
bool CanGetStart(void) const
Check if it is safe to call GetStart method.
bool IsSetStart(void) const
Check if a value has been assigned to Start data member.
void ResetLength(void)
Reset Length data member.
bool IsSetLength(void) const
Check if a value has been assigned to Length data member.
TLength GetLength(void) const
Get the Length member data.
Modified on Fri Dec 01 04:43:59 2023 by modify_doxy.py rev. 669887