NCBI C++ ToolKit
Prot_pos_.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 Prot_pos_.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/seqalign/seqalign.asn">seqalign.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/seqalign/seqalign.def">seqalign.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_SEQALIGN_PROT_POS_BASE_HPP
42 #define OBJECTS_SEQALIGN_PROT_POS_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_Seqalign
59  *
60  * @{
61  */
62 
63 /////////////////////////////////////////////////////////////////////////////
64 /// position on protein (1/3 of amino-acid resolution)
65 ///
66 /// CProt_pos_Base --
67 ///
68 
70 {
72 public:
73  // constructor
74  CProt_pos_Base(void);
75  // destructor
76  virtual ~CProt_pos_Base(void);
77 
78  // type info
80 
81  // types
82  typedef TSeqPos TAmin;
83  typedef TSeqPos TFrame;
84 
85  // member index
86  enum class E_memberIndex {
87  e__allMandatory = 0,
88  e_amin,
89  e_frame
90  };
92 
93  // getters
94  // setters
95 
96  /// amino-acid position (0-based)
97  /// Check if a value has been assigned to Amin data member.
98  ///
99  /// Data member Amin is mandatory;
100  /// its type is defined as 'typedef TSeqPos TAmin'
101  /// @return
102  /// - true, if a value has been assigned.
103  /// - false, otherwise.
104  bool IsSetAmin(void) const;
105 
106  /// Check if it is safe to call GetAmin method.
107  ///
108  /// @return
109  /// - true, if the data member is getatable.
110  /// - false, otherwise.
111  bool CanGetAmin(void) const;
112 
113  /// Reset Amin data member.
114  void ResetAmin(void);
115 
116  /// Get the Amin member data.
117  ///
118  /// @return
119  /// Copy of the member data.
120  TAmin GetAmin(void) const;
121 
122  /// Assign a value to Amin data member.
123  ///
124  /// @param value
125  /// Value to assign
126  void SetAmin(TAmin value);
127 
128  /// Assign a value to Amin data member.
129  ///
130  /// @return
131  /// Reference to the data value.
132  TAmin& SetAmin(void);
133 
134  /// position within codon (1-based)
135  /// 0 = not set (meaning 1)
136  /// Check if a value has been assigned to Frame data member.
137  ///
138  /// Data member Frame is optional with default 0;
139  /// its type is defined as 'typedef TSeqPos TFrame'
140  /// @return
141  /// - true, if a value has been assigned.
142  /// - false, otherwise.
143  bool IsSetFrame(void) const;
144 
145  /// Check if it is safe to call GetFrame method.
146  ///
147  /// @return
148  /// - true, if the data member is getatable.
149  /// - false, otherwise.
150  bool CanGetFrame(void) const;
151 
152  /// Reset Frame data member.
153  void ResetFrame(void);
154 
155  /// Assign default value to Frame data member.
156  void SetDefaultFrame(void);
157 
158  /// Get the Frame member data.
159  ///
160  /// @return
161  /// Copy of the member data.
162  TFrame GetFrame(void) const;
163 
164  /// Assign a value to Frame data member.
165  ///
166  /// @param value
167  /// Value to assign
168  void SetFrame(TFrame value);
169 
170  /// Assign a value to Frame data member.
171  ///
172  /// @return
173  /// Reference to the data value.
174  TFrame& SetFrame(void);
175 
176  /// Reset the whole object
177  virtual void Reset(void);
178 
179 
180 private:
181  // Prohibit copy constructor and assignment operator
184 
185  // data
186  Uint4 m_set_State[1];
189 };
190 
191 /* @} */
192 
193 
194 
195 
196 
197 ///////////////////////////////////////////////////////////
198 ///////////////////// inline methods //////////////////////
199 ///////////////////////////////////////////////////////////
200 inline
202 {
203  return ((m_set_State[0] & 0x3) != 0);
204 }
205 
206 inline
208 {
209  return IsSetAmin();
210 }
211 
212 inline
214 {
215  m_Amin = 0;
216  m_set_State[0] &= ~0x3;
217 }
218 
219 inline
221 {
222  if (!CanGetAmin()) {
223  ThrowUnassigned(0);
224  }
225  return m_Amin;
226 }
227 
228 inline
230 {
231  m_Amin = value;
232  m_set_State[0] |= 0x3;
233 }
234 
235 inline
237 {
238 #ifdef _DEBUG
239  if (!IsSetAmin()) {
240  memset(&m_Amin,UnassignedByte(),sizeof(m_Amin));
241  }
242 #endif
243  m_set_State[0] |= 0x1;
244  return m_Amin;
245 }
246 
247 inline
249 {
250  return ((m_set_State[0] & 0xc) != 0);
251 }
252 
253 inline
255 {
256  return true;
257 }
258 
259 inline
261 {
262  m_Frame = 0;
263  m_set_State[0] &= ~0xc;
264 }
265 
266 inline
268 {
269  ResetFrame();
270 }
271 
272 inline
274 {
275  return m_Frame;
276 }
277 
278 inline
280 {
281  m_Frame = value;
282  m_set_State[0] |= 0xc;
283 }
284 
285 inline
287 {
288 #ifdef _DEBUG
289  if (!IsSetFrame()) {
290  memset(&m_Frame,UnassignedByte(),sizeof(m_Frame));
291  }
292 #endif
293  m_set_State[0] |= 0x4;
294  return m_Frame;
295 }
296 
297 ///////////////////////////////////////////////////////////
298 ////////////////// end of inline methods //////////////////
299 ///////////////////////////////////////////////////////////
300 
301 
302 
303 
304 
305 END_objects_SCOPE // namespace ncbi::objects::
306 
308 
309 
310 #endif // OBJECTS_SEQALIGN_PROT_POS_BASE_HPP
position on protein (1/3 of amino-acid resolution)
Definition: Prot_pos_.hpp:70
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
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_SEQALIGN_EXPORT
Definition: ncbi_export.h:744
bool IsSetFrame(void) const
position within codon (1-based) 0 = not set (meaning 1) Check if a value has been assigned to Frame d...
Definition: Prot_pos_.hpp:248
bool CanGetFrame(void) const
Check if it is safe to call GetFrame method.
Definition: Prot_pos_.hpp:254
Tparent::CMemberIndex< E_memberIndex, 3 > TmemberIndex
Definition: Prot_pos_.hpp:91
void ResetAmin(void)
Reset Amin data member.
Definition: Prot_pos_.hpp:213
DECLARE_INTERNAL_TYPE_INFO()
Uint4 m_set_State[1]
Definition: Prot_pos_.hpp:186
TFrame GetFrame(void) const
Get the Frame member data.
Definition: Prot_pos_.hpp:273
TFrame & SetFrame(void)
Assign a value to Frame data member.
Definition: Prot_pos_.hpp:286
bool IsSetAmin(void) const
amino-acid position (0-based) Check if a value has been assigned to Amin data member.
Definition: Prot_pos_.hpp:201
TSeqPos TFrame
Definition: Prot_pos_.hpp:83
TAmin GetAmin(void) const
Get the Amin member data.
Definition: Prot_pos_.hpp:220
CProt_pos_Base & operator=(const CProt_pos_Base &)
void SetDefaultFrame(void)
Assign default value to Frame data member.
Definition: Prot_pos_.hpp:267
void ResetFrame(void)
Reset Frame data member.
Definition: Prot_pos_.hpp:260
TSeqPos TAmin
Definition: Prot_pos_.hpp:82
bool CanGetAmin(void) const
Check if it is safe to call GetAmin method.
Definition: Prot_pos_.hpp:207
TSeqPos m_Amin
Definition: Prot_pos_.hpp:187
TSeqPos m_Frame
Definition: Prot_pos_.hpp:188
CProt_pos_Base(const CProt_pos_Base &)
TAmin & SetAmin(void)
Assign a value to Amin data member.
Definition: Prot_pos_.hpp:236
CSerialObject Tparent
Definition: Prot_pos_.hpp:71
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Thu Apr 25 08:21:20 2024 by modify_doxy.py rev. 669887