aGrUM  0.16.0
DBRowGenerator.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LEARNING_DBROW_GENERATOR_H
29 #define GUM_LEARNING_DBROW_GENERATOR_H
30 
31 #include <vector>
32 
33 #include <agrum/agrum.h>
36 
37 namespace gum {
38 
39  namespace learning {
40 
47  enum class DBRowGeneratorGoal : char {
48  // the generator's goal is only to remove all missing values
50 
51  // the generator does something else than just missing values
53  };
54 
55 
234  template < template < typename > class ALLOC = std::allocator >
236  public:
238  using allocator_type = ALLOC< DBTranslatedValue >;
239 
240  // ##########################################################################
242  // ##########################################################################
243 
245 
247 
251  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
252  column_types,
253  const DBRowGeneratorGoal goal,
254  const allocator_type& alloc = allocator_type());
255 
258 
261  const allocator_type& alloc);
262 
265 
268 
270  virtual DBRowGenerator< ALLOC >* clone() const = 0;
271 
273  virtual DBRowGenerator< ALLOC >*
274  clone(const allocator_type& alloc) const = 0;
275 
277  virtual ~DBRowGenerator();
278 
280 
281 
282  // ##########################################################################
284  // ##########################################################################
285 
287 
290  bool hasRows();
291 
293 
295  bool setInputRow(const DBRow< DBTranslatedValue, ALLOC >& row);
296 
298  virtual const DBRow< DBTranslatedValue, ALLOC >& generate() = 0;
299 
301 
306  void decreaseRemainingRows();
307 
309  virtual void reset();
310 
325  virtual void setColumnsOfInterest(
326  const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest);
327 
342  virtual void setColumnsOfInterest(
343  std::vector< std::size_t, ALLOC< std::size_t > >&& cols_of_interest);
344 
346  const std::vector< std::size_t, ALLOC< std::size_t > >&
347  columnsOfInterest() const;
348 
350  allocator_type getAllocator() const;
351 
353  DBRowGeneratorGoal goal() const;
354 
356 
357 
358  protected:
360  std::size_t _nb_remaining_output_rows{std::size_t(0)};
361 
363 
365  std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
367 
369  std::vector< std::size_t, ALLOC< std::size_t > > _columns_of_interest;
370 
374 
375 
378 
381 
384  virtual std::size_t
385  _computeRows(const DBRow< DBTranslatedValue, ALLOC >& row) = 0;
386  };
387 
388  } /* namespace learning */
389 
390 } /* namespace gum */
391 
392 
393 // always include the template implementation
395 
396 #endif /* GUM_LEARNING_DBROW_GENERATOR_H */
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< std::size_t, ALLOC< std::size_t > > _columns_of_interest
the set of columns of interest
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
The class for storing a record in a database.
Definition: DBRow.h:56
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > _column_types
the types of the columns in the DatabaseTable
The base class for all DBRow generators.