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 #include <RDGeneral/export.h>
11 #ifndef __FREECHEMICALFEATURE_H_13012005_1023__
12 #define __FREECHEMICALFEATURE_H_13012005_1023__
13 
14 #include <Geometry/point.h>
16 
17 namespace ChemicalFeatures {
18 
19 //------------------------------------------------------
20 //! Class for chemical features that do not orignate from molecules
21 // e.g. pharamcophores, site-maps etc.
23  : public ChemicalFeature {
24  public:
25  //! start with everything specified
26  FreeChemicalFeature(const std::string &family, std::string type,
27  const RDGeom::Point3D &loc, int id = -1)
28  : d_id(id), d_family(family), d_type(type), d_position(loc) {}
29 
30  //! start with family and location specified, leave the type blank
31  FreeChemicalFeature(const std::string &family, const RDGeom::Point3D &loc)
32  : d_id(-1), d_family(family), d_type(""), d_position(loc) {}
33 
34  //! start with everything blank
36  : d_id(-1),
37  d_family(""),
38  d_type(""),
39  d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {}
40 
41  explicit FreeChemicalFeature(const std::string &pickle) {
42  this->initFromString(pickle);
43  }
44 
46  : d_id(other.getId()),
47  d_family(other.getFamily()),
48  d_type(other.getType()),
49  d_position(other.getPos()) {}
50 
52 
53  //! return our id
54  int getId() const { return d_id; }
55 
56  //! return our family
57  const std::string &getFamily() const { return d_family; }
58 
59  //! return our type
60  const std::string &getType() const { return d_type; }
61 
62  //! return our position
63  RDGeom::Point3D getPos() const { return d_position; }
64 
65  //! set our id
66  void setId(const int id) { d_id = id; }
67 
68  //! set our family
69  void setFamily(const std::string &family) { d_family = family; }
70 
71  //! set our type
72  void setType(const std::string &type) { d_type = type; }
73 
74  //! set our position
75  void setPos(const RDGeom::Point3D &loc) {
76  // std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
77  d_position = loc;
78  // std::cout << d_position.x << " " << d_position.y << " " << d_position.z
79  // << "\n";
80  }
81 
82  //! returns a serialized form of the feature (a pickle)
83  std::string toString() const;
84  //! initialize from a pickle string
85  void initFromString(const std::string &pickle);
86 
87  private:
88  int d_id;
89  std::string d_family;
90  std::string d_type;
91  RDGeom::Point3D d_position;
92 };
93 } // namespace ChemicalFeatures
94 
95 #endif
ChemicalFeatures::FreeChemicalFeature::getPos
RDGeom::Point3D getPos() const
return our position
Definition: FreeChemicalFeature.h:63
point.h
RDKit::EnumerationStrategyPickler::pickle
RDKIT_CHEMREACTIONS_EXPORT void pickle(const boost::shared_ptr< EnumerationStrategyBase > &enumerator, std::ostream &ss)
pickles a EnumerationStrategy and adds the results to a stream ss
ChemicalFeatures
Definition: ChemicalFeature.h:15
ChemicalFeatures::FreeChemicalFeature::FreeChemicalFeature
FreeChemicalFeature()
start with everything blank
Definition: FreeChemicalFeature.h:35
RDGeom
Definition: TorsionAngleM6.h:20
RDGeom::Point3D
Definition: point.h:46
RDKIT_CHEMICALFEATURES_EXPORT
#define RDKIT_CHEMICALFEATURES_EXPORT
Definition: export.h:86
ChemicalFeatures::FreeChemicalFeature::FreeChemicalFeature
FreeChemicalFeature(const std::string &pickle)
Definition: FreeChemicalFeature.h:41
ChemicalFeatures::FreeChemicalFeature
Class for chemical features that do not orignate from molecules.
Definition: FreeChemicalFeature.h:22
ChemicalFeatures::FreeChemicalFeature::FreeChemicalFeature
FreeChemicalFeature(const FreeChemicalFeature &other)
Definition: FreeChemicalFeature.h:45
ChemicalFeatures::ChemicalFeature
abstract base class for chemical feature
Definition: ChemicalFeature.h:19
ChemicalFeatures::FreeChemicalFeature::FreeChemicalFeature
FreeChemicalFeature(const std::string &family, std::string type, const RDGeom::Point3D &loc, int id=-1)
start with everything specified
Definition: FreeChemicalFeature.h:26
ChemicalFeatures::FreeChemicalFeature::FreeChemicalFeature
FreeChemicalFeature(const std::string &family, const RDGeom::Point3D &loc)
start with family and location specified, leave the type blank
Definition: FreeChemicalFeature.h:31
ChemicalFeatures::FreeChemicalFeature::getFamily
const std::string & getFamily() const
return our family
Definition: FreeChemicalFeature.h:57
ChemicalFeatures::FreeChemicalFeature::setType
void setType(const std::string &type)
set our type
Definition: FreeChemicalFeature.h:72
ChemicalFeatures::FreeChemicalFeature::~FreeChemicalFeature
~FreeChemicalFeature()
Definition: FreeChemicalFeature.h:51
ChemicalFeatures::FreeChemicalFeature::setPos
void setPos(const RDGeom::Point3D &loc)
set our position
Definition: FreeChemicalFeature.h:75
ChemicalFeature.h
ChemicalFeatures::FreeChemicalFeature::getType
const std::string & getType() const
return our type
Definition: FreeChemicalFeature.h:60
ChemicalFeatures::FreeChemicalFeature::setFamily
void setFamily(const std::string &family)
set our family
Definition: FreeChemicalFeature.h:69
ChemicalFeatures::FreeChemicalFeature::setId
void setId(const int id)
set our id
Definition: FreeChemicalFeature.h:66
ChemicalFeatures::FreeChemicalFeature::getId
int getId() const
return our id
Definition: FreeChemicalFeature.h:54
export.h