RDCode: FreeChemicalFeature.h Source File

# FreeChemicalFeature.h

Go to the documentation of this file.

    00001 //
    00002 //  Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
    00003 //
    00004 //  @@ All Rights Reserved @@
    00005 //
    00006 #ifndef __FREECHEMICALFEATURE_H_13012005_1023__
    00007 #define __FREECHEMICALFEATURE_H_13012005_1023__
    00008
    00009 #include <Geometry/point.h>
    00010 #include <ChemicalFeatures/ChemicalFeature.h>
    00011
    00012 namespace ChemicalFeatures {
    00013
    00014   //------------------------------------------------------
    00015   //! Class for chemical features that do not orignate from molecules
    00016   //  e.g. pharamcophores, site-maps etc.
    00017   class FreeChemicalFeature : public ChemicalFeature {
    00018     public:
    00019     //! start with everything specified
    00020     FreeChemicalFeature(std::string family, std::string type,
    00021                         const RDGeom::Point3D &loc) :
    00022       d_family(family), d_type(type), d_position(loc) {
    00023     }
    00024
    00025     //! start with family and location specified, leave the type blank
    00026     FreeChemicalFeature(std::string family, const RDGeom::Point3D &loc) :
    00027       d_family(family), d_type(""), d_position(loc) {
    00028     }
    00029
    00030     //! start with everything blank
    00031     FreeChemicalFeature() :
    00032       d_family(""), d_type(""), d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {
    00033     }
    00034
    00035     explicit FreeChemicalFeature(const std::string &pickle) {
    00036       this->initFromString(pickle);
    00037     }
    00038
    00039     FreeChemicalFeature(const FreeChemicalFeature &other) :
    00040       d_family(other.getFamily()), d_type(other.getType()), d_position(other.getPos())  {
    00041     }
    00042
    00043     ~FreeChemicalFeature() {}
    00044
    00045     //! return our family
    00046     const std::string& getFamily() const {
    00047       return d_family;
    00048     }
    00049
    00050     //! return our type
    00051     const std::string& getType() const {
    00052       return d_type;
    00053     }
    00054
    00055     //! return our position
    00056     RDGeom::Point3D getPos() const {
    00057       return d_position;
    00058     }
    00059
    00060     //! set our family
    00061     void setFamily(const std::string &family) {
    00062       d_family = family;
    00063     }
    00064
    00065     //! set our type
    00066     void setType(const std::string &type) {
    00067       d_type = type;
    00068     }
    00069
    00070     //! set our position
    00071     void setPos(const RDGeom::Point3D &loc) {
    00072       //std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
    00073       d_position = loc;
    00074       //std::cout << d_position.x << " " << d_position.y << " " << d_position.z << "\n";
    00075     }
    00076
    00077     //! returns a serialized form of the feature (a pickle)
    00078     std::string toString() const;
    00079     //! initialize from a pickle string
    00080     void initFromString(const std::string &pickle);
    00081
    00082   private:
    00083     std::string d_family;
    00084     std::string d_type;
    00085     RDGeom::Point3D d_position;
    00086   };
    00087 }
    00088
    00089
    00090 #endif
    00091