50#ifndef DOXYGEN_SHOULD_SKIP_THIS
71 return DBTranslatedValue{std::numeric_limits< std::size_t >::max()};
75 "String \"" << str <<
"\" cannot be translated because it is not value for "
79 "The translation of \"" << str <<
"\" could not be found for " << _variable_)
87 return this->
back_dico_.second(translated_val.discr_val);
88 }
catch (Exception
const&) {
90 if ((translated_val.discr_val == std::numeric_limits< std::size_t >::max())
91 && !this->missing_symbols_.empty())
95 "The back translation of \"" << translated_val.discr_val
96 <<
"\" could not be found");
111 return HashTable< std::size_t, std::size_t >();
116 return _variable_.domainSize();
126 return DBTranslatedValue{std::numeric_limits< std::size_t >::max()};
The databases' cell translators for integer variables.
virtual std::size_t domainSize() const final
returns the domain size of the variable used for translations
virtual ~DBTranslator4IntegerVariable()
destructor
DBTranslator4IntegerVariable(const IntegerVariable &var, const std::vector< std::string > &missing_symbols, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max())
default constructor with an integer variable as translator
virtual std::string translateBack(const DBTranslatedValue translated_val) const final
returns the original value for a given translation
virtual void setEditableDictionaryMode(bool new_mode) final
sets/unset the editable dictionary mode
virtual const IntegerVariable * variable() const final
returns the variable stored into the translator
virtual DBTranslatedValue missingValue() const final
returns the translation of a missing value
virtual HashTable< std::size_t, std::size_t > reorder() final
returns an empty HashTable to indicate that no reordering is needed.
virtual bool hasEditableDictionary() const final
indicates that the translator is never in editable dictionary mode
virtual DBTranslatedValue translate(const std::string &str) final
returns the translation of a string
virtual bool needsReordering() const final
indicates that the translations should never be reordered
Bijection< std::size_t, std::string > back_dico_
the bijection relating back translated values and their original strings.
Set< std::string > missing_symbols_
the set of missing symbols
bool isMissingSymbol(const std::string &str) const
indicates whether a string corresponds to a missing symbol
#define GUM_ERROR(type, msg)
bool isInteger(const std::string &val)
return true is a string contains an integer value
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
The union class for storing the translated values in learning databases.