Open Babel  3.0
cistrans.h
Go to the documentation of this file.
1 /**********************************************************************
2  cistrans.h - Class for handling and storing cis/trans 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_CISTRANS_H
25 #define OB_CISTRANS_H
26 
28 #include <vector>
29 
30 namespace OpenBabel {
31 
34 
76 {
77  public:
98 #ifndef SWIG
99  struct OBAPI Config
100  {
105  Config() : begin(OBStereo::NoRef), end(OBStereo::NoRef), shape(OBStereo::ShapeU),
106  specified(true)
107  { }
116  Config(unsigned long _begin, unsigned long _end, const OBStereo::Refs &_refs,
117  OBStereo::Shape _shape = OBStereo::ShapeU) : begin(_begin), end(_end),
118  refs(_refs), shape(_shape), specified(true)
119  { }
184  bool operator==(const Config &other) const;
190  bool operator!=(const Config &other) const
191  {
192  return !(*this == other);
193  }
194 
199  unsigned long begin, end; //<! The double bond begin and end ids.
202  bool specified;
203 
205  };
206 #endif
207 
210  OBCisTransStereo(OBMol *mol);
214  virtual ~OBCisTransStereo();
215 
218 
230  bool IsValid() const;
231 
235 #ifndef SWIG
236  void SetConfig(const Config &config);
240  Config GetConfig(OBStereo::Shape shape = OBStereo::ShapeU) const;
245  Config GetConfig(unsigned long start,
246  OBStereo::Shape shape = OBStereo::ShapeU) const;
247 #endif
248 
254  bool operator==(const OBCisTransStereo &other) const;
260  bool operator!=(const OBCisTransStereo &other) const
261  {
262  return !(*this == other);
263  }
265 
266  /*
267  * Implement OBGenericData::Clone().
268  */
269  OBGenericData* Clone(OBBase *mol) const;
270 
271 
273 
274 
301  bool IsOnSameAtom(unsigned long id1, unsigned long id2) const;
305  bool IsTrans(unsigned long id1, unsigned long id2) const;
309  bool IsCis(unsigned long id1, unsigned long id2) const;
314  unsigned long GetTransRef(unsigned long id) const;
319  unsigned long GetCisRef(unsigned long id) const;
321 
322  private:
323  Config m_cfg;
324  // The following function sits behind GetCisRef and GetTransRef
325  unsigned long GetCisOrTransRef(unsigned long id, bool getcisref) const;
326 };
328 
329 } // namespace OpenBabel
330 
331 #ifndef SWIG
332 namespace std {
333 
336 
353 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBCisTransStereo &ct);
368 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBCisTransStereo::Config &cfg);
369 
371 
372 } // namespace std
373 #endif // Not SWIG
374 
375 #endif
376 
OBStereo::Type GetType() const
Definition: cistrans.h:222
Base class for generic data.
Definition: base.h:188
Config()
Definition: cistrans.h:105
Class for handling and storing cis/trans stereochemistry.
Definition: cistrans.h:75
Placeholder for enums & Ref/Refs related functions.
Definition: stereo.h:75
Definition: stereo.h:109
Molecule Class.
Definition: mol.h:118
Config(unsigned long _begin, unsigned long _end, const OBStereo::Refs &_refs, OBStereo::Shape _shape=OBStereo::ShapeU)
Definition: cistrans.h:116
Base class for handling and storing planar stereochemistry with 4 reference atoms.
Definition: tetraplanar.h:83
cis/trans double bond
Definition: stereo.h:81
OBStereo::Refs refs
The 4 reference ids.
Definition: cistrans.h:200
Shape
Definition: stereo.h:108
unsigned long end
Definition: cistrans.h:199
OBStereo::Shape shape
The shape of the 4 reference ids.
Definition: cistrans.h:201
STL namespace.
bool specified
Definition: cistrans.h:202
bool operator!=(const OBCisTransStereo &other) const
Definition: cistrans.h:260
Stereochemical configuration for double-bond cis/trans stereochemistry.
Definition: cistrans.h:99
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
Type
Definition: stereo.h:80
Base Class.
Definition: base.h:239
bool operator!=(const Config &other) const
Definition: cistrans.h:190
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