aGrUM  0.16.0
DBTranslator4LabelizedVariable.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LEARNING_DB_TRANSLATOR_4_LABELIZED_VARIABLE_H
29 #define GUM_LEARNING_DB_TRANSLATOR_4_LABELIZED_VARIABLE_H
30 
31 #include <agrum/agrum.h>
34 
35 
36 namespace gum {
37 
38  namespace learning {
39 
40 
134  template < template < typename > class ALLOC = std::allocator >
136  public:
139 
140  // ##########################################################################
142  // ##########################################################################
143 
145 
147 
160  template < template < typename > class XALLOC >
162  const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
163  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
164  const allocator_type& alloc = allocator_type());
165 
167 
179  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
180  const allocator_type& alloc = allocator_type());
181 
183 
201  template < template < typename > class XALLOC >
203  const LabelizedVariable& var,
204  const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
205  const bool editable_dictionary = false,
206  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
207  const allocator_type& alloc = allocator_type());
208 
229  const LabelizedVariable& var,
230  const bool editable_dictionary = false,
231  std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
232  const allocator_type& alloc = allocator_type());
233 
237 
241  const allocator_type& alloc);
242 
246 
250  const allocator_type& alloc);
251 
254 
257  clone(const allocator_type& alloc) const;
258 
261 
263 
264 
265  // ##########################################################################
267  // ##########################################################################
268 
270 
274 
278 
280 
281 
282  // ##########################################################################
284  // ##########################################################################
285 
287 
289 
315  virtual DBTranslatedValue translate(const std::string& str) final;
316 
318 
324  virtual std::string
325  translateBack(const DBTranslatedValue translated_val) const final;
326 
328 
335  virtual std::size_t domainSize() const final;
336 
357  virtual bool needsReordering() const final;
358 
368  virtual HashTable< std::size_t,
369  std::size_t,
370  ALLOC< std::pair< std::size_t, std::size_t > > >
371  reorder() final;
372 
374  virtual const LabelizedVariable* variable() const final;
375 
377  virtual DBTranslatedValue missingValue() const final;
378 
380 
381 #ifndef DOXYGEN_SHOULD_SKIP_THIS
382 
383  private:
384  // the LabelizedVariable assigned to the translator, if any
385  LabelizedVariable __variable;
386 
387 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
388  };
389 
390 
391  } /* namespace learning */
392 
393 } /* namespace gum */
394 
395 
396 // always include the template implementation
398 
399 #endif /* GUM_LEARNING_DB_TRANSLATOR_4_LABELIZED_VARIABLE_H */
virtual const LabelizedVariable * variable() const final
returns the variable stored into the translator
virtual DBTranslatedValue missingValue() const final
returns the translation of a missing value
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
Definition: DBTranslator.h:120
virtual ~DBTranslator4LabelizedVariable()
destructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
class LabelizedVariable
DBTranslator4LabelizedVariable(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 without any initial variable
virtual std::size_t domainSize() const final
returns the domain size of a variable corresponding to the translations
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
DBTranslator4LabelizedVariable< ALLOC > & operator=(const DBTranslator4LabelizedVariable< ALLOC > &from)
copy operator
The base class for all the tabular database cell translators.
Definition: DBTranslator.h:117
virtual bool needsReordering() const final
indicates whether a reordering is needed to make the translations sorted
virtual DBTranslatedValue translate(const std::string &str) final
returns the translation of a string
virtual DBTranslator4LabelizedVariable< ALLOC > * clone() const
virtual copy constructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The databases&#39; cell translators for labelized variables.
virtual HashTable< std::size_t, std::size_t, ALLOC< std::pair< std::size_t, std::size_t > > > reorder() final
performs a reordering of the dictionary and returns a mapping from the old translated values to the n...
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.