NCBI C++ ToolKit
BioTreeContainer_.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 BioTreeContainer_.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/biotree/biotree.asn">biotree.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/biotree/biotree.def">biotree.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_BIOTREE_BIOTREECONTAINER_BASE_HPP
42 #define OBJECTS_BIOTREE_BIOTREECONTAINER_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 CFeatureDictSet;
61 class CNodeSet;
62 class CUser_object;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_BioTree
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 ///
75 /// CBioTreeContainer_Base --
76 ///
77 
79 {
81 public:
82  // constructor
84  // destructor
85  virtual ~CBioTreeContainer_Base(void);
86 
87  // type info
89 
90  // types
91  typedef string TTreetype;
93  typedef CNodeSet TNodes;
94  typedef string TLabel;
96 
97  // member index
98  enum class E_memberIndex {
99  e__allMandatory = 0,
100  e_treetype,
101  e_fdict,
102  e_nodes,
103  e_label,
104  e_user
105  };
107 
108  // getters
109  // setters
110 
111  /// hint on what kind of tree this is
112  /// Check if a value has been assigned to Treetype data member.
113  ///
114  /// Data member Treetype is optional;
115  /// its type is defined as 'typedef string TTreetype'
116  /// @return
117  /// - true, if a value has been assigned.
118  /// - false, otherwise.
119  bool IsSetTreetype(void) const;
120 
121  /// Check if it is safe to call GetTreetype method.
122  ///
123  /// @return
124  /// - true, if the data member is getatable.
125  /// - false, otherwise.
126  bool CanGetTreetype(void) const;
127 
128  /// Reset Treetype data member.
129  void ResetTreetype(void);
130 
131  /// Get the Treetype member data.
132  ///
133  /// @return
134  /// Reference to the member data.
135  const TTreetype& GetTreetype(void) const;
136 
137  /// Assign a value to Treetype data member.
138  ///
139  /// @param value
140  /// Value to assign
141  void SetTreetype(const TTreetype& value);
142  void SetTreetype(TTreetype&& value);
143 
144  /// Assign a value to Treetype data member.
145  ///
146  /// @return
147  /// Reference to the data value.
148  TTreetype& SetTreetype(void);
149 
150  /// features dictionary
151  /// Check if a value has been assigned to Fdict data member.
152  ///
153  /// Data member Fdict is mandatory;
154  /// its type is defined as 'typedef CFeatureDictSet TFdict'
155  /// @return
156  /// - true, if a value has been assigned.
157  /// - false, otherwise.
158  bool IsSetFdict(void) const;
159 
160  /// Check if it is safe to call GetFdict method.
161  ///
162  /// @return
163  /// - true, if the data member is getatable.
164  /// - false, otherwise.
165  bool CanGetFdict(void) const;
166 
167  /// Reset Fdict data member.
168  void ResetFdict(void);
169 
170  /// Get the Fdict member data.
171  ///
172  /// @return
173  /// Reference to the member data.
174  const TFdict& GetFdict(void) const;
175 
176  /// Assign a value to Fdict data member.
177  ///
178  /// @param value
179  /// Reference to value.
180  void SetFdict(TFdict& value);
181 
182  /// Assign a value to Fdict data member.
183  ///
184  /// @return
185  /// Reference to the data value.
186  TFdict& SetFdict(void);
187 
188  /// set of nodes with encoded topology
189  /// Check if a value has been assigned to Nodes data member.
190  ///
191  /// Data member Nodes is mandatory;
192  /// its type is defined as 'typedef CNodeSet TNodes'
193  /// @return
194  /// - true, if a value has been assigned.
195  /// - false, otherwise.
196  bool IsSetNodes(void) const;
197 
198  /// Check if it is safe to call GetNodes method.
199  ///
200  /// @return
201  /// - true, if the data member is getatable.
202  /// - false, otherwise.
203  bool CanGetNodes(void) const;
204 
205  /// Reset Nodes data member.
206  void ResetNodes(void);
207 
208  /// Get the Nodes member data.
209  ///
210  /// @return
211  /// Reference to the member data.
212  const TNodes& GetNodes(void) const;
213 
214  /// Assign a value to Nodes data member.
215  ///
216  /// @param value
217  /// Reference to value.
218  void SetNodes(TNodes& value);
219 
220  /// Assign a value to Nodes data member.
221  ///
222  /// @return
223  /// Reference to the data value.
224  TNodes& SetNodes(void);
225 
226  /// bio-tree label (short name)
227  /// Check if a value has been assigned to Label data member.
228  ///
229  /// Data member Label is optional;
230  /// its type is defined as 'typedef string TLabel'
231  /// @return
232  /// - true, if a value has been assigned.
233  /// - false, otherwise.
234  bool IsSetLabel(void) const;
235 
236  /// Check if it is safe to call GetLabel method.
237  ///
238  /// @return
239  /// - true, if the data member is getatable.
240  /// - false, otherwise.
241  bool CanGetLabel(void) const;
242 
243  /// Reset Label data member.
244  void ResetLabel(void);
245 
246  /// Get the Label member data.
247  ///
248  /// @return
249  /// Reference to the member data.
250  const TLabel& GetLabel(void) const;
251 
252  /// Assign a value to Label data member.
253  ///
254  /// @param value
255  /// Value to assign
256  void SetLabel(const TLabel& value);
257  void SetLabel(TLabel&& value);
258 
259  /// Assign a value to Label data member.
260  ///
261  /// @return
262  /// Reference to the data value.
263  TLabel& SetLabel(void);
264 
265  /// user defined object
266  /// Check if a value has been assigned to User data member.
267  ///
268  /// Data member User is optional;
269  /// its type is defined as 'typedef CUser_object TUser'
270  /// @return
271  /// - true, if a value has been assigned.
272  /// - false, otherwise.
273  bool IsSetUser(void) const;
274 
275  /// Check if it is safe to call GetUser method.
276  ///
277  /// @return
278  /// - true, if the data member is getatable.
279  /// - false, otherwise.
280  bool CanGetUser(void) const;
281 
282  /// Reset User data member.
283  void ResetUser(void);
284 
285  /// Get the User member data.
286  ///
287  /// @return
288  /// Reference to the member data.
289  const TUser& GetUser(void) const;
290 
291  /// Assign a value to User data member.
292  ///
293  /// @param value
294  /// Reference to value.
295  void SetUser(TUser& value);
296 
297  /// Assign a value to User data member.
298  ///
299  /// @return
300  /// Reference to the data value.
301  TUser& SetUser(void);
302 
303  /// Reset the whole object
304  virtual void Reset(void);
305 
306 
307 private:
308  // Prohibit copy constructor and assignment operator
311 
312  // data
313  Uint4 m_set_State[1];
314  string m_Treetype;
317  string m_Label;
319 };
320 
321 /* @} */
322 
323 
324 
325 
326 
327 ///////////////////////////////////////////////////////////
328 ///////////////////// inline methods //////////////////////
329 ///////////////////////////////////////////////////////////
330 inline
332 {
333  return ((m_set_State[0] & 0x3) != 0);
334 }
335 
336 inline
338 {
339  return IsSetTreetype();
340 }
341 
342 inline
344 {
345  if (!CanGetTreetype()) {
346  ThrowUnassigned(0);
347  }
348  return m_Treetype;
349 }
350 
351 inline
353 {
354  m_Treetype = value;
355  m_set_State[0] |= 0x3;
356 }
357 
358 inline
360 {
361  m_Treetype = std::forward<CBioTreeContainer_Base::TTreetype>(value);
362  m_set_State[0] |= 0x3;
363 }
364 
365 inline
367 {
368 #ifdef _DEBUG
369  if (!IsSetTreetype()) {
371  }
372 #endif
373  m_set_State[0] |= 0x1;
374  return m_Treetype;
375 }
376 
377 inline
379 {
380  return m_Fdict.NotEmpty();
381 }
382 
383 inline
385 {
386  return true;
387 }
388 
389 inline
391 {
392  if ( !m_Fdict ) {
393  const_cast<CBioTreeContainer_Base*>(this)->ResetFdict();
394  }
395  return (*m_Fdict);
396 }
397 
398 inline
400 {
401  if ( !m_Fdict ) {
402  ResetFdict();
403  }
404  return (*m_Fdict);
405 }
406 
407 inline
409 {
410  return m_Nodes.NotEmpty();
411 }
412 
413 inline
415 {
416  return true;
417 }
418 
419 inline
421 {
422  if ( !m_Nodes ) {
423  const_cast<CBioTreeContainer_Base*>(this)->ResetNodes();
424  }
425  return (*m_Nodes);
426 }
427 
428 inline
430 {
431  if ( !m_Nodes ) {
432  ResetNodes();
433  }
434  return (*m_Nodes);
435 }
436 
437 inline
439 {
440  return ((m_set_State[0] & 0xc0) != 0);
441 }
442 
443 inline
445 {
446  return IsSetLabel();
447 }
448 
449 inline
451 {
452  if (!CanGetLabel()) {
453  ThrowUnassigned(3);
454  }
455  return m_Label;
456 }
457 
458 inline
460 {
461  m_Label = value;
462  m_set_State[0] |= 0xc0;
463 }
464 
465 inline
467 {
468  m_Label = std::forward<CBioTreeContainer_Base::TLabel>(value);
469  m_set_State[0] |= 0xc0;
470 }
471 
472 inline
474 {
475 #ifdef _DEBUG
476  if (!IsSetLabel()) {
478  }
479 #endif
480  m_set_State[0] |= 0x40;
481  return m_Label;
482 }
483 
484 inline
486 {
487  return m_User.NotEmpty();
488 }
489 
490 inline
492 {
493  return IsSetUser();
494 }
495 
496 inline
498 {
499  if (!CanGetUser()) {
500  ThrowUnassigned(4);
501  }
502  return (*m_User);
503 }
504 
505 ///////////////////////////////////////////////////////////
506 ////////////////// end of inline methods //////////////////
507 ///////////////////////////////////////////////////////////
508 
509 
510 
511 
512 
513 END_objects_SCOPE // namespace ncbi::objects::
514 
516 
517 
518 #endif // OBJECTS_BIOTREE_BIOTREECONTAINER_BASE_HPP
CBioTreeContainer_Base –.
CFeatureDictSet –.
CNodeSet –.
Definition: NodeSet.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
string GetLabel(const CSeq_id &id)
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_BIOTREE_EXPORT
Definition: ncbi_export.h:320
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
const TTreetype & GetTreetype(void) const
Get the Treetype member data.
TFdict & SetFdict(void)
Assign a value to Fdict data member.
TLabel & SetLabel(void)
Assign a value to Label data member.
bool CanGetNodes(void) const
Check if it is safe to call GetNodes method.
CBioTreeContainer_Base(const CBioTreeContainer_Base &)
TNodes & SetNodes(void)
Assign a value to Nodes data member.
bool IsSetLabel(void) const
bio-tree label (short name) Check if a value has been assigned to Label data member.
bool CanGetFdict(void) const
Check if it is safe to call GetFdict method.
bool CanGetTreetype(void) const
Check if it is safe to call GetTreetype method.
bool IsSetFdict(void) const
features dictionary Check if a value has been assigned to Fdict data member.
bool CanGetUser(void) const
Check if it is safe to call GetUser method.
const TLabel & GetLabel(void) const
Get the Label member data.
CBioTreeContainer_Base & operator=(const CBioTreeContainer_Base &)
const TUser & GetUser(void) const
Get the User member data.
bool IsSetUser(void) const
user defined object Check if a value has been assigned to User data member.
void ResetFdict(void)
Reset Fdict data member.
void ResetNodes(void)
Reset Nodes data member.
bool IsSetTreetype(void) const
hint on what kind of tree this is Check if a value has been assigned to Treetype data member.
const TFdict & GetFdict(void) const
Get the Fdict member data.
bool CanGetLabel(void) const
Check if it is safe to call GetLabel method.
const TNodes & GetNodes(void) const
Get the Nodes member data.
bool IsSetNodes(void) const
set of nodes with encoded topology Check if a value has been assigned to Nodes data member.
TTreetype & SetTreetype(void)
Assign a value to Treetype data member.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:58:32 2024 by modify_doxy.py rev. 669887