aGrUM  0.16.0
rawDatabaseTable.h
Go to the documentation of this file.
1 
42 #ifndef GUM_RAW_DATABASE_TABLE_H
43 #define GUM_RAW_DATABASE_TABLE_H
44 
45 
46 #include <agrum/agrum.h>
49 
50 namespace gum {
51 
52  namespace learning {
53 
115  template < template < typename > class ALLOC = std::allocator >
116  class RawDatabaseTable : public IDatabaseTable< DBCell, ALLOC > {
117  public:
119  template < typename TX_DATA >
120  using DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > >;
121 
123  template < typename TX_DATA >
125 
127  template < typename TX_DATA >
129 
130  template < template < typename > class XALLOC >
131  using MissingValType = std::vector< std::string, XALLOC< std::string > >;
132 
135 
138 
140 
145  using const_reference = const value_type&;
146  using pointer = value_type*;
147  using const_pointer = const value_type*;
148  using size_type = std::size_t;
149  using difference_type = std::ptrdiff_t;
150  using iterator = Handler;
152  using allocator_type = ALLOC< DBCell >;
154 
155 
156  // ##########################################################################
158  // ##########################################################################
160 
162  template < template < typename > class VARALLOC,
163  template < typename >
164  class MISSALLOC >
166  const MissingValType< MISSALLOC >& missing_symbols,
167  const std::vector< std::string, VARALLOC< std::string > >& var_names,
168  const allocator_type& alloc = allocator_type());
169 
171  template < template < typename > class MISSALLOC >
172  RawDatabaseTable(const MissingValType< MISSALLOC >& missing_symbols,
173  const allocator_type& alloc = allocator_type());
174 
177 
180 
183  const allocator_type& alloc);
184 
187 
190  const allocator_type& alloc);
191 
193  virtual RawDatabaseTable< ALLOC >* clone() const final;
194 
196  virtual RawDatabaseTable< ALLOC >*
197  clone(const allocator_type& alloc) const final;
198 
200  virtual ~RawDatabaseTable();
201 
203 
204 
205  // ##########################################################################
207  // ##########################################################################
209 
211  RawDatabaseTable< ALLOC >& operator=(const RawDatabaseTable< ALLOC >& from);
212 
214  RawDatabaseTable< ALLOC >& operator=(RawDatabaseTable< ALLOC >&& from);
215 
217 
218 
219  // ##########################################################################
221  // ##########################################################################
223 
224  using IDatabaseTable< DBCell, ALLOC >::setVariableNames;
225 
227 
252  virtual void setVariableNames(
253  const std::vector< std::string, ALLOC< std::string > >& names,
254  const bool from_external_object = true) final;
255 
257 
286  virtual void ignoreColumn(const std::size_t k,
287  const bool from_external_object = true) final;
288 
290  virtual const DBVector< std::size_t > ignoredColumns() const final;
291 
294  virtual const DBVector< std::size_t > inputColumns() const final;
295 
296  using IDatabaseTable< DBCell, ALLOC >::insertRow;
297 
299 
305  virtual void insertRow(
306  const std::vector< std::string, ALLOC< std::string > >& new_row) final;
307 
309  virtual void clear() final;
310 
312 
313 
314 #ifndef DOXYGEN_SHOULD_SKIP_THIS
315 
316  private:
317  // the set of ignored columns, sorted by increasing order
318  DBVector< std::size_t > __ignored_cols;
319 
321  DBCell __convert(const std::string& elt) const;
322 
323 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
324  };
325 
326  } /* namespace learning */
327 
328 } /* namespace gum */
329 
332 
333 #endif /* GUM_RAW_DATABASE_TABLE_H */
typename IDatabaseTable< DBCell, ALLOC >::IsMissing IsMissing
The common class for the tabular database tables.
The table containing the raw/original data of a databaseClass RawDatabaseTable is intended to store i...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void ignoreColumn(const std::size_t k, const bool from_external_object=true) final
makes the database table ignore from now on the kth column
The class representing the original values of the cells of databases.
Definition: DBCell.h:72
STL namespace.
virtual const DBVector< std::size_t > ignoredColumns() const final
returns the set of columns of the original dataset that are ignored
HandlerSafe iterator_safe
Types for STL compliance.
virtual const DBVector< std::size_t > inputColumns() const final
returns the set of columns of the original dataset that are present in the RawDatabaseTable ...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
std::ptrdiff_t difference_type
Types for STL compliance.
ALLOC< DBCell > allocator_type
Types for STL compliance.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The class for storing a record in a database.
Definition: DBRow.h:56
typename IDatabaseTable< DBCell, ALLOC >::HandlerSafe HandlerSafe
the safe handler type
std::vector< TX_DATA, ALLOC< TX_DATA > > DBVector
the type for the vectors used in the RawDatabaseTable
virtual void insertRow(const std::vector< std::string, ALLOC< std::string > > &new_row) final
insert a new row at the end of the database
RawDatabaseTable(const MissingValType< MISSALLOC > &missing_symbols, const std::vector< std::string, VARALLOC< std::string > > &var_names, const allocator_type &alloc=allocator_type())
default constructor
typename IDatabaseTable< DBCell, ALLOC >::Handler Handler
the unsafe handler type
std::size_t size_type
Types for STL compliance.
std::vector< std::string, XALLOC< std::string > > MissingValType
virtual RawDatabaseTable< ALLOC > * clone() const final
virtual copy constructor
virtual void clear() final
erase the content of the database, including the names of the variables
DBVector< Row< TX_DATA > > Matrix
the type for the matrices stored into the database
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void setVariableNames(const std::vector< std::string, ALLOC< std::string > > &names, const bool from_external_object=true) final
sets the names of the variables
Handler iterator
Types for STL compliance.