aGrUM  0.16.0
DBTranslator4DiscretizedVariable.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LEARNING_DB_TRANSLATOR_4_DISCRETIZED_VARIABLE_H
29 #define GUM_LEARNING_DB_TRANSLATOR_4_DISCRETIZED_VARIABLE_H
30 
31 #include <agrum/agrum.h>
34 
35 
36 namespace gum {
37 
38  namespace learning {
39 
40 
120  template < template < typename > class ALLOC = std::allocator >
122  public:
125 
126 
127  // ##########################################################################
129  // ##########################################################################
130 
132 
134 
147  template < typename GUM_SCALAR, template < typename > class XALLOC >
150  const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
151  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
152  const allocator_type& alloc = allocator_type());
153 
168  template < typename GUM_SCALAR >
171  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
172  const allocator_type& alloc = allocator_type());
173 
175 
188  template < template < typename > class XALLOC >
190  const IDiscretizedVariable& var,
191  const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
192  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
193  const allocator_type& alloc = allocator_type());
194 
210  const IDiscretizedVariable& var,
211  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
212  const allocator_type& alloc = allocator_type());
213 
217 
221  const allocator_type& alloc);
222 
226 
230  const allocator_type& alloc);
231 
234 
237  clone(const allocator_type& alloc) const;
238 
241 
243 
244 
245  // ##########################################################################
247  // ##########################################################################
248 
250 
254 
258 
260 
261 
262  // ##########################################################################
264  // ##########################################################################
265 
267 
269 
287  virtual DBTranslatedValue translate(const std::string& str) final;
288 
290 
293  virtual std::string
294  translateBack(const DBTranslatedValue translated_val) const final;
295 
297 
300  virtual std::size_t domainSize() const final;
301 
303  virtual bool hasEditableDictionary() const final;
304 
306  virtual void setEditableDictionaryMode(bool new_mode) final;
307 
309  virtual bool needsReordering() const final;
310 
313  virtual HashTable< std::size_t,
314  std::size_t,
315  ALLOC< std::pair< std::size_t, std::size_t > > >
316  reorder() final;
317 
319  virtual const IDiscretizedVariable* variable() const final;
320 
322  virtual DBTranslatedValue missingValue() const final;
323 
325 
326 
327 #ifndef DOXYGEN_SHOULD_SKIP_THIS
328 
329  private:
330  // the DiscretizedVariable used for translations
331  DiscretizedVariable< float > __variable;
332 
333  // the DiscretizedVariable returned by method variable ()
334  // We must return a IDiscretizedVariable because the user may have
335  // saved into the translator a DiscretizedVariable<X>, with X != float
336  IDiscretizedVariable* __real_variable;
337 
338 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
339  };
340 
341 
342  } /* namespace learning */
343 
344 } /* namespace gum */
345 
346 
347 // always include the template implementation
349 
350 #endif /* GUM_LEARNING_DB_TRANSLATOR_4_DISCRETIZED_VARIABLE_H */
DBTranslator4DiscretizedVariable< ALLOC > & operator=(const DBTranslator4DiscretizedVariable< ALLOC > &from)
copy operator
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
Definition: DBTranslator.h:120
virtual DBTranslator4DiscretizedVariable< ALLOC > * clone() const
virtual copy constructor
virtual DBTranslatedValue translate(const std::string &str) final
returns the translation of a string
Class for discretized random variable.
STL namespace.
virtual std::string translateBack(const DBTranslatedValue translated_val) const final
returns the original value for a given translation
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The union class for storing the translated values in learning databases.
The class for generic Hash Tables.
Definition: hashTable.h:679
virtual const IDiscretizedVariable * variable() const final
returns the variable stored into the translator
virtual DBTranslatedValue missingValue() const final
returns the translation of a missing value
virtual bool hasEditableDictionary() const final
indicates that the translator is never in editable dictionary mode
virtual bool needsReordering() const final
indicates that the translations should never be reordered
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The base class for all the tabular database cell translators.
Definition: DBTranslator.h:117
DBTranslator4DiscretizedVariable(const DiscretizedVariable< GUM_SCALAR > &var, const std::vector< std::string, XALLOC< std::string > > &missing_symbols, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max(), const allocator_type &alloc=allocator_type())
default constructor with a discretized variable as translator
The databases&#39; cell translators for discretized variables.
virtual std::size_t domainSize() const final
returns the number of discretization intervals used for translations
virtual HashTable< std::size_t, std::size_t, ALLOC< std::pair< std::size_t, std::size_t > > > reorder() final
returns an empty HashTable to indicate that no reordering is needed.
typename DBTranslator< ALLOC >::allocator_type 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.
virtual void setEditableDictionaryMode(bool new_mode) final
sets/unset the editable dictionary mode
A base class for discretized variables, independent of the ticks type.