Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _RD_RXNPICKLE_H_2JUNE2009_
00011 #define _RD_RXNPICKLE_H_2JUNE2009_
00012
00013
00014 #include <iostream>
00015 #include <string>
00016 #include <exception>
00017 #ifdef WIN32
00018 #include <ios>
00019 #endif
00020
00021 namespace RDKit{
00022 class ChemicalReaction;
00023
00024
00025 class ReactionPicklerException : public std::exception {
00026 public :
00027 ReactionPicklerException(const char *msg) : _msg(msg) {};
00028 ReactionPicklerException(const std::string msg) : _msg(msg) {};
00029 const char *message () const { return _msg.c_str(); };
00030 ~ReactionPicklerException () throw () {};
00031
00032 private :
00033 std::string _msg;
00034 };
00035
00036
00037 class ReactionPickler{
00038 public:
00039 static const boost::int32_t versionMajor,versionMinor,versionPatch;
00040 static const boost::int32_t endianId;
00041
00042
00043
00044
00045 typedef enum {
00046 VERSION=10000,
00047 BEGINREACTANTS,
00048 ENDREACTANTS,
00049 BEGINPRODUCTS,
00050 ENDPRODUCTS,
00051 ENDREACTION,
00052 } Tags;
00053
00054
00055 static void pickleReaction(const ChemicalReaction *rxn,std::ostream &ss);
00056 static void pickleReaction(const ChemicalReaction &rxn,std::ostream &ss) {
00057 ReactionPickler::pickleReaction(&rxn,ss);
00058 };
00059
00060 static void pickleReaction(const ChemicalReaction *rxn,std::string &res);
00061 static void pickleReaction(const ChemicalReaction &rxn,std::string &res) {
00062 ReactionPickler::pickleReaction(&rxn,res);
00063 };
00064
00065
00066 static void reactionFromPickle(const std::string &pickle,ChemicalReaction *rxn);
00067 static void reactionFromPickle(const std::string &pickle,ChemicalReaction &rxn) {
00068 ReactionPickler::reactionFromPickle(pickle,&rxn);
00069 };
00070
00071
00072 static void reactionFromPickle(std::istream &ss,ChemicalReaction *rxn);
00073 static void reactionFromPickle(std::istream &ss,ChemicalReaction &rxn) {
00074 ReactionPickler::reactionFromPickle(ss,&rxn);
00075 };
00076 private:
00077
00078 static void _pickle(const ChemicalReaction *rxn,std::ostream &ss);
00079
00080
00081 static void _depickle(std::istream &ss,ChemicalReaction *rxn, int version);
00082
00083 };
00084
00085 };
00086
00087
00088 #endif