NCBI C++ ToolKit
Region_boundary_.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 Region_boundary_.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/mmdb3/mmdb3.asn">mmdb3.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/mmdb3/mmdb3.def">mmdb3.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_MMDB3_REGION_BOUNDARY_BASE_HPP
42 #define OBJECTS_MMDB3_REGION_BOUNDARY_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 CBrick;
57 class CCone;
58 class CCylinder;
59 class CSphere;
60 
61 
62 // generated classes
63 
64 
65 /** @addtogroup dataspec_MMDB_Features
66  *
67  * @{
68  */
69 
70 /////////////////////////////////////////////////////////////////////////////
71 /// Region boundaries are defined by regular solids located in the model space.
72 ///
73 /// CRegion_boundary_Base --
74 ///
75 
77 {
79 public:
80  // constructor
82  // destructor
83  virtual ~CRegion_boundary_Base(void);
84 
85  // type info
87 
88 
89  /// Choice variants.
90  enum E_Choice {
91  e_not_set = 0, ///< No variant selected
95  e_Brick
96  };
97  /// Maximum+1 value of the choice variant enumerator.
99  e_MaxChoice = 5 ///< == e_Brick+1
100  };
101 
102  /// Reset the whole object
103  virtual void Reset(void);
104 
105  /// Reset the selection (set it to e_not_set).
106  virtual void ResetSelection(void);
107 
108  /// Which variant is currently selected.
109  ///
110  /// @return
111  /// Choice state enumerator.
112  E_Choice Which(void) const;
113 
114  /// Verify selection, throw exception if it differs from the expected.
115  ///
116  /// @param index
117  /// Expected selection.
118  void CheckSelected(E_Choice index) const;
119 
120  /// Throw 'InvalidSelection' exception.
121  ///
122  /// @param index
123  /// Expected selection.
124  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
125 
126  /// Retrieve selection name (for diagnostic purposes).
127  ///
128  /// @param index
129  /// One of possible selection states.
130  /// @return
131  /// Name string.
132  static string SelectionName(E_Choice index);
133 
134  /// Select the requested variant if needed.
135  ///
136  /// @param index
137  /// New selection state.
138  /// @param reset
139  /// Flag that defines the resetting of the variant data. The data will
140  /// be reset if either the current selection differs from the new one,
141  /// or the flag is set to eDoResetVariant.
143  /// Select the requested variant if needed,
144  /// allocating CObject variants from memory pool.
145  void Select(E_Choice index,
146  EResetVariant reset,
147  CObjectMemoryPool* pool);
148 
149  // types
150  typedef CSphere TSphere;
151  typedef CCone TCone;
153  typedef CBrick TBrick;
154 
155  // getters
156  // setters
157 
158 
159  /// Check if variant Sphere is selected.
160  ///
161  /// Sphere type is defined as 'typedef CSphere TSphere'.
162  /// @return
163  /// - true, if the variant is selected.
164  /// - false, otherwise.
165  bool IsSphere(void) const;
166 
167  /// Get the variant data.
168  ///
169  /// @return
170  /// Reference to the data.
171  const TSphere& GetSphere(void) const;
172 
173  /// Select the variant.
174  ///
175  /// @return
176  /// Reference to the variant data.
177  TSphere& SetSphere(void);
178  /// Select the variant and set its data.
179  ///
180  /// @param value
181  /// Reference to the data.
182  void SetSphere(TSphere& value);
183 
184 
185  /// Check if variant Cone is selected.
186  ///
187  /// Cone type is defined as 'typedef CCone TCone'.
188  /// @return
189  /// - true, if the variant is selected.
190  /// - false, otherwise.
191  bool IsCone(void) const;
192 
193  /// Get the variant data.
194  ///
195  /// @return
196  /// Reference to the data.
197  const TCone& GetCone(void) const;
198 
199  /// Select the variant.
200  ///
201  /// @return
202  /// Reference to the variant data.
203  TCone& SetCone(void);
204  /// Select the variant and set its data.
205  ///
206  /// @param value
207  /// Reference to the data.
208  void SetCone(TCone& value);
209 
210 
211  /// Check if variant Cylinder is selected.
212  ///
213  /// Cylinder type is defined as 'typedef CCylinder TCylinder'.
214  /// @return
215  /// - true, if the variant is selected.
216  /// - false, otherwise.
217  bool IsCylinder(void) const;
218 
219  /// Get the variant data.
220  ///
221  /// @return
222  /// Reference to the data.
223  const TCylinder& GetCylinder(void) const;
224 
225  /// Select the variant.
226  ///
227  /// @return
228  /// Reference to the variant data.
229  TCylinder& SetCylinder(void);
230  /// Select the variant and set its data.
231  ///
232  /// @param value
233  /// Reference to the data.
234  void SetCylinder(TCylinder& value);
235 
236 
237  /// Check if variant Brick is selected.
238  ///
239  /// Brick type is defined as 'typedef CBrick TBrick'.
240  /// @return
241  /// - true, if the variant is selected.
242  /// - false, otherwise.
243  bool IsBrick(void) const;
244 
245  /// Get the variant data.
246  ///
247  /// @return
248  /// Reference to the data.
249  const TBrick& GetBrick(void) const;
250 
251  /// Select the variant.
252  ///
253  /// @return
254  /// Reference to the variant data.
255  TBrick& SetBrick(void);
256  /// Select the variant and set its data.
257  ///
258  /// @param value
259  /// Reference to the data.
260  void SetBrick(TBrick& value);
261 
262 
263 private:
264  // copy constructor and assignment operator
267  // choice state
269  // helper methods
270  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
271 
272  static const char* const sm_SelectionNames[];
273  // data
274  NCBI_NS_NCBI::CSerialObject *m_object;
275 };
276 
277 /* @} */
278 
279 
280 
281 
282 
283 ///////////////////////////////////////////////////////////
284 ///////////////////// inline methods //////////////////////
285 ///////////////////////////////////////////////////////////
286 inline
288 {
289  return m_choice;
290 }
291 
292 inline
294 {
295  if ( m_choice != index )
296  ThrowInvalidSelection(index);
297 }
298 
299 inline
300 void CRegion_boundary_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
301 {
302  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
303  if ( m_choice != e_not_set )
304  ResetSelection();
305  DoSelect(index, pool);
306  }
307 }
308 
309 inline
311 {
312  Select(index, reset, 0);
313 }
314 
315 inline
317 {
318  return m_choice == e_Sphere;
319 }
320 
321 inline
323 {
324  return m_choice == e_Cone;
325 }
326 
327 inline
329 {
330  return m_choice == e_Cylinder;
331 }
332 
333 inline
335 {
336  return m_choice == e_Brick;
337 }
338 
339 ///////////////////////////////////////////////////////////
340 ////////////////// end of inline methods //////////////////
341 ///////////////////////////////////////////////////////////
342 
343 
344 
345 
346 
347 END_objects_SCOPE // namespace ncbi::objects::
348 
350 
351 
352 #endif // OBJECTS_MMDB3_REGION_BOUNDARY_BASE_HPP
CBrick –.
Definition: Brick.hpp:66
CCone –.
Definition: Cone.hpp:66
CCylinder –.
Definition: Cylinder.hpp:66
Region boundaries are defined by regular solids located in the model space.
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSphere –.
Definition: Sphere.hpp:66
char value[7]
Definition: config.c:431
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
#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_MMDB3_EXPORT
Definition: ncbi_export.h:640
NCBI_NS_NCBI::CSerialObject * m_object
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
E_Choice Which(void) const
Which variant is currently selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
CRegion_boundary_Base & operator=(const CRegion_boundary_Base &)
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
bool IsSphere(void) const
Check if variant Sphere is selected.
E_Choice
Choice variants.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsCylinder(void) const
Check if variant Cylinder is selected.
CRegion_boundary_Base(const CRegion_boundary_Base &)
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsBrick(void) const
Check if variant Brick is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
bool IsCone(void) const
Check if variant Cone is selected.
@ e_not_set
No variant selected.
@ e_not_set
Modified on Thu Dec 07 10:12:33 2023 by modify_doxy.py rev. 669887