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 {
168 ReactionPickler::pickleReaction(m_rxn, pickle);
174 EnumerationStrategyPickler::pickle(m_initialEnumerator, pickle);
177 template <
class Archive>
178 void load(Archive &ar,
const unsigned int ) {
186 ReactionPickler::reactionFromPickle(pickle, m_rxn);
189 m_initialEnumerator = EnumerationStrategyPickler::fromPickle(pickle);
192 BOOST_SERIALIZATION_SPLIT_MEMBER();
196#ifdef RDK_USE_BOOST_SERIALIZATION
#define PRECONDITION(expr, mess)
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
std::string getState() const
const EnumerationStrategyBase & getEnumerator()
return the current enumeration strategy
virtual void initFromStream(std::istream &ss)=0
initializes from a stream pickle
virtual ~EnumerateLibraryBase()
virtual std::string Serialize() const
returns a string with a serialized (pickled) representation
boost::shared_ptr< EnumerationStrategyBase > m_enumerator
virtual std::vector< MOL_SPTR_VECT > next()=0
EnumerateLibraryBase(const EnumerateLibraryBase &rhs)
Copy constructor.
EnumerateLibraryBase()
default constructor
const EnumerationTypes::RGROUPS & getPosition() const
virtual std::vector< std::vector< std::string > > nextSmiles()
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 &)
void resetState()
Reset the enumerator to the beginning.
boost::shared_ptr< EnumerationStrategyBase > m_initialEnumerator
const ChemicalReaction & getReaction() const
returns the underlying chemical reaction
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 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
bool rdvalue_is(const RDValue_cast_t)