NCBI C++ ToolKit
PC_StereoCenter_.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 PC_StereoCenter_.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/pcsubstance/pcsubstance.asn">pcsubstance.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/pcsubstance/pcsubstance.def">pcsubstance.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_PCSUBSTANCE_PC_STEREOCENTER_BASE_HPP
42 #define OBJECTS_PCSUBSTANCE_PC_STEREOCENTER_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
58 class CPC_StereoPlanar;
60 class CPC_StereoTShape;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_NCBI_PCSubstance
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 /// Allowed Stereogenic Center Types
75 /// [Using IUPAC Stereogenic Center recommendations and terminology]
76 ///
77 /// CPC_StereoCenter_Base --
78 ///
79 
81 {
83 public:
84  // constructor
86  // destructor
87  virtual ~CPC_StereoCenter_Base(void);
88 
89  // type info
91 
92 
93  /// Choice variants.
94  enum E_Choice {
95  e_not_set = 0, ///< No variant selected
96  e_Tetrahedral, ///< Tetrahedral (SP3) StereoCenter
97  e_Planar, ///< Planar (SP2) StereoCenter
98  e_Squareplanar, ///< Square Planar (SP4) StereoCenter
99  e_Octahedral, ///< Octahedral (OC-6) / Square Pyramid (SPY-5) StereoCenters
100  e_Bipyramid, ///< Trigonal BiPyramid (TBPY-4 and TBPY-5) StereoCenters
101  e_Tshape, ///< T-Shaped (TS-3) StereoCenters
102  e_Pentagonal ///< Pentagonal BiPyramid (PBPY-7) StereoCenters
103  };
104  /// Maximum+1 value of the choice variant enumerator.
106  e_MaxChoice = 8 ///< == e_Pentagonal+1
107  };
108 
109  /// Reset the whole object
110  virtual void Reset(void);
111 
112  /// Reset the selection (set it to e_not_set).
113  virtual void ResetSelection(void);
114 
115  /// Which variant is currently selected.
116  ///
117  /// @return
118  /// Choice state enumerator.
119  E_Choice Which(void) const;
120 
121  /// Verify selection, throw exception if it differs from the expected.
122  ///
123  /// @param index
124  /// Expected selection.
125  void CheckSelected(E_Choice index) const;
126 
127  /// Throw 'InvalidSelection' exception.
128  ///
129  /// @param index
130  /// Expected selection.
131  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
132 
133  /// Retrieve selection name (for diagnostic purposes).
134  ///
135  /// @param index
136  /// One of possible selection states.
137  /// @return
138  /// Name string.
139  static string SelectionName(E_Choice index);
140 
141  /// Select the requested variant if needed.
142  ///
143  /// @param index
144  /// New selection state.
145  /// @param reset
146  /// Flag that defines the resetting of the variant data. The data will
147  /// be reset if either the current selection differs from the new one,
148  /// or the flag is set to eDoResetVariant.
150  /// Select the requested variant if needed,
151  /// allocating CObject variants from memory pool.
152  void Select(E_Choice index,
153  EResetVariant reset,
154  CObjectMemoryPool* pool);
155 
156  // types
164 
165  // getters
166  // setters
167 
168 
169  /// Check if variant Tetrahedral is selected.
170  ///
171  /// Tetrahedral type is defined as 'typedef CPC_StereoTetrahedral TTetrahedral'.
172  /// @return
173  /// - true, if the variant is selected.
174  /// - false, otherwise.
175  bool IsTetrahedral(void) const;
176 
177  /// Get the variant data.
178  ///
179  /// @return
180  /// Reference to the data.
181  const TTetrahedral& GetTetrahedral(void) const;
182 
183  /// Select the variant.
184  ///
185  /// @return
186  /// Reference to the variant data.
187  TTetrahedral& SetTetrahedral(void);
188  /// Select the variant and set its data.
189  ///
190  /// @param value
191  /// Reference to the data.
192  void SetTetrahedral(TTetrahedral& value);
193 
194 
195  /// Check if variant Planar is selected.
196  ///
197  /// Planar type is defined as 'typedef CPC_StereoPlanar TPlanar'.
198  /// @return
199  /// - true, if the variant is selected.
200  /// - false, otherwise.
201  bool IsPlanar(void) const;
202 
203  /// Get the variant data.
204  ///
205  /// @return
206  /// Reference to the data.
207  const TPlanar& GetPlanar(void) const;
208 
209  /// Select the variant.
210  ///
211  /// @return
212  /// Reference to the variant data.
213  TPlanar& SetPlanar(void);
214  /// Select the variant and set its data.
215  ///
216  /// @param value
217  /// Reference to the data.
218  void SetPlanar(TPlanar& value);
219 
220 
221  /// Check if variant Squareplanar is selected.
222  ///
223  /// Squareplanar type is defined as 'typedef CPC_StereoSquarePlanar TSquareplanar'.
224  /// @return
225  /// - true, if the variant is selected.
226  /// - false, otherwise.
227  bool IsSquareplanar(void) const;
228 
229  /// Get the variant data.
230  ///
231  /// @return
232  /// Reference to the data.
233  const TSquareplanar& GetSquareplanar(void) const;
234 
235  /// Select the variant.
236  ///
237  /// @return
238  /// Reference to the variant data.
239  TSquareplanar& SetSquareplanar(void);
240  /// Select the variant and set its data.
241  ///
242  /// @param value
243  /// Reference to the data.
244  void SetSquareplanar(TSquareplanar& value);
245 
246 
247  /// Check if variant Octahedral is selected.
248  ///
249  /// Octahedral type is defined as 'typedef CPC_StereoOctahedral TOctahedral'.
250  /// @return
251  /// - true, if the variant is selected.
252  /// - false, otherwise.
253  bool IsOctahedral(void) const;
254 
255  /// Get the variant data.
256  ///
257  /// @return
258  /// Reference to the data.
259  const TOctahedral& GetOctahedral(void) const;
260 
261  /// Select the variant.
262  ///
263  /// @return
264  /// Reference to the variant data.
265  TOctahedral& SetOctahedral(void);
266  /// Select the variant and set its data.
267  ///
268  /// @param value
269  /// Reference to the data.
270  void SetOctahedral(TOctahedral& value);
271 
272 
273  /// Check if variant Bipyramid is selected.
274  ///
275  /// Bipyramid type is defined as 'typedef CPC_StereoTrigonalBiPyramid TBipyramid'.
276  /// @return
277  /// - true, if the variant is selected.
278  /// - false, otherwise.
279  bool IsBipyramid(void) const;
280 
281  /// Get the variant data.
282  ///
283  /// @return
284  /// Reference to the data.
285  const TBipyramid& GetBipyramid(void) const;
286 
287  /// Select the variant.
288  ///
289  /// @return
290  /// Reference to the variant data.
291  TBipyramid& SetBipyramid(void);
292  /// Select the variant and set its data.
293  ///
294  /// @param value
295  /// Reference to the data.
296  void SetBipyramid(TBipyramid& value);
297 
298 
299  /// Check if variant Tshape is selected.
300  ///
301  /// Tshape type is defined as 'typedef CPC_StereoTShape TTshape'.
302  /// @return
303  /// - true, if the variant is selected.
304  /// - false, otherwise.
305  bool IsTshape(void) const;
306 
307  /// Get the variant data.
308  ///
309  /// @return
310  /// Reference to the data.
311  const TTshape& GetTshape(void) const;
312 
313  /// Select the variant.
314  ///
315  /// @return
316  /// Reference to the variant data.
317  TTshape& SetTshape(void);
318  /// Select the variant and set its data.
319  ///
320  /// @param value
321  /// Reference to the data.
322  void SetTshape(TTshape& value);
323 
324 
325  /// Check if variant Pentagonal is selected.
326  ///
327  /// Pentagonal type is defined as 'typedef CPC_StereoPentagonalBiPyramid TPentagonal'.
328  /// @return
329  /// - true, if the variant is selected.
330  /// - false, otherwise.
331  bool IsPentagonal(void) const;
332 
333  /// Get the variant data.
334  ///
335  /// @return
336  /// Reference to the data.
337  const TPentagonal& GetPentagonal(void) const;
338 
339  /// Select the variant.
340  ///
341  /// @return
342  /// Reference to the variant data.
343  TPentagonal& SetPentagonal(void);
344  /// Select the variant and set its data.
345  ///
346  /// @param value
347  /// Reference to the data.
348  void SetPentagonal(TPentagonal& value);
349 
350 
351 private:
352  // copy constructor and assignment operator
355  // choice state
357  // helper methods
358  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
359 
360  static const char* const sm_SelectionNames[];
361  // data
362  NCBI_NS_NCBI::CSerialObject *m_object;
363 };
364 
365 /* @} */
366 
367 
368 
369 
370 
371 ///////////////////////////////////////////////////////////
372 ///////////////////// inline methods //////////////////////
373 ///////////////////////////////////////////////////////////
374 inline
376 {
377  return m_choice;
378 }
379 
380 inline
382 {
383  if ( m_choice != index )
384  ThrowInvalidSelection(index);
385 }
386 
387 inline
388 void CPC_StereoCenter_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
389 {
390  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
391  if ( m_choice != e_not_set )
392  ResetSelection();
393  DoSelect(index, pool);
394  }
395 }
396 
397 inline
399 {
400  Select(index, reset, 0);
401 }
402 
403 inline
405 {
406  return m_choice == e_Tetrahedral;
407 }
408 
409 inline
411 {
412  return m_choice == e_Planar;
413 }
414 
415 inline
417 {
418  return m_choice == e_Squareplanar;
419 }
420 
421 inline
423 {
424  return m_choice == e_Octahedral;
425 }
426 
427 inline
429 {
430  return m_choice == e_Bipyramid;
431 }
432 
433 inline
435 {
436  return m_choice == e_Tshape;
437 }
438 
439 inline
441 {
442  return m_choice == e_Pentagonal;
443 }
444 
445 ///////////////////////////////////////////////////////////
446 ////////////////// end of inline methods //////////////////
447 ///////////////////////////////////////////////////////////
448 
449 
450 
451 
452 
453 END_objects_SCOPE // namespace ncbi::objects::
454 
456 
457 
458 #endif // OBJECTS_PCSUBSTANCE_PC_STEREOCENTER_BASE_HPP
Allowed Stereogenic Center Types [Using IUPAC Stereogenic Center recommendations and terminology].
CPC_StereoOctahedral –.
CPC_StereoPentagonalBiPyramid –.
CPC_StereoPlanar –.
CPC_StereoSquarePlanar –.
CPC_StereoTShape –.
CPC_StereoTetrahedral –.
CPC_StereoTrigonalBiPyramid –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
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_PCSUBSTANCE_EXPORT
Definition: ncbi_export.h:688
E_Choice
Choice variants.
E_Choice Which(void) const
Which variant is currently selected.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
CPC_StereoTShape TTshape
CPC_StereoCenter_Base & operator=(const CPC_StereoCenter_Base &)
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
CPC_StereoSquarePlanar TSquareplanar
CPC_StereoTetrahedral TTetrahedral
bool IsBipyramid(void) const
Check if variant Bipyramid is selected.
CPC_StereoPlanar TPlanar
CPC_StereoCenter_Base(const CPC_StereoCenter_Base &)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
NCBI_NS_NCBI::CSerialObject * m_object
bool IsOctahedral(void) const
Check if variant Octahedral is selected.
CPC_StereoTrigonalBiPyramid TBipyramid
CPC_StereoPentagonalBiPyramid TPentagonal
bool IsTetrahedral(void) const
Check if variant Tetrahedral is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
CPC_StereoOctahedral TOctahedral
bool IsPentagonal(void) const
Check if variant Pentagonal is selected.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool IsTshape(void) const
Check if variant Tshape is selected.
bool IsSquareplanar(void) const
Check if variant Squareplanar is selected.
bool IsPlanar(void) const
Check if variant Planar is selected.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
@ e_Octahedral
Octahedral (OC-6) / Square Pyramid (SPY-5) StereoCenters.
@ e_Tshape
T-Shaped (TS-3) StereoCenters.
@ e_Planar
Planar (SP2) StereoCenter.
@ e_Tetrahedral
Tetrahedral (SP3) StereoCenter.
@ e_Bipyramid
Trigonal BiPyramid (TBPY-4 and TBPY-5) StereoCenters.
@ e_Squareplanar
Square Planar (SP4) StereoCenter.
@ e_not_set
No variant selected.
@ e_Pentagonal
Pentagonal BiPyramid (PBPY-7) StereoCenters.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Sep 04 14:59:04 2024 by modify_doxy.py rev. 669887