Open Babel  3.0
squareplanar.h
Go to the documentation of this file.
1 /**********************************************************************
2  squareplanar.h - Class for handling and storing squareplanar stereochemistry.
3 
4  Copyright (C) 2009-2010 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_SQUAREPLANAR_H
25 #define OB_SQUAREPLANAR_H
26 
28 #include <vector>
29 
30 namespace OpenBabel {
31 
34 
49 {
50  public:
70 #ifndef SWIG
71  struct OBAPI Config
72  {
77  Config() : center(OBStereo::NoRef), shape(OBStereo::ShapeU),
78  specified(true)
79  { }
87  Config(unsigned long _center, const OBStereo::Refs &_refs,
88  OBStereo::Shape _shape = OBStereo::ShapeU) : center(_center),
89  refs(_refs), shape(_shape), specified(true)
90  { }
155  bool operator==(const Config &other) const;
161  bool operator!=(const Config &other) const
162  {
163  return !(*this == other);
164  }
165 
170  unsigned long center; //<! The central atom id.
173  bool specified;
174 
176  };
177 #endif
178 
185  virtual ~OBSquarePlanarStereo();
186 
189 
198  bool IsValid() const;
199 
203 #ifndef SWIG
204  void SetConfig(const Config &config);
208  Config GetConfig(OBStereo::Shape shape = OBStereo::ShapeU) const;
213  Config GetConfig(unsigned long start,
214  OBStereo::Shape shape = OBStereo::ShapeU) const;
215 #endif
216 
222  bool operator==(const OBSquarePlanarStereo &other) const;
228  bool operator!=(const OBSquarePlanarStereo &other) const
229  {
230  return !(*this == other);
231  }
233 
234  /*
235  * Implement OBGenericData::Clone().
236  */
237  OBGenericData* Clone(OBBase *mol) const;
238 
240 
241 
244  bool IsTrans(unsigned long id1, unsigned long id2) const;
248  bool IsCis(unsigned long id1, unsigned long id2) const;
253  unsigned long GetTransRef(unsigned long id) const;
257  std::vector<unsigned long> GetCisRefs(unsigned long id) const;
259 
260  private:
261  Config m_cfg;
262  // The following function sits behind GetCisRef and GetTransRef
263  unsigned long GetCisOrTransRef(unsigned long id, bool getcisref) const;
264 };
266 // end addtogroup doxygen
267 
268 } // namespace OpenBabel
269 
270 #ifndef SWIG
271 namespace std {
272 
275 
291 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBSquarePlanarStereo &ct);
305 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBSquarePlanarStereo::Config &cfg);
306 
308 
309 } // namespace std
310 #endif // Not SWIG
311 
312 #endif
313 
bool specified
Definition: squareplanar.h:173
Stereochemical configuration for square planar stereocenters.
Definition: squareplanar.h:71
Base class for generic data.
Definition: base.h:188
OBStereo::Shape shape
The shape of the 4 reference ids.
Definition: squareplanar.h:172
OBStereo::Type GetType() const
Definition: squareplanar.h:193
Placeholder for enums & Ref/Refs related functions.
Definition: stereo.h:75
Definition: stereo.h:109
Molecule Class.
Definition: mol.h:118
Base class for handling and storing planar stereochemistry with 4 reference atoms.
Definition: tetraplanar.h:83
Shape
Definition: stereo.h:108
bool operator!=(const Config &other) const
Definition: squareplanar.h:161
STL namespace.
Config(unsigned long _center, const OBStereo::Refs &_refs, OBStereo::Shape _shape=OBStereo::ShapeU)
Definition: squareplanar.h:87
unsigned long center
Definition: squareplanar.h:170
OBStereo::Refs refs
The 4 reference ids.
Definition: squareplanar.h:171
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 square planar stereochemistry.
Definition: squareplanar.h:48
bool operator!=(const OBSquarePlanarStereo &other) const
Definition: squareplanar.h:228
Square-planar stereochemistry.
Definition: stereo.h:83
Config()
Definition: squareplanar.h:77
Type
Definition: stereo.h:80
Base Class.
Definition: base.h:239
Base class for handling and storing planar stereochemistry with 4 reference atoms.
bool operator==(const OBBitVec &bv1, const OBBitVec &bv2)
Definition: bitvec.cpp:525
Global namespace for all Open Babel code.
Definition: alias.h:22