NCBI C++ ToolKit
NaSub_.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 NaSub_.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/varrep/varrep.asn">varrep.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/varrep/varrep.def">varrep.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_VARREP_NASUB_BASE_HPP
42 #define OBJECTS_VARREP_NASUB_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // forward declarations
60 class CNtLocation;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_VariationIRep
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CNaSub_Base --
74 ///
75 
76 class CNaSub_Base : public CSerialObject
77 {
79 public:
80  // constructor
81  CNaSub_Base(void);
82  // destructor
83  virtual ~CNaSub_Base(void);
84 
85  // type info
87 
88  // types
89  typedef CNtLocation TLoc;
90  typedef string TInitial;
91  typedef string TFinal;
92 
93  // member index
94  enum class E_memberIndex {
95  e__allMandatory = 0,
96  e_loc,
97  e_initial,
98  e_final
99  };
101 
102  // getters
103  // setters
104 
105  /// Check if a value has been assigned to Loc data member.
106  ///
107  /// Data member Loc is mandatory;
108  /// its type is defined as 'typedef CNtLocation TLoc'
109  /// @return
110  /// - true, if a value has been assigned.
111  /// - false, otherwise.
112  bool IsSetLoc(void) const;
113 
114  /// Check if it is safe to call GetLoc method.
115  ///
116  /// @return
117  /// - true, if the data member is getatable.
118  /// - false, otherwise.
119  bool CanGetLoc(void) const;
120 
121  /// Reset Loc data member.
122  void ResetLoc(void);
123 
124  /// Get the Loc member data.
125  ///
126  /// @return
127  /// Reference to the member data.
128  const TLoc& GetLoc(void) const;
129 
130  /// Assign a value to Loc data member.
131  ///
132  /// @param value
133  /// Reference to value.
134  void SetLoc(TLoc& value);
135 
136  /// Assign a value to Loc data member.
137  ///
138  /// @return
139  /// Reference to the data value.
140  TLoc& SetLoc(void);
141 
142  /// Check if a value has been assigned to Initial data member.
143  ///
144  /// Data member Initial is mandatory;
145  /// its type is defined as 'typedef string TInitial'
146  /// @return
147  /// - true, if a value has been assigned.
148  /// - false, otherwise.
149  bool IsSetInitial(void) const;
150 
151  /// Check if it is safe to call GetInitial method.
152  ///
153  /// @return
154  /// - true, if the data member is getatable.
155  /// - false, otherwise.
156  bool CanGetInitial(void) const;
157 
158  /// Reset Initial data member.
159  void ResetInitial(void);
160 
161  /// Get the Initial member data.
162  ///
163  /// @return
164  /// Reference to the member data.
165  const TInitial& GetInitial(void) const;
166 
167  /// Assign a value to Initial data member.
168  ///
169  /// @param value
170  /// Value to assign
171  void SetInitial(const TInitial& value);
172  void SetInitial(TInitial&& value);
173 
174  /// Assign a value to Initial data member.
175  ///
176  /// @return
177  /// Reference to the data value.
178  TInitial& SetInitial(void);
179 
180  /// Check if a value has been assigned to Final data member.
181  ///
182  /// Data member Final is mandatory;
183  /// its type is defined as 'typedef string TFinal'
184  /// @return
185  /// - true, if a value has been assigned.
186  /// - false, otherwise.
187  bool IsSetFinal(void) const;
188 
189  /// Check if it is safe to call GetFinal method.
190  ///
191  /// @return
192  /// - true, if the data member is getatable.
193  /// - false, otherwise.
194  bool CanGetFinal(void) const;
195 
196  /// Reset Final data member.
197  void ResetFinal(void);
198 
199  /// Get the Final member data.
200  ///
201  /// @return
202  /// Reference to the member data.
203  const TFinal& GetFinal(void) const;
204 
205  /// Assign a value to Final data member.
206  ///
207  /// @param value
208  /// Value to assign
209  void SetFinal(const TFinal& value);
210  void SetFinal(TFinal&& value);
211 
212  /// Assign a value to Final data member.
213  ///
214  /// @return
215  /// Reference to the data value.
216  TFinal& SetFinal(void);
217 
218  /// Reset the whole object
219  virtual void Reset(void);
220 
221 
222 private:
223  // Prohibit copy constructor and assignment operator
226 
227  // data
230  string m_Initial;
231  string m_Final;
232 };
233 
234 /* @} */
235 
236 
237 
238 
239 
240 ///////////////////////////////////////////////////////////
241 ///////////////////// inline methods //////////////////////
242 ///////////////////////////////////////////////////////////
243 inline
244 bool CNaSub_Base::IsSetLoc(void) const
245 {
246  return m_Loc.NotEmpty();
247 }
248 
249 inline
250 bool CNaSub_Base::CanGetLoc(void) const
251 {
252  return true;
253 }
254 
255 inline
257 {
258  if ( !m_Loc ) {
259  const_cast<CNaSub_Base*>(this)->ResetLoc();
260  }
261  return (*m_Loc);
262 }
263 
264 inline
266 {
267  if ( !m_Loc ) {
268  ResetLoc();
269  }
270  return (*m_Loc);
271 }
272 
273 inline
275 {
276  return ((m_set_State[0] & 0xc) != 0);
277 }
278 
279 inline
281 {
282  return IsSetInitial();
283 }
284 
285 inline
287 {
288  if (!CanGetInitial()) {
289  ThrowUnassigned(1);
290  }
291  return m_Initial;
292 }
293 
294 inline
296 {
297  m_Initial = value;
298  m_set_State[0] |= 0xc;
299 }
300 
301 inline
303 {
304  m_Initial = std::forward<CNaSub_Base::TInitial>(value);
305  m_set_State[0] |= 0xc;
306 }
307 
308 inline
310 {
311 #ifdef _DEBUG
312  if (!IsSetInitial()) {
314  }
315 #endif
316  m_set_State[0] |= 0x4;
317  return m_Initial;
318 }
319 
320 inline
321 bool CNaSub_Base::IsSetFinal(void) const
322 {
323  return ((m_set_State[0] & 0x30) != 0);
324 }
325 
326 inline
327 bool CNaSub_Base::CanGetFinal(void) const
328 {
329  return IsSetFinal();
330 }
331 
332 inline
334 {
335  if (!CanGetFinal()) {
336  ThrowUnassigned(2);
337  }
338  return m_Final;
339 }
340 
341 inline
343 {
344  m_Final = value;
345  m_set_State[0] |= 0x30;
346 }
347 
348 inline
350 {
351  m_Final = std::forward<CNaSub_Base::TFinal>(value);
352  m_set_State[0] |= 0x30;
353 }
354 
355 inline
357 {
358 #ifdef _DEBUG
359  if (!IsSetFinal()) {
361  }
362 #endif
363  m_set_State[0] |= 0x10;
364  return m_Final;
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_VARREP_NASUB_BASE_HPP
CNaSub_Base –.
Definition: NaSub_.hpp:77
CNtLocation –.
Definition: NtLocation.hpp:66
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
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
TInitial & SetInitial(void)
Assign a value to Initial data member.
Definition: NaSub_.hpp:309
CSerialObject Tparent
Definition: NaSub_.hpp:78
bool IsSetInitial(void) const
Check if a value has been assigned to Initial data member.
Definition: NaSub_.hpp:274
string m_Initial
Definition: NaSub_.hpp:230
bool IsSetLoc(void) const
Check if a value has been assigned to Loc data member.
Definition: NaSub_.hpp:244
TLoc & SetLoc(void)
Assign a value to Loc data member.
Definition: NaSub_.hpp:265
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: NaSub_.hpp:100
bool IsSetFinal(void) const
Check if a value has been assigned to Final data member.
Definition: NaSub_.hpp:321
virtual void Reset(void)
Reset the whole object.
Definition: NaSub_.cpp:77
CNtLocation TLoc
Definition: NaSub_.hpp:89
string TFinal
Definition: NaSub_.hpp:91
CRef< TLoc > m_Loc
Definition: NaSub_.hpp:229
const TInitial & GetInitial(void) const
Get the Initial member data.
Definition: NaSub_.hpp:286
DECLARE_INTERNAL_TYPE_INFO()
string m_Final
Definition: NaSub_.hpp:231
void ResetFinal(void)
Reset Final data member.
Definition: NaSub_.cpp:71
virtual ~CNaSub_Base(void)
Definition: NaSub_.cpp:106
Uint4 m_set_State[1]
Definition: NaSub_.hpp:228
TFinal & SetFinal(void)
Assign a value to Final data member.
Definition: NaSub_.hpp:356
bool CanGetInitial(void) const
Check if it is safe to call GetInitial method.
Definition: NaSub_.hpp:280
void ResetInitial(void)
Reset Initial data member.
Definition: NaSub_.cpp:65
const TFinal & GetFinal(void) const
Get the Final member data.
Definition: NaSub_.hpp:333
bool CanGetLoc(void) const
Check if it is safe to call GetLoc method.
Definition: NaSub_.hpp:250
void ResetLoc(void)
Reset Loc data member.
Definition: NaSub_.cpp:51
const TLoc & GetLoc(void) const
Get the Loc member data.
Definition: NaSub_.hpp:256
string TInitial
Definition: NaSub_.hpp:90
CNaSub_Base & operator=(const CNaSub_Base &)
CNaSub_Base(void)
Definition: NaSub_.cpp:97
bool CanGetFinal(void) const
Check if it is safe to call GetFinal method.
Definition: NaSub_.hpp:327
CNaSub_Base(const CNaSub_Base &)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:57:09 2024 by modify_doxy.py rev. 669887