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() : nullptr),
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;
148 std::stringstream ss;
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
197 BOOST_SERIALIZATION_ASSUME_ABSTRACT(EnumerateLibraryBase)
#define PRECONDITION(expr, mess)
This is a class for enumerating reagents using Cartesian Products of.
This is a class for storing and applying general chemical reactions.
unsigned int getNumAgentTemplates() const
unsigned int getNumReactantTemplates() const
void initReactantMatchers(bool silent=false)
initializes our internal reactant-matching datastructures.
unsigned int getNumProductTemplates() const
Base class for enumerating chemical reactions from collections of.
const EnumerationStrategyBase & getEnumerator()
return the current enumeration strategy
std::string getState() const
Get the current state of the enumerator.
virtual std::vector< std::vector< std::string > > nextSmiles()
get the next set of products as smiles
virtual void initFromStream(std::istream &ss)=0
initializes from a stream pickle
virtual std::vector< MOL_SPTR_VECT > next()=0
get the next set of products (See run_Reactants) for details
virtual ~EnumerateLibraryBase()
virtual std::string Serialize() const
returns a string with a serialized (pickled) representation
boost::shared_ptr< EnumerationStrategyBase > m_enumerator
EnumerateLibraryBase(const EnumerateLibraryBase &rhs)
Copy constructor.
EnumerateLibraryBase()
default constructor
const EnumerationTypes::RGROUPS & getPosition() const
Get the current position into the reagent vectors.
virtual void initFromString(const std::string &text)
initializes from a string pickle
virtual void toStream(std::ostream &ss) const =0
serializes (pickles) to a stream
void reset()
reset the enumeration to the beginning.
EnumerateLibraryBase(const ChemicalReaction &rxn, EnumerationStrategyBase *enumerator=nullptr)
construct with a chemical reaction and an enumeration strategy
void setState(const std::string &)
Set the current state of the enumerator.
void resetState()
Reset the enumerator to the beginning.
boost::shared_ptr< EnumerationStrategyBase > m_initialEnumerator
const ChemicalReaction & getReaction() const
returns the underlying chemical reaction
static void reactionFromPickle(const std::string &pickle, ChemicalReaction *rxn)
static void pickleReaction(const ChemicalReaction *rxn, std::ostream &ss, unsigned int propertyFlags)
pickles a reaction and sends the results to stream ss
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
#define RDKIT_CHEMREACTIONS_EXPORT
RDKIT_CHEMREACTIONS_EXPORT boost::shared_ptr< EnumerationStrategyBase > fromPickle(std::istream &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
std::vector< boost::uint64_t > RGROUPS
RDKIT_RDGENERAL_EXPORT std::ostream & toStream(std::ostream &)