RDKit
Open-source cheminformatics and machine learning.
FreeChemicalFeature.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef __FREECHEMICALFEATURE_H_13012005_1023__
11 #define __FREECHEMICALFEATURE_H_13012005_1023__
12 
13 #include <Geometry/point.h>
15 
16 namespace ChemicalFeatures {
17 
18  //------------------------------------------------------
19  //! Class for chemical features that do not orignate from molecules
20  // e.g. pharamcophores, site-maps etc.
22  public:
23  //! start with everything specified
24  FreeChemicalFeature(std::string family, std::string type,
25  const RDGeom::Point3D &loc,int id=-1) :
26  d_id(id), d_family(family), d_type(type), d_position(loc) {
27  }
28 
29  //! start with family and location specified, leave the type blank
30  FreeChemicalFeature(std::string family, const RDGeom::Point3D &loc) :
31  d_id(-1), d_family(family), d_type(""), d_position(loc) {
32  }
33 
34  //! start with everything blank
36  d_id(-1), d_family(""), d_type(""), d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {
37  }
38 
39  explicit FreeChemicalFeature(const std::string &pickle) {
40  this->initFromString(pickle);
41  }
42 
44  d_id(other.getId()), d_family(other.getFamily()), d_type(other.getType()), d_position(other.getPos()) {
45  }
46 
48 
49  //! return our id
50  const int getId() const {
51  return d_id;
52  }
53 
54  //! return our family
55  const std::string& getFamily() const {
56  return d_family;
57  }
58 
59  //! return our type
60  const std::string& getType() const {
61  return d_type;
62  }
63 
64  //! return our position
66  return d_position;
67  }
68 
69  //! set our id
70  void setId(const int id) {
71  d_id = id;
72  }
73 
74  //! set our family
75  void setFamily(const std::string &family) {
76  d_family = family;
77  }
78 
79  //! set our type
80  void setType(const std::string &type) {
81  d_type = type;
82  }
83 
84  //! set our position
85  void setPos(const RDGeom::Point3D &loc) {
86  //std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
87  d_position = loc;
88  //std::cout << d_position.x << " " << d_position.y << " " << d_position.z << "\n";
89  }
90 
91  //! returns a serialized form of the feature (a pickle)
92  std::string toString() const;
93  //! initialize from a pickle string
94  void initFromString(const std::string &pickle);
95 
96  private:
97  int d_id;
98  std::string d_family;
99  std::string d_type;
100  RDGeom::Point3D d_position;
101  };
102 }
103 
104 
105 #endif
106 
RDGeom::Point3D getPos() const
return our position
const std::string & getType() const
return our type
const int getId() const
return our id
Class for chemical features that do not orignate from molecules.
FreeChemicalFeature(const std::string &pickle)
void setFamily(const std::string &family)
set our family
void initFromString(const std::string &pickle)
initialize from a pickle string
abstract base class for chemical feature
const std::string & getFamily() const
return our family
void setId(const int id)
set our id
FreeChemicalFeature(std::string family, const RDGeom::Point3D &loc)
start with family and location specified, leave the type blank
FreeChemicalFeature(std::string family, std::string type, const RDGeom::Point3D &loc, int id=-1)
start with everything specified
void setPos(const RDGeom::Point3D &loc)
set our position
std::string toString() const
returns a serialized form of the feature (a pickle)
void setType(const std::string &type)
set our type
FreeChemicalFeature(const FreeChemicalFeature &other)
FreeChemicalFeature()
start with everything blank