32 #ifndef RDKIT_ENUMERATEBASE_H 33 #define RDKIT_ENUMERATEBASE_H 37 #include "../Reaction.h" 42 #include "../ReactionPickler.h" 71 m_initialEnumerator() {}
78 m_initialEnumerator( m_enumerator->copy() )
86 m_enumerator(rhs.m_enumerator ? rhs.m_enumerator->copy() : 0),
87 m_initialEnumerator( m_enumerator->copy() ) {}
92 virtual operator bool()
const {
93 PRECONDITION(m_enumerator.get(),
"Null enumeration strategy");
94 return static_cast<bool>(*m_enumerator);
99 if(m_initialEnumerator.get()) {
100 m_enumerator.reset(m_initialEnumerator->copy());
119 virtual std::vector<MOL_SPTR_VECT>
next() = 0;
124 virtual std::vector<std::vector<std::string> >
nextSmiles();
146 virtual void toStream(std::ostream &ss)
const = 0;
150 std::stringstream ss;
160 std::stringstream ss(text);
165 #ifdef RDK_USE_BOOST_SERIALIZATION 166 friend class boost::serialization::access;
167 template <
class Archive>
168 void save(Archive &ar,
const unsigned int)
const {
180 template <
class Archive>
181 void load(Archive &ar,
const unsigned int ) {
187 m_initialEnumerator =
\ 192 BOOST_SERIALIZATION_SPLIT_MEMBER();
196 #ifdef RDK_USE_BOOST_SERIALIZATION void initReactantMatchers()
initializes our internal reactant-matching datastructures.
virtual std::vector< MOL_SPTR_VECT > next()=0
get the next set of products (See run_Reactants) for details
std::string getState() const
Get the current state of the enumerator.
EnumerateLibraryBase()
default constructor
This is a class for storing and applying general chemical reactions.
boost::shared_ptr< EnumerationStrategyBase > fromPickle(std::istream &pickle)
virtual std::string Serialize() const
returns a string with a serialized (pickled) representation
static void reactionFromPickle(const std::string &pickle, ChemicalReaction *rxn)
constructs a reaction from a pickle stored in a string
EnumerateLibraryBase(const ChemicalReaction &rxn, EnumerationStrategyBase *enumerator=0)
construct with a chemical reaction and an enumeration strategy
void reset()
reset the enumeration to the beginning.
Base class for enumerating chemical reactions from collections of.
const EnumerationTypes::RGROUPS & getPosition() const
Get the current position into the reagent vectors.
EnumerateLibraryBase(const EnumerateLibraryBase &rhs)
Copy constructor.
boost::shared_ptr< EnumerationStrategyBase > m_enumerator
const EnumerationStrategyBase & getEnumerator()
return the current enumeration strategy
virtual std::vector< std::vector< std::string > > nextSmiles()
get the next set of products as smiles
void setState(const std::string &)
Set the current state of the enumerator.
std::vector< boost::uint64_t > RGROUPS
#define PRECONDITION(expr, mess)
This is a class for enumerating reagents using Cartesian Products of.
static void pickleReaction(const ChemicalReaction *rxn, std::ostream &ss)
pickles a reaction and sends the results to stream ss
virtual void initFromStream(std::istream &ss)=0
initializes from a stream pickle
const ChemicalReaction & getReaction() const
returns the underlying chemical reaction
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 pickle(const boost::shared_ptr< EnumerationStrategyBase > &enumerator, std::ostream &ss)
pickles a EnumerationStrategy and adds the results to a stream ss
boost::shared_ptr< EnumerationStrategyBase > m_initialEnumerator
virtual ~EnumerateLibraryBase()
void resetState()
Reset the enumerator to the beginning.