aGrUM  0.16.0
DBRowGenerator_tpl.h
Go to the documentation of this file.
1 
29 
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
31 
32 namespace gum {
33 
34  namespace learning {
35 
37  template < template < typename > class ALLOC >
39  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
40  column_types,
41  const DBRowGeneratorGoal goal,
42  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
43  _column_types(column_types, alloc),
44  _columns_of_interest(alloc), _goal(goal) {
45  GUM_CONSTRUCTOR(DBRowGenerator);
46  }
47 
48 
50  template < template < typename > class ALLOC >
52  const DBRowGenerator< ALLOC >& from,
53  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
55  _column_types(from._column_types, alloc),
57  GUM_CONS_CPY(DBRowGenerator);
58  }
59 
60 
62  template < template < typename > class ALLOC >
64  const DBRowGenerator< ALLOC >& from) :
65  DBRowGenerator< ALLOC >(from, from.getAllocator()) {}
66 
67 
69  template < template < typename > class ALLOC >
71  DBRowGenerator< ALLOC >&& from,
72  const typename DBRowGenerator< ALLOC >::allocator_type& alloc) :
74  _column_types(std::move(from._column_types), alloc),
75  _columns_of_interest(std::move(from._columns_of_interest), alloc),
76  _goal(from._goal) {
77  GUM_CONS_MOV(DBRowGenerator);
78  }
79 
80 
82  template < template < typename > class ALLOC >
83  INLINE
84  DBRowGenerator< ALLOC >::DBRowGenerator(DBRowGenerator< ALLOC >&& from) :
85  DBRowGenerator< ALLOC >(std::move(from), from.getAllocator()) {}
86 
87 
89  template < template < typename > class ALLOC >
91  GUM_DESTRUCTOR(DBRowGenerator);
92  }
93 
94 
96  template < template < typename > class ALLOC >
97  INLINE DBRowGenerator< ALLOC >& DBRowGenerator< ALLOC >::
98  operator=(const DBRowGenerator< ALLOC >& from) {
99  _nb_remaining_output_rows = from._nb_remaining_output_rows;
100  _column_types = from._column_types;
101  _columns_of_interest = from._columns_of_interest;
102  _goal = from._goal;
103  return *this;
104  }
105 
106 
108  template < template < typename > class ALLOC >
109  INLINE DBRowGenerator< ALLOC >& DBRowGenerator< ALLOC >::
110  operator=(DBRowGenerator< ALLOC >&& from) {
111  _nb_remaining_output_rows = from._nb_remaining_output_rows;
112  _column_types = std::move(from._column_types);
113  _columns_of_interest = std::move(from._columns_of_interest);
114  _goal = from._goal;
115  return *this;
116  }
117 
118 
120  template < template < typename > class ALLOC >
121  INLINE bool DBRowGenerator< ALLOC >::hasRows() {
122  return _nb_remaining_output_rows != std::size_t(0);
123  }
124 
125 
127  template < template < typename > class ALLOC >
129  const DBRow< DBTranslatedValue, ALLOC >& row) {
131  return hasRows();
132  }
133 
134 
136  template < template < typename > class ALLOC >
139  }
140 
141 
143  template < template < typename > class ALLOC >
144  INLINE void DBRowGenerator< ALLOC >::reset() {
146  }
147 
148 
149  // sets the columns of interest: the output DBRow needs only
150  // contain values fot these columns
151  template < template < typename > class ALLOC >
153  const std::vector< std::size_t, ALLOC< std::size_t > >& cols_of_interest) {
154  _columns_of_interest = cols_of_interest;
155  }
156 
157 
158  // sets the columns of interest: the output DBRow needs only
159  // contain values fot these columns
160  template < template < typename > class ALLOC >
162  std::vector< std::size_t, ALLOC< std::size_t > >&& cols_of_interest) {
163  _columns_of_interest = std::move(cols_of_interest);
164  }
165 
166 
168  template < template < typename > class ALLOC >
169  INLINE const std::vector< std::size_t, ALLOC< std::size_t > >&
171  return _columns_of_interest;
172  }
173 
174 
176  template < template < typename > class ALLOC >
179  return _columns_of_interest.get_allocator();
180  }
181 
182 
184  template < template < typename > class ALLOC >
186  return _goal;
187  }
188 
189 
190  } /* namespace learning */
191 
192 } /* namespace gum */
193 
194 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
std::vector< std::size_t, ALLOC< std::size_t > > _columns_of_interest
the set of columns of interest
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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< ALLOC > & operator=(const DBRowGenerator< ALLOC > &)
copy constructor
void decreaseRemainingRows()
decrease the number of remaining output rows
virtual ~DBRowGenerator()
destructor
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 ...
STL namespace.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual std::size_t _computeRows(const DBRow< DBTranslatedValue, ALLOC > &row) final
computes the rows it will provide as output
virtual void reset()
resets the generator. There are therefore no more ouput row to generate
DBRowGeneratorGoal goal() const
returns the goal of the DBRowGenerator
bool hasRows()
returns true if there are still rows that can be output by the DBRowGenerator
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
allocator_type getAllocator() const
returns the allocator used
DBRowGeneratorGoal _goal
the goal of the DBRowGenerator (just remove missing values or not)
allocator_type getAllocator() const
returns the allocator used
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< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > _column_types
the types of the columns in the DatabaseTable
std::size_t _nb_remaining_output_rows
the number of output rows still to retrieve through the generate method