27 #ifndef GUM_LEARNING_DBROW_GENERATOR_SET_H 28 #define GUM_LEARNING_DBROW_GENERATOR_SET_H 32 #include <agrum/agrum.h> 33 #include <agrum/tools/database/DBRow.h> 34 #include <agrum/tools/database/DBTranslatedValue.h> 35 #include <agrum/tools/database/DBRowGenerator.h> 36 #include <agrum/tools/database/DBRowGeneratorWithBN.h> 111 template <
template <
typename >
class ALLOC = std::allocator >
130 DBRowGeneratorSet(
const DBRowGeneratorSet< ALLOC >& from,
const allocator_type& alloc);
136 DBRowGeneratorSet(DBRowGeneratorSet< ALLOC >&& from,
const allocator_type& alloc);
188 template <
template <
template <
typename >
class >
class Generator >
196 template <
template <
template <
typename >
class >
class Generator >
197 void insertGenerator(
const Generator< ALLOC >& generator,
const std::size_t i);
203 std::size_t
size()
const noexcept;
212 bool setInputRow(
const DBRow< DBTranslatedValue, ALLOC >& input_row);
221 template <
typename GUM_SCALAR >
222 void setBayesNet(
const BayesNet< GUM_SCALAR >& new_bn);
250 const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest);
275 const std::vector< std::size_t, ALLOC< std::size_t > >&
columnsOfInterest()
const;
283 #ifndef DOXYGEN_SHOULD_SKIP_THIS 290 std::size_t _nb_generators_{std::size_t(0)};
293 const DBRow< DBTranslatedValue, ALLOC >* _output_row_{
nullptr};
314 std::vector<
int, ALLOC<
int > > _setInputRow_performed_;
323 bool _produceNextRow_(
const DBRow< DBTranslatedValue, ALLOC >* input_row, std::size_t i);
333 #include <agrum/tools/database/DBRowGeneratorSet_tpl.h> allocator_type getAllocator() const
returns the allocator used
std::size_t size() const noexcept
returns the number of generators (alias for nbGenerators)
INLINE void emplace(Args &&... args)
The class used to pack sets of generators.
void insertGenerator(const Generator< ALLOC > &generator, const std::size_t i)
inserts a new generator at the ith position of the set
void clear()
removes all the generators
DBRowGeneratorSet(DBRowGeneratorSet< ALLOC > &&from, const allocator_type &alloc)
move constructor with a given allocator
DBRowGeneratorSet< ALLOC > & operator=(DBRowGeneratorSet< ALLOC > &&from)
move operator
virtual DBRowGeneratorSet< ALLOC > * clone(const allocator_type &alloc) const
virtual copy constructor with a given allocator
DBRowGeneratorSet(DBRowGeneratorSet< ALLOC > &&from)
move constructor
void setBayesNet(const BayesNet< GUM_SCALAR > &new_bn)
assign a new Bayes net to all the generators that depend on a BN
void setColumnsOfInterest(const std::vector< std::size_t, ALLOC< std::size_t > > &cols_of_interest)
sets the columns of interest: the output DBRow needs only contain correct values fot these columns ...
void setColumnsOfInterest(std::vector< std::size_t, ALLOC< std::size_t > > &&cols_of_interest)
sets the columns of interest: the output DBRow needs only contain correct values fot these columns ...
DBRowGeneratorSet< ALLOC > & operator=(const DBRowGeneratorSet< ALLOC > &from)
copy operator
DBRowGeneratorSet(const DBRowGeneratorSet< ALLOC > &from, const allocator_type &alloc)
copy constructor with a given allocator
const std::vector< std::size_t, ALLOC< std::size_t > > & columnsOfInterest() const
returns the current set of columns of interest
virtual DBRowGeneratorSet< ALLOC > * clone() const
virtual copy constructor
void reset()
resets all the generators
void insertGenerator(const Generator< ALLOC > &generator)
inserts a new generator at the end of the set
virtual ~DBRowGeneratorSet()
destructor
DBRowGeneratorSet(const DBRowGeneratorSet< ALLOC > &from)
copy constructor
std::size_t nbGenerators() const noexcept
returns the number of generators
DBRowGenerator< ALLOC > & operator[](const std::size_t i)
returns the ith generator
const DBRow< DBTranslatedValue, ALLOC > & generate()
generates a new output row from the input row
const DBRowGenerator< ALLOC > & operator[](const std::size_t i) const
returns the ith generator
bool setInputRow(const DBRow< DBTranslatedValue, ALLOC > &input_row)
sets the input row from which the generators will create new rows
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
bool hasRows()
returns true if there are still rows that can be output by the set of generators