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(const 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  //! start with family and location specified, leave the type blank
29  FreeChemicalFeature(const std::string &family, const RDGeom::Point3D &loc)
30  : d_id(-1), d_family(family), d_type(""), d_position(loc) {}
31 
32  //! start with everything blank
34  : d_id(-1),
35  d_family(""),
36  d_type(""),
37  d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {}
38 
39  explicit FreeChemicalFeature(const std::string &pickle) {
40  this->initFromString(pickle);
41  }
42 
44  : d_id(other.getId()),
45  d_family(other.getFamily()),
46  d_type(other.getType()),
47  d_position(other.getPos()) {}
48 
50 
51  //! return our id
52  int getId() const { return d_id; }
53 
54  //! return our family
55  const std::string &getFamily() const { return d_family; }
56 
57  //! return our type
58  const std::string &getType() const { return d_type; }
59 
60  //! return our position
61  RDGeom::Point3D getPos() const { return d_position; }
62 
63  //! set our id
64  void setId(const int id) { d_id = id; }
65 
66  //! set our family
67  void setFamily(const std::string &family) { d_family = family; }
68 
69  //! set our type
70  void setType(const std::string &type) { d_type = type; }
71 
72  //! set our position
73  void setPos(const RDGeom::Point3D &loc) {
74  // std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
75  d_position = loc;
76  // std::cout << d_position.x << " " << d_position.y << " " << d_position.z
77  // << "\n";
78  }
79 
80  //! returns a serialized form of the feature (a pickle)
81  std::string toString() const;
82  //! initialize from a pickle string
83  void initFromString(const std::string &pickle);
84 
85  private:
86  int d_id;
87  std::string d_family;
88  std::string d_type;
89  RDGeom::Point3D d_position;
90 };
91 }
92 
93 #endif
RDGeom::Point3D getPos() const
return our position
const std::string & getType() const
return our type
Class for chemical features that do not orignate from molecules.
FreeChemicalFeature(const std::string &family, std::string type, const RDGeom::Point3D &loc, int id=-1)
start with everything specified
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
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(const std::string &family, const RDGeom::Point3D &loc)
start with family and location specified, leave the type blank
void pickle(const boost::shared_ptr< EnumerationStrategyBase > &enumerator, std::ostream &ss)
pickles a EnumerationStrategy and adds the results to a stream ss
FreeChemicalFeature()
start with everything blank