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