50#ifndef DOXYGEN_SHOULD_SKIP_THIS
63 const IntegerVariable& var,
64 const std::vector< std::string >& missing_symbols,
65 std::size_t max_dico_entries) :
73 if (var.domainSize() > max_dico_entries) {
74 GUM_ERROR(SizeError,
"the dictionary induced by the variable is too large")
78 for (
auto iter = this->missing_symbols_.beginSafe(); iter != this->missing_symbols_.endSafe();
80 if (DBCell::isInteger(*iter)) {
81 const int missing_val = std::stoi(*iter);
82 if (_variable_.isValue(missing_val)) { this->missing_symbols_.erase(iter); }
88 for (
const auto& label: var.labels()) {
94 if (this->missing_symbols_.exists(label)) { this->missing_symbols_.erase(label); }
101 GUM_CONSTRUCTOR(DBTranslator4IntegerVariable);
105 DBTranslator4IntegerVariable::DBTranslator4IntegerVariable(
const IntegerVariable& var,
106 std::size_t max_dico_entries) :
107 DBTranslator(DBTranslatedValueType::
DISCRETE, true, false, max_dico_entries),
110 if (var.domainSize() > max_dico_entries) {
111 GUM_ERROR(SizeError,
"the dictionary induced by the variable is too large")
115 std::size_t size = 0;
116 for (
const auto& label: var.labels()) {
117 this->back_dico_.insert(size, label);
122 GUM_CONSTRUCTOR(DBTranslator4IntegerVariable);
126 DBTranslator4IntegerVariable::DBTranslator4IntegerVariable(
127 const DBTranslator4IntegerVariable& from) :
128 DBTranslator(from), _variable_(from._variable_) {
130 GUM_CONS_CPY(DBTranslator4IntegerVariable);
134 DBTranslator4IntegerVariable::DBTranslator4IntegerVariable(
135 DBTranslator4IntegerVariable&& from) :
136 DBTranslator(
std::move(from)), _variable_(
std::move(from._variable_)) {
138 GUM_CONS_MOV(DBTranslator4IntegerVariable);
142 DBTranslator4IntegerVariable* DBTranslator4IntegerVariable::clone()
const {
143 return new DBTranslator4IntegerVariable(*
this);
147 DBTranslator4IntegerVariable&
148 DBTranslator4IntegerVariable::operator=(
const DBTranslator4IntegerVariable& from) {
150 DBTranslator::operator=(from);
151 _variable_ = from._variable_;
158 DBTranslator4IntegerVariable&
159 DBTranslator4IntegerVariable::operator=(DBTranslator4IntegerVariable&& from) {
161 DBTranslator::operator=(std::move(from));
162 _variable_ = std::move(from._variable_);
The databases' cell translators for integer variables.
The databases' cell translators for integer variables.
void insert(const T1 &first, const T2 &second)
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
The base class for all the tabular database cell translators.
Bijection< std::size_t, std::string > back_dico_
the bijection relating back translated values and their original strings.
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities