squareplanar.h
Go to the documentation of this file.
00001 /**********************************************************************
00002   squareplanar.h - Class for handling and storing squareplanar stereochemistry.
00003 
00004   Copyright (C) 2009-2010 by Tim Vandermeersch
00005 
00006   This file is part of the Open Babel project.
00007   For more information, see <http://openbabel.org/>
00008 
00009   This program is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   This program is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 #ifndef OB_SQUAREPLANAR_H
00025 #define OB_SQUAREPLANAR_H
00026 
00027 #include <openbabel/stereo/tetraplanar.h>
00028 #include <vector>
00029 
00030 namespace OpenBabel {
00031 
00034 
00048 class OBAPI OBSquarePlanarStereo : public OBTetraPlanarStereo
00049 {
00050   public:
00070 #ifndef SWIG
00071     struct OBAPI Config
00072     {
00077       Config() : center(OBStereo::NoRef), shape(OBStereo::ShapeU),
00078           specified(true)
00079       {  }
00087       Config(unsigned long _center, const OBStereo::Refs &_refs,
00088           OBStereo::Shape _shape = OBStereo::ShapeU) : center(_center),
00089           refs(_refs), shape(_shape), specified(true)
00090       {  }
00155       bool operator==(const Config &other) const;
00161       bool operator!=(const Config &other) const
00162       {
00163         return !(*this == other);
00164       }
00165 
00170       unsigned long center; //<! The central atom id.
00171       OBStereo::Refs refs; 
00172       OBStereo::Shape shape; 
00173       bool specified; 
00174 
00175 
00176     };
00177 #endif
00178 
00181     OBSquarePlanarStereo(OBMol *mol);
00185     virtual ~OBSquarePlanarStereo();
00186 
00189 
00193     OBStereo::Type GetType() const { return OBStereo::SquarePlanar; }
00198     bool IsValid() const;
00199 
00203 #ifndef SWIG
00204     void SetConfig(const Config &config);
00208     Config GetConfig(OBStereo::Shape shape = OBStereo::ShapeU) const;
00213     Config GetConfig(unsigned long start,
00214         OBStereo::Shape shape = OBStereo::ShapeU) const;
00215 #endif
00216 
00222     bool operator==(const OBSquarePlanarStereo &other) const;
00228     bool operator!=(const OBSquarePlanarStereo &other) const
00229     {
00230       return !(*this == other);
00231     }
00233 
00234     /*
00235      * Implement OBGenericData::Clone().
00236      */
00237     OBGenericData* Clone(OBBase *mol) const;
00238 
00240 
00241 
00244     bool IsTrans(unsigned long id1, unsigned long id2) const;
00248     bool IsCis(unsigned long id1, unsigned long id2) const;
00253     unsigned long GetTransRef(unsigned long id) const;
00257     std::vector<unsigned long> GetCisRefs(unsigned long id) const;
00259 
00260   private:
00261     Config m_cfg; 
00262     // The following function sits behind GetCisRef and GetTransRef
00263     unsigned long GetCisOrTransRef(unsigned long id, bool getcisref) const;
00264 };
00266 // end addtogroup doxygen
00267 
00268 } // namespace OpenBabel
00269 
00270 #ifndef SWIG
00271 namespace std {
00272 
00275 
00291 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBSquarePlanarStereo &ct);
00305 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBSquarePlanarStereo::Config &cfg);
00306 
00308 
00309 } // namespace std
00310 #endif // Not SWIG
00311 
00312 #endif
00313 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines