52#ifndef DOXYGEN_SHOULD_SKIP_THIS
69 const std::string s(str);
74 return DBTranslatedValue{std::numeric_limits< std::size_t >::max()};
78 "String \"" << str <<
"\" cannot be translated because it is not value for "
82 "The translation of \"" << str <<
"\" could not be found for " << _variable_)
90 return this->
back_dico_.second(translated_val.discr_val);
91 }
catch (Exception
const&) {
93 if ((translated_val.discr_val == std::numeric_limits< std::size_t >::max())
94 && !this->missing_symbols_.empty())
98 "The back translation of \"" << translated_val.discr_val
99 <<
"\" could not be found");
114 return HashTable< std::size_t, std::size_t >();
119 return _variable_.domainSize();
129 return DBTranslatedValue{std::numeric_limits< std::size_t >::max()};
The databases' cell translators for integer variables.
std::size_t domainSize() const final
returns the domain size of the variable used for translations
DBTranslatedValue translate(std::string_view str) final
returns the translation of a string
const IntegerVariable * variable() const final
returns the variable stored into the translator
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
~DBTranslator4IntegerVariable() override
destructor
void setEditableDictionaryMode(bool new_mode) final
sets/unset the editable dictionary mode
std::string translateBack(const DBTranslatedValue translated_val) const final
returns the original value for a given translation
HashTable< std::size_t, std::size_t > reorder() final
returns an empty HashTable to indicate that no reordering is needed.
bool needsReordering() const final
indicates that the translations should never be reordered
bool hasEditableDictionary() const final
indicates that the translator is never in editable dictionary mode
DBTranslatedValue missingValue() const final
returns the translation of a missing value
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(std::string_view str) const
indicates whether a string corresponds to a missing symbol
#define GUM_ERROR(type, msg)
bool isInteger(std::string_view 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.