27 #ifndef GUM_LEARNING_DBROW_GENERATOR_H 28 #define GUM_LEARNING_DBROW_GENERATOR_H 32 #include <agrum/agrum.h> 33 #include <agrum/tools/database/DBRow.h> 34 #include <agrum/tools/database/DBTranslatedValue.h> 234 template <
template <
typename >
class ALLOC = std::allocator >
259 DBRowGenerator(
const DBRowGenerator< ALLOC >& from,
const allocator_type& alloc);
265 DBRowGenerator(DBRowGenerator< ALLOC >&& from,
const allocator_type& alloc);
292 bool setInputRow(
const DBRow< DBTranslatedValue, ALLOC >& row);
306 virtual void reset();
323 const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest);
343 const std::vector< std::size_t, ALLOC< std::size_t > >&
columnsOfInterest()
const;
378 virtual std::size_t
computeRows_(
const DBRow< DBTranslatedValue, ALLOC >& row) = 0;
387 #include <agrum/tools/database/DBRowGenerator_tpl.h> bool setInputRow(const DBRow< DBTranslatedValue, ALLOC > &row)
sets the input row from which the generator will create its output rows
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
DBRowGenerator(const DBRowGenerator< ALLOC > &from, const allocator_type &alloc)
copy constructor with a given allocator
DBRowGenerator(const DBRowGenerator< ALLOC > &from)
copy constructor
DBRowGenerator< ALLOC > & operator=(const DBRowGenerator< ALLOC > &)
copy constructor
void decreaseRemainingRows()
decrease the number of remaining output rows
virtual ~DBRowGenerator()
destructor
virtual DBRowGenerator< ALLOC > * clone() const =0
virtual copy constructor
INLINE void emplace(Args &&... args)
virtual 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 ...
DBRowGenerator(DBRowGenerator< ALLOC > &&from, const allocator_type &alloc)
move constructor with a given allocator
virtual DBRowGenerator< ALLOC > * clone(const allocator_type &alloc) const =0
virtual copy constructor with a given allocator
virtual 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 ...
virtual void reset()
resets the generator. There are therefore no more ouput row to generate
DBRowGeneratorGoal goal() const
returns the goal of the DBRowGenerator
DBRowGenerator< ALLOC > & operator=(DBRowGenerator< ALLOC > &&)
move constructor
DBRowGenerator(DBRowGenerator< ALLOC > &&from)
move constructor
bool hasRows()
returns true if there are still rows that can be output by the DBRowGenerator
DBRowGeneratorGoal goal_
the goal of the DBRowGenerator (just remove missing values or not)
allocator_type getAllocator() const
returns the allocator used
std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types_
the types of the columns in the DatabaseTable
DBRowGenerator(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const DBRowGeneratorGoal goal, const allocator_type &alloc=allocator_type())
default constructor
const std::vector< std::size_t, ALLOC< std::size_t > > & columnsOfInterest() const
returns the current set of columns of interest
std::vector< std::size_t, ALLOC< std::size_t > > columns_of_interest_
the set of columns of interest
virtual std::size_t computeRows_(const DBRow< DBTranslatedValue, ALLOC > &row)=0
the method that computes the set of DBRow instances to output after method setInputRow has been calle...
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
std::size_t nb_remaining_output_rows_
the number of output rows still to retrieve through the generate method
virtual const DBRow< DBTranslatedValue, ALLOC > & generate()=0
generate new rows from the input row