tetrahedral.h
Go to the documentation of this file.
00001 /**********************************************************************
00002   tetrahedral.h - OBTetrahedralStereo
00003 
00004   Copyright (C) 2009 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_TETRAHEDRAL_H
00025 #define OB_TETRAHEDRAL_H
00026 
00027 #include <openbabel/stereo/tetranonplanar.h>
00028 
00029 namespace OpenBabel {
00030 
00033 
00058 class OBAPI OBTetrahedralStereo : public OBTetraNonPlanarStereo
00059 {
00060   public:
00061 #ifndef SWIG
00062 
00084     struct OBAPI Config
00085     {
00091       Config() : center(OBStereo::NoRef), from(OBStereo::NoRef),
00092           winding(OBStereo::Clockwise), view(OBStereo::ViewFrom),
00093           specified(true)
00094       {  }
00104       Config(unsigned long _center, unsigned long from_or_towards,
00105           const OBStereo::Refs &_refs, OBStereo::Winding _winding = OBStereo::Clockwise,
00106           OBStereo::View _view = OBStereo::ViewFrom) : center(_center),
00107           from(from_or_towards), refs(_refs), winding(_winding), view(_view),
00108           specified(true)
00109       {  }
00149       bool operator==(const Config &other) const;
00155       bool operator!=(const Config &other) const
00156       {
00157         return !(*this == other);
00158       }
00159 
00164       unsigned long center; //<! The center (chiral) atom id.
00172       union {
00173         unsigned long from; //<! The viewing from atom id.
00174         unsigned long towards; //<! The viewing towards id.
00175       };
00176       OBStereo::Refs refs; 
00177       OBStereo::Winding winding; //<! The winding for the 3 reference ids.
00178       OBStereo::View view; 
00179       bool specified; 
00180 
00181 
00182     };
00183 #endif
00184 
00187     OBTetrahedralStereo(OBMol *mol);
00191     virtual ~OBTetrahedralStereo();
00192 
00195 
00199     OBStereo::Type GetType() const { return OBStereo::Tetrahedral; }
00204     bool IsValid() const;
00205 #ifndef SWIG
00206 
00209     void SetConfig(const Config &config);
00213     Config GetConfig(OBStereo::Winding winding = OBStereo::Clockwise,
00214         OBStereo::View view = OBStereo::ViewFrom) const;
00218     Config GetConfig(unsigned long from_or_towards,
00219         OBStereo::Winding winding = OBStereo::Clockwise,
00220         OBStereo::View view = OBStereo::ViewFrom) const;
00221 #endif
00222 
00228     bool operator==(const OBTetrahedralStereo &other) const;
00234     bool operator!=(const OBTetrahedralStereo &other) const
00235     {
00236       return !(*this == other);
00237     }
00239 
00240     /*
00241      * Implement OBGenericData::Clone().
00242      */
00243     OBGenericData* Clone(OBBase *mol) const;
00244   private:
00245     Config m_cfg; 
00246 };
00248 // end addtogroup doxygen
00249 
00250 } // namespace OpenBabel
00251 
00252 #ifndef SWIG
00253 namespace std {
00254 
00257 
00275 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBTetrahedralStereo &ts);
00291 OBAPI ostream& operator<<(ostream &out, const OpenBabel::OBTetrahedralStereo::Config &cfg);
00292 
00294 
00295 } // namespace std
00296 #endif // SWIG
00297 
00298 #endif
00299 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines