34#ifndef CARTESIANPRODUCT_H
35#define CARTESIANPRODUCT_H
72 size_t m_numPermutationsProcessed{};
77 using EnumerationStrategyBase::initialize;
81 m_numPermutationsProcessed = 0;
84 const char *
type()
const override {
return "CartesianProductStrategy"; }
88 if (m_numPermutationsProcessed) {
91 ++m_numPermutationsProcessed;
98 return m_numPermutationsProcessed;
101 operator bool()
const override {
return hasNext(); }
110 ++m_numPermutationsProcessed;
113 bool hasNext()
const {
115 return m_numPermutations == EnumerationStrategyBase::EnumerationOverflow ||
116 m_numPermutationsProcessed < rdcast<size_t>(m_numPermutations);
119 void next(
size_t rowToIncrement) {
123 m_permutation[rowToIncrement] += 1;
124 size_t max_index_of_row = m_permutationSizes[rowToIncrement] - 1;
125 if (m_permutation[rowToIncrement] > max_index_of_row) {
126 m_permutation[rowToIncrement] = 0;
127 next(rowToIncrement + 1);
132#ifdef RDK_USE_BOOST_SERIALIZATION
133 friend class boost::serialization::access;
134 template <
class Archive>
135 void serialize(Archive &ar,
const unsigned int ) {
136 ar &boost::serialization::base_object<EnumerationStrategyBase>(*
this);
137 ar & m_numPermutationsProcessed;
143#ifdef RDK_USE_BOOST_SERIALIZATION
boost::uint64_t getPermutationIdx() const override
Returns how many permutations have been processed by this strategy.
EnumerationStrategyBase * copy() const override
copy the enumeration strategy complete with current state
const char * type() const override
const EnumerationTypes::RGROUPS & next() override
The current permutation {r1, r2, ...}.
void initializeStrategy(const ChemicalReaction &, const EnumerationTypes::BBS &) override
CartesianProductStrategy()
This is a class for storing and applying general chemical reactions.
#define RDKIT_CHEMREACTIONS_EXPORT
std::vector< boost::uint64_t > RGROUPS
std::vector< MOL_SPTR_VECT > BBS
RDKIT_MOLSTANDARDIZE_EXPORT void serialize(RWMOL_SPTR_PAIR output, PipelineResult &result, const PipelineOptions &options)