33 #ifndef RDKIT_ENUMERATEBASE_H 34 #define RDKIT_ENUMERATEBASE_H 38 #include "../Reaction.h" 43 #include "../ReactionPickler.h" 78 m_initialEnumerator(m_enumerator->copy()) {
85 m_enumerator(rhs.m_enumerator ? rhs.m_enumerator->copy() : 0),
86 m_initialEnumerator(m_enumerator->copy()) {}
91 virtual operator bool()
const {
92 PRECONDITION(m_enumerator.get(),
"Null enumeration strategy");
93 return static_cast<bool>(*m_enumerator);
98 if (m_initialEnumerator.get()) {
99 m_enumerator.reset(m_initialEnumerator->copy());
109 return *m_enumerator;
118 virtual std::vector<MOL_SPTR_VECT> next() = 0;
123 virtual std::vector<std::vector<std::string> > nextSmiles();
134 std::string getState()
const;
138 void setState(
const std::string &);
144 virtual void toStream(std::ostream &ss)
const = 0;
148 std::stringstream ss;
154 virtual void initFromStream(std::istream &ss) = 0;
158 std::stringstream ss(text);
163 #ifdef RDK_USE_BOOST_SERIALIZATION 164 friend class boost::serialization::access;
165 template <
class Archive>
166 void save(Archive &ar,
const unsigned int)
const {
177 template <
class Archive>
178 void load(Archive &ar,
const unsigned int ) {
192 BOOST_SERIALIZATION_SPLIT_MEMBER();
196 #ifdef RDK_USE_BOOST_SERIALIZATION const ChemicalReaction & getReaction() const
returns the underlying chemical reaction
void initReactantMatchers()
initializes our internal reactant-matching datastructures.
EnumerateLibraryBase()
default constructor
virtual std::string Serialize() const
returns a string with a serialized (pickled) representation
This is a class for storing and applying general chemical reactions.
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
static void reactionFromPickle(const std::string &pickle, ChemicalReaction *rxn)
RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr< EnumerationStrategyBase > fromPickle(std::istream &pickle)
EnumerateLibraryBase(const ChemicalReaction &rxn, EnumerationStrategyBase *enumerator=0)
construct with a chemical reaction and an enumeration strategy
void reset()
reset the enumeration to the beginning.
unsigned int getNumProductTemplates() const
static void pickleReaction(const ChemicalReaction *rxn, std::ostream &ss, unsigned int propertyFlags)
pickles a reaction and sends the results to stream ss
Base class for enumerating chemical reactions from collections of.
EnumerateLibraryBase(const EnumerateLibraryBase &rhs)
Copy constructor.
boost::shared_ptr< EnumerationStrategyBase > m_enumerator
const EnumerationStrategyBase & getEnumerator()
return the current enumeration strategy
std::vector< boost::uint64_t > RGROUPS
#define RDKIT_CHEMREACTIONS_EXPORT
#define PRECONDITION(expr, mess)
RDKIT_RDGENERAL_EXPORT std::ostream & toStream(std::ostream &)
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
This is a class for enumerating reagents using Cartesian Products of.
unsigned int getNumAgentTemplates() const
virtual void initFromString(const std::string &text)
initializes from a string pickle
boost::shared_ptr< EnumerationStrategyBase > m_initialEnumerator
virtual ~EnumerateLibraryBase()
unsigned int getNumReactantTemplates() const