Open Babel  3.0
tetrahedral.h
Go to the documentation of this file.
1 /**********************************************************************
2  tetrahedral.h - OBTetrahedralStereo
3 
4  Copyright (C) 2009 by Tim Vandermeersch
5 
6  This file is part of the Open Babel project.
7  For more information, see <http://openbabel.org/>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  02110-1301, USA.
23  **********************************************************************/
24 #ifndef OB_TETRAHEDRAL_H
25 #define OB_TETRAHEDRAL_H
26 
28 
29 namespace OpenBabel {
30 
33 
59 {
60  public:
61 #ifndef SWIG
62 
84  struct OBAPI Config
85  {
91  Config() : center(OBStereo::NoRef), from(OBStereo::NoRef),
92  winding(OBStereo::Clockwise), view(OBStereo::ViewFrom),
93  specified(true)
94  { }
104  Config(unsigned long _center, unsigned long from_or_towards,
105  const OBStereo::Refs &_refs, OBStereo::Winding _winding = OBStereo::Clockwise,
106  OBStereo::View _view = OBStereo::ViewFrom) : center(_center),
107  from(from_or_towards), refs(_refs), winding(_winding), view(_view),
108  specified(true)
109  { }
149  bool operator==(const Config &other) const;
155  bool operator!=(const Config &other) const
156  {
157  return !(*this == other);
158  }
159 
164  unsigned long center; //<! The center (chiral) atom id.
172  union {
173  unsigned long from; //<! The viewing from atom id.
174  unsigned long towards; //<! The viewing towards id.
175  };
177  OBStereo::Winding winding; //<! The winding for the 3 reference ids.
179  bool specified;
180 
182  };
183 #endif
184 
191  virtual ~OBTetrahedralStereo();
192 
195 
204  bool IsValid() const;
205 #ifndef SWIG
206 
209  void SetConfig(const Config &config);
213  Config GetConfig(OBStereo::Winding winding = OBStereo::Clockwise,
214  OBStereo::View view = OBStereo::ViewFrom) const;
218  Config GetConfig(unsigned long from_or_towards,
220  OBStereo::View view = OBStereo::ViewFrom) const;
221 #endif
222 
228  bool operator==(const OBTetrahedralStereo &other) const;
234  bool operator!=(const OBTetrahedralStereo &other) const
235  {
236  return !(*this == other);
237  }
239 
240  /*
241  * Implement OBGenericData::Clone().
242  */
243  OBGenericData* Clone(OBBase *mol) const;
244  private:
245  Config m_cfg;
246 };
248 // end addtogroup doxygen
249 
250 } // namespace OpenBabel
251 
252 #ifndef SWIG
253 namespace std {
254 
257 
275 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBTetrahedralStereo &ts);
291 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBTetrahedralStereo::Config &cfg);
292 
294 
295 } // namespace std
296 #endif // SWIG
297 
298 #endif
299 
OBStereo::Refs refs
The 3 reference ids.
Definition: tetrahedral.h:176
Base class for generic data.
Definition: base.h:188
Config(unsigned long _center, unsigned long from_or_towards, const OBStereo::Refs &_refs, OBStereo::Winding _winding=OBStereo::Clockwise, OBStereo::View _view=OBStereo::ViewFrom)
Definition: tetrahedral.h:104
unsigned long from
Definition: tetrahedral.h:173
Clockwise winding.
Definition: stereo.h:131
bool operator!=(const Config &other) const
Definition: tetrahedral.h:155
OBStereo::View view
Specify viewing from or towards the atom with from/towards id.
Definition: tetrahedral.h:178
Placeholder for enums & Ref/Refs related functions.
Definition: stereo.h:75
Molecule Class.
Definition: mol.h:118
bool operator!=(const OBTetrahedralStereo &other) const
Definition: tetrahedral.h:234
View
Definition: stereo.h:119
bool specified
Definition: tetrahedral.h:179
Config()
Definition: tetrahedral.h:91
Stereochemical configuration for tetrahedral stereocenters.
Definition: tetrahedral.h:84
unsigned long towards
Definition: tetrahedral.h:174
STL namespace.
view from the atom (id parameter) towards the center atom
Definition: stereo.h:121
Winding
Definition: stereo.h:130
Base class for handling and storing non-planar stereochemistry with 4 reference atom ids...
Definition: tetranonplanar.h:91
OBStereo::Type GetType() const
Definition: tetrahedral.h:199
std::ostream & operator<<(std::ostream &, const vector3 &)
Prints a representation of the vector as a row vector of the form "<0.1,1,2>".
Definition: vector3.cpp:109
std::vector< Ref > Refs
Definition: stereo.h:156
Class for handling and storing tetrahedral atom stereochemistry.
Definition: tetrahedral.h:58
unsigned long center
Definition: tetrahedral.h:164
OBStereo::Winding winding
Definition: tetrahedral.h:177
Base class for handling and storing non-planar stereochemistry with 4 reference atom ids...
Type
Definition: stereo.h:80
Base Class.
Definition: base.h:239
bool operator==(const OBBitVec &bv1, const OBBitVec &bv2)
Definition: bitvec.cpp:525
tetrahedral
Definition: stereo.h:84
Global namespace for all Open Babel code.
Definition: alias.h:22