MolChemicalFeature.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 #ifndef __MOLCHEMICALFEATURE_H_11012005_1404__
00011 #define __MOLCHEMICALFEATURE_H_11012005_1404__
00012 
00013 #include <string>
00014 #include <vector>
00015 #include <map>
00016 #include <Geometry/point.h>
00017 #include <ChemicalFeatures/ChemicalFeature.h>
00018 
00019 namespace RDKit {
00020   class ROMol;
00021   class Atom;
00022   class MolChemicalFeatureFactory;
00023   class MolChemicalFeatureDef;
00024   
00025   
00026   class MolChemicalFeature : public ChemicalFeatures::ChemicalFeature {
00027 
00028     friend class MolChemicalFeatureFactory;
00029   public:
00030     typedef std::vector<const Atom *> AtomPtrContainer;
00031     typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
00032 
00033     //! Constructor
00034     MolChemicalFeature(const ROMol *mol,
00035                        const MolChemicalFeatureFactory *factory,
00036                        const MolChemicalFeatureDef *fdef) :
00037       dp_mol(mol), dp_factory(factory), dp_def(fdef), d_activeConf(-1) {};
00038 
00039     ~MolChemicalFeature() {}
00040 
00041     //! \brief return the name of the feature's family
00042     const std::string &getFamily() const;
00043     //! \brief return the name of the feature's type
00044     const std::string &getType() const;
00045     //! \brief return the position of the feature (obtained from
00046     //! from the associated conformation
00047     RDGeom::Point3D getPos() const;
00048 
00049     //! \brief return the position of the feature (obtained from
00050     //! from the requested conformation from the associated molecule)
00051     RDGeom::Point3D getPos(int confId) const;
00052     //! \brief return a pointer to our feature factory
00053     const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
00054     //! \brief return a pointer to our associated molecule
00055     const ROMol *getMol() const { return dp_mol; };
00056     //! \brief return a pointer to our feature definition
00057     const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
00058     
00059     //! \brief returns the number of atoms defining the feature
00060     inline unsigned int getNumAtoms() const {
00061       return d_atoms.size();
00062     }
00063 
00064     //! \brief sets the active conformer (in the associated molecule)
00065     void setActiveConformer(int confId);
00066 
00067     //! \brief returns the active conformer (in the associated molecule)
00068     int getActiveConformer() const { return d_activeConf;};
00069 
00070     //! \brief clears out the internal position cache
00071     void clearCache() { d_locs.clear(); };
00072     
00073     //! \brief returns our atom container of
00074     const AtomPtrContainer &getAtoms() const {
00075       return d_atoms;
00076     }
00077     AtomPtrContainer::const_iterator beginAtoms() const { return d_atoms.begin(); };
00078     AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); };
00079 
00080   private:
00081     typedef std::map<int,RDGeom::Point3D> PointCacheType;
00082     const ROMol *dp_mol;
00083     const MolChemicalFeatureFactory *dp_factory;
00084     const MolChemicalFeatureDef *dp_def;
00085     //std::string d_type;
00086     //std::string d_family;
00087 
00088     int d_activeConf;
00089     AtomPtrContainer d_atoms;
00090     mutable PointCacheType d_locs;
00091   };
00092   
00093 }
00094 
00095 #endif