27 #ifndef DOXYGEN_SHOULD_SKIP_THIS 35 template <
template <
typename >
class ALLOC >
43 template <
template <
typename >
class ALLOC >
50 template <
template <
typename >
class ALLOC >
51 template <
template <
typename >
class XALLOC >
54 const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
55 const bool dynamic_dictionary,
56 std::size_t max_dico_entries,
58 DBTranslator< ALLOC >::allocator_type(alloc),
59 _is_dictionary_dynamic(dynamic_dictionary),
60 _max_dico_entries(max_dico_entries), _val_type(val_type) {
61 const std::size_t size = missing_symbols.size();
66 for (
const auto& symbol : missing_symbols) {
76 template <
template <
typename >
class ALLOC >
79 const bool dynamic_dictionary,
80 std::size_t max_dico_entries,
90 template <
template <
typename >
class ALLOC >
92 const DBTranslator< ALLOC >& from,
104 template <
template <
typename >
class ALLOC >
110 template <
template <
typename >
class ALLOC >
112 DBTranslator< ALLOC >&& from,
124 template <
template <
typename >
class ALLOC >
130 template <
template <
typename >
class ALLOC >
137 template <
template <
typename >
class ALLOC >
139 operator=(
const DBTranslator< ALLOC >& from) {
152 template <
template <
typename >
class ALLOC >
154 operator=(DBTranslator< ALLOC >&& from) {
166 template <
template <
typename >
class ALLOC >
174 template <
template <
typename >
class ALLOC >
176 operator>>(
const DBTranslatedValue translated_val) {
182 template <
template <
typename >
class ALLOC >
189 template <
template <
typename >
class ALLOC >
196 template <
template <
typename >
class ALLOC >
197 INLINE
const Set< std::string, ALLOC< std::string > >&
204 template <
template <
typename >
class ALLOC >
212 template <
template <
typename >
class ALLOC >
215 const_cast< Variable*
>(this->
variable())->setName(str);
220 template <
template <
typename >
class ALLOC >
222 const std::string& str)
const {
223 const_cast< Variable*
>(this->
variable())->setDescription(str);
228 template <
template <
typename >
class ALLOC >
230 const DBTranslatedValue& value)
const {
233 return value.discr_val == std::numeric_limits< std::size_t >::max();
236 return value.cont_val == std::numeric_limits< float >::max();
240 "No missing value interpretation for this " 241 "translated value type");
Bijection< std::size_t, std::string, ALLOC< std::pair< float, std::string > > > _back_dico
the bijection relating back translated values and their original strings.
DBTranslatedValue operator<<(const std::string &str)
alias for method translate
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
virtual const RangeVariable * variable() const final
returns the variable stored into the translator
virtual std::string translateBack(const DBTranslatedValue translated_val) const final
returns the original value for a given translation
std::size_t _max_dico_entries
the maximum number of entries that the dictionary is allowed to contain
void setVariableName(const std::string &str) const
sets the name of the variable stored into the translator
gum is the global namespace for all aGrUM entities
DBTranslator(DBTranslatedValueType val_type, const std::vector< std::string, XALLOC< std::string > > &missing_symbols, const bool editable_dictionary=true, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max(), const allocator_type &alloc=allocator_type())
default constructor
virtual ~DBTranslator()
destructor
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
const Set< std::string, ALLOC< std::string > > & missingSymbols() const
returns the set of missing symbols taken into account by the translator
allocator_type getAllocator() const
returns the allocator used by the translator
bool isMissingValue(const DBTranslatedValue &val) const
indicates whether a translated value corresponds to a missing value
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
void resize(Size new_capacity)
Changes the size of the underlying hash table containing the set.
Set< std::string, ALLOC< std::string > > _missing_symbols
the set of missing symbols
DBTranslator< ALLOC > & operator=(const DBTranslator< ALLOC > &from)
copy operator
virtual DBTranslatedValue translate(const std::string &str) final
returns the translation of a string
virtual void setEditableDictionaryMode(bool new_mode)
sets/unset the editable dictionary mode
DBTranslatedValueType _val_type
the type of the values translated by the translator
bool _is_dictionary_dynamic
indicates whether the dictionary can be updated or not
std::string operator>>(const DBTranslatedValue translated_val)
alias for method translateBack
virtual bool hasEditableDictionary() const
indicates whether the translator has an editable dictionary or not
bool isMissingSymbol(const std::string &str) const
indicates whether a string corresponds to a missing symbol
typename DBTranslator< ALLOC >::allocator_type allocator_type
type for the allocators passed in arguments of methods
The base class for all the tabular databases' cell translators.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
void setVariableDescription(const std::string &str) const
sets the name of the variable stored into the translator
DBTranslatedValueType getValType() const
returns the type of values handled by the translator
void insert(const Key &k)
Inserts a new element into the set.
#define GUM_ERROR(type, msg)