NCBI C++ ToolKit
Seq_literal_.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 Seq_literal_.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/seq/seq.asn">seq.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seq/seq.def">seq.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_SEQ_SEQ_LITERAL_BASE_HPP
42 #define OBJECTS_SEQ_SEQ_LITERAL_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 CInt_fuzz;
57 class CSeq_data;
58 
59 
60 // generated classes
61 
62 
63 /** @addtogroup dataspec_NCBI_Sequence
64  *
65  * @{
66  */
67 
68 /////////////////////////////////////////////////////////////////////////////
69 ///
70 /// CSeq_literal_Base --
71 ///
72 
74 {
76 public:
77  // constructor
78  CSeq_literal_Base(void);
79  // destructor
80  virtual ~CSeq_literal_Base(void);
81 
82  // type info
84 
85  // types
86  typedef TSeqPos TLength;
87  typedef CInt_fuzz TFuzz;
89 
90  // member index
91  enum class E_memberIndex {
92  e__allMandatory = 0,
93  e_length,
94  e_fuzz,
95  e_seq_data
96  };
98 
99  // getters
100  // setters
101 
102  /// must give a length in residues
103  /// Check if a value has been assigned to Length data member.
104  ///
105  /// Data member Length is mandatory;
106  /// its type is defined as 'typedef TSeqPos TLength'
107  /// @return
108  /// - true, if a value has been assigned.
109  /// - false, otherwise.
110  bool IsSetLength(void) const;
111 
112  /// Check if it is safe to call GetLength method.
113  ///
114  /// @return
115  /// - true, if the data member is getatable.
116  /// - false, otherwise.
117  bool CanGetLength(void) const;
118 
119  /// Reset Length data member.
120  void ResetLength(void);
121 
122  /// Get the Length member data.
123  ///
124  /// @return
125  /// Copy of the member data.
126  TLength GetLength(void) const;
127 
128  /// Assign a value to Length data member.
129  ///
130  /// @param value
131  /// Value to assign
132  void SetLength(TLength value);
133 
134  /// Assign a value to Length data member.
135  ///
136  /// @return
137  /// Reference to the data value.
138  TLength& SetLength(void);
139 
140  /// could be unsure
141  /// Check if a value has been assigned to Fuzz data member.
142  ///
143  /// Data member Fuzz is optional;
144  /// its type is defined as 'typedef CInt_fuzz TFuzz'
145  /// @return
146  /// - true, if a value has been assigned.
147  /// - false, otherwise.
148  bool IsSetFuzz(void) const;
149 
150  /// Check if it is safe to call GetFuzz method.
151  ///
152  /// @return
153  /// - true, if the data member is getatable.
154  /// - false, otherwise.
155  bool CanGetFuzz(void) const;
156 
157  /// Reset Fuzz data member.
158  void ResetFuzz(void);
159 
160  /// Get the Fuzz member data.
161  ///
162  /// @return
163  /// Reference to the member data.
164  const TFuzz& GetFuzz(void) const;
165 
166  /// Assign a value to Fuzz data member.
167  ///
168  /// @param value
169  /// Reference to value.
170  void SetFuzz(TFuzz& value);
171 
172  /// Assign a value to Fuzz data member.
173  ///
174  /// @return
175  /// Reference to the data value.
176  TFuzz& SetFuzz(void);
177 
178  /// may have the data
179  /// Check if a value has been assigned to Seq_data data member.
180  ///
181  /// Data member Seq_data is optional;
182  /// its type is defined as 'typedef CSeq_data TSeq_data'
183  /// @return
184  /// - true, if a value has been assigned.
185  /// - false, otherwise.
186  bool IsSetSeq_data(void) const;
187 
188  /// Check if it is safe to call GetSeq_data method.
189  ///
190  /// @return
191  /// - true, if the data member is getatable.
192  /// - false, otherwise.
193  bool CanGetSeq_data(void) const;
194 
195  /// Reset Seq_data data member.
196  void ResetSeq_data(void);
197 
198  /// Get the Seq_data member data.
199  ///
200  /// @return
201  /// Reference to the member data.
202  const TSeq_data& GetSeq_data(void) const;
203 
204  /// Assign a value to Seq_data data member.
205  ///
206  /// @param value
207  /// Reference to value.
208  void SetSeq_data(TSeq_data& value);
209 
210  /// Assign a value to Seq_data data member.
211  ///
212  /// @return
213  /// Reference to the data value.
214  TSeq_data& SetSeq_data(void);
215 
216  /// Reset the whole object
217  virtual void Reset(void);
218 
219 
220 private:
221  // Prohibit copy constructor and assignment operator
224 
225  // data
226  Uint4 m_set_State[1];
230 };
231 
232 /* @} */
233 
234 
235 
236 
237 
238 ///////////////////////////////////////////////////////////
239 ///////////////////// inline methods //////////////////////
240 ///////////////////////////////////////////////////////////
241 inline
243 {
244  return ((m_set_State[0] & 0x3) != 0);
245 }
246 
247 inline
249 {
250  return IsSetLength();
251 }
252 
253 inline
255 {
256  m_Length = 0;
257  m_set_State[0] &= ~0x3;
258 }
259 
260 inline
262 {
263  if (!CanGetLength()) {
264  ThrowUnassigned(0);
265  }
266  return m_Length;
267 }
268 
269 inline
271 {
272  m_Length = value;
273  m_set_State[0] |= 0x3;
274 }
275 
276 inline
278 {
279 #ifdef _DEBUG
280  if (!IsSetLength()) {
281  memset(&m_Length,UnassignedByte(),sizeof(m_Length));
282  }
283 #endif
284  m_set_State[0] |= 0x1;
285  return m_Length;
286 }
287 
288 inline
290 {
291  return m_Fuzz.NotEmpty();
292 }
293 
294 inline
296 {
297  return IsSetFuzz();
298 }
299 
300 inline
302 {
303  if (!CanGetFuzz()) {
304  ThrowUnassigned(1);
305  }
306  return (*m_Fuzz);
307 }
308 
309 inline
311 {
312  return m_Seq_data.NotEmpty();
313 }
314 
315 inline
317 {
318  return IsSetSeq_data();
319 }
320 
321 inline
323 {
324  if (!CanGetSeq_data()) {
325  ThrowUnassigned(2);
326  }
327  return (*m_Seq_data);
328 }
329 
330 ///////////////////////////////////////////////////////////
331 ////////////////// end of inline methods //////////////////
332 ///////////////////////////////////////////////////////////
333 
334 
335 
336 
337 
338 END_objects_SCOPE // namespace ncbi::objects::
339 
341 
342 
343 #endif // OBJECTS_SEQ_SEQ_LITERAL_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
CSeq_literal_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.
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_SEQ_EXPORT
Definition: ncbi_export.h:825
void ResetLength(void)
Reset Length data member.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
TLength & SetLength(void)
Assign a value to Length data member.
CRef< TFuzz > m_Fuzz
CSerialObject Tparent
TLength GetLength(void) const
Get the Length member data.
bool CanGetLength(void) const
Check if it is safe to call GetLength method.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
bool IsSetFuzz(void) const
could be unsure Check if a value has been assigned to Fuzz data member.
bool IsSetLength(void) const
must give a length in residues Check if a value has been assigned to Length data member.
CSeq_literal_Base(const CSeq_literal_Base &)
bool CanGetFuzz(void) const
Check if it is safe to call GetFuzz method.
bool CanGetSeq_data(void) const
Check if it is safe to call GetSeq_data method.
bool IsSetSeq_data(void) const
may have the data Check if a value has been assigned to Seq_data data member.
CRef< TSeq_data > m_Seq_data
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
CSeq_literal_Base & operator=(const CSeq_literal_Base &)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static const CInt_fuzz * GetFuzz(const CDelta_item &delta)
Modified on Thu May 30 12:20:11 2024 by modify_doxy.py rev. 669887