MolCatalogEntry.h
Go to the documentation of this file.00001
00002
00003
00004 #ifndef _RD_MOLCATALOGENTRY_H_
00005 #define _RD_MOLCATALOGENTRY_H_
00006
00007 #include <RDGeneral/Dict.h>
00008 #include <Catalogs/CatalogEntry.h>
00009 #include <fstream>
00010 #include <string>
00011
00012
00013 namespace RDKit {
00014 class ROMol;
00015
00016
00017 class MolCatalogEntry : public RDCatalog::CatalogEntry {
00018 public :
00019
00020 MolCatalogEntry() : dp_mol(0),d_descrip("") {
00021 dp_props = new Dict();
00022 setBitId(-1);
00023 }
00024
00025
00026 MolCatalogEntry(const MolCatalogEntry &other);
00027
00028
00029
00030
00031
00032 MolCatalogEntry(const ROMol *omol);
00033
00034
00035 MolCatalogEntry(const std::string &pickle){
00036 this->initFromString(pickle);
00037 }
00038
00039 ~MolCatalogEntry();
00040
00041 std::string getDescription() const {return d_descrip;}
00042
00043 void setDescription(std::string val) {d_descrip = val;}
00044
00045 unsigned int getOrder() const { return d_order; };
00046 void setOrder(unsigned int order) { d_order=order; };
00047
00048 const ROMol *getMol() const { return dp_mol; };
00049
00050
00051
00052
00053
00054 void setMol(const ROMol *molPtr);
00055
00056
00057 template <typename T> void setProp(const char *key, T &val) const {
00058 dp_props->setVal(key, val);
00059 }
00060
00061
00062 template <typename T> void setProp(const std::string key, T &val) const {
00063 setProp(key.c_str(), val);
00064 }
00065
00066
00067 template <typename T>
00068 void getProp(const char *key, T &res) const {
00069 dp_props->getVal(key, res);
00070 }
00071
00072 template <typename T>
00073 void getProp(const std::string key, T &res) const {
00074 getProp(key.c_str(), res);
00075 }
00076
00077
00078 bool hasProp(const char *key) const {
00079 if (!dp_props) return false;
00080 return dp_props->hasVal(key);
00081 }
00082
00083 bool hasProp(const std::string key) const {
00084 return hasProp(key.c_str());
00085 }
00086
00087
00088 void clearProp(const char *key) const {
00089 dp_props->clearVal(key);
00090 }
00091
00092 void clearProp(const std::string key) const {
00093 clearProp(key.c_str());
00094 }
00095
00096
00097 void toStream(std::ostream &ss) const;
00098
00099 std::string Serialize() const;
00100
00101 void initFromStream(std::istream &ss);
00102
00103 void initFromString(const std::string &text);
00104
00105 private:
00106 const ROMol *dp_mol;
00107 Dict *dp_props;
00108
00109 unsigned int d_order;
00110 std::string d_descrip;
00111 };
00112 }
00113
00114 #endif
00115