RDCode: MolChemicalFeatureFactory.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# MolChemicalFeatureFactory.h

Go to the documentation of this file.

    00001 //
    00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
    00003 //
    00004 //   @@ All Rights Reserved  @@
    00005 //
    00006 #ifndef __CHEMICALFEATUREFACTORY_H_02122004_1545__
    00007 #define __CHEMICALFEATUREFACTORY_H_02122004_1545__
    00008
    00009 #include "MolChemicalFeatureDef.h"
    00010 #include <iostream>
    00011 #include <boost/shared_ptr.hpp>
    00012
    00013 namespace RDKit {
    00014   class MolChemicalFeature;
    00015   typedef boost::shared_ptr<MolChemicalFeature> FeatSPtr;
    00016   typedef std::list< FeatSPtr > FeatSPtrList;
    00017   typedef FeatSPtrList::iterator FeatSPtrList_I;
    00018
    00019   //! The class for finding chemical features in molecules
    00020   class MolChemicalFeatureFactory {
    00021   public:
    00022
    00023     //! returns the number of feature definitions
    00024     int getNumFeatureDefs() const {return d_featDefs.size();};
    00025
    00026     //! returns an iterator referring to the first feature definition
    00027     MolChemicalFeatureDef::CollectionType::iterator
    00028     beginFeatureDefs() { return d_featDefs.begin(); };
    00029     //! returns an iterator referring to the end of the feature definitions
    00030     MolChemicalFeatureDef::CollectionType::iterator
    00031     endFeatureDefs() { return d_featDefs.end(); };
    00032
    00033     //! returns a const_iterator referring to the first feature definition
    00034     MolChemicalFeatureDef::CollectionType::const_iterator
    00035     beginFeatureDefs() const { return d_featDefs.begin(); };
    00036     //! returns a const_iterator referring to the end of the feature definitions
    00037     MolChemicalFeatureDef::CollectionType::const_iterator
    00038     endFeatureDefs() const { return d_featDefs.end(); };
    00039
    00040     //! appends a feature definition to the collection of features defs.
    00041     void addFeatureDef(MolChemicalFeatureDef::CollectionType::value_type featDef){
    00042       d_featDefs.push_back(featDef);
    00043     }
    00044
    00045     //! returns a list of features on the molecule
    00046     /*!
    00047       \param mol          The molecule of interest
    00048       \param includeOnly  (optional) if this is non-null, only features in this
    00049                           family will be returned
    00050     */
    00051     FeatSPtrList getFeaturesForMol(const ROMol &mol,const char *includeOnly="") const;
    00052
    00053   private:
    00054     MolChemicalFeatureDef::CollectionType d_featDefs;
    00055   };
    00056
    00057   //! constructs a MolChemicalFeatureFactory from the data in a stream
    00058   MolChemicalFeatureFactory *buildFeatureFactory(std::istream &inStream);
    00059   //! constructs a MolChemicalFeatureFactory from the data in a string
    00060   MolChemicalFeatureFactory *buildFeatureFactory(const std::string &featureData);
    00061
    00062 }// end of namespace RDKit
    00063
    00064 #endif