28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 58 if (!__strings().existsFirst(str)) {
59 __strings().insert(str, __string_max_index);
60 __val_index = __string_max_index;
63 __val_index = __strings().second(str);
72 std::memcpy(&__val_index, &(from.__val_index),
sizeof(UnionType));
81 std::memcpy(&__val_index, &(from.__val_index),
sizeof(UnionType));
96 std::memcpy(&__val_index, &(from.__val_index),
sizeof(UnionType));
106 __type = from.__type;
107 std::memcpy(&__val_index, &(from.__val_index),
sizeof(UnionType));
132 if (!__strings().existsFirst(str)) {
133 __strings().insert(str, __string_max_index);
134 __val_index = __string_max_index;
135 ++__string_max_index;
137 __val_index = __strings().second(str);
147 return (__type == from.__type)
149 || ((__type ==
EltType::REAL) && (__val_real == from.__val_real))
150 || (__val_integer == from.__val_integer));
169 GUM_ERROR(TypeError, __typeErrorMsg(
"a real number"));
183 GUM_ERROR(TypeError,
"the string does not contain a real number");
184 __val_real = std::stof(elt);
192 return __val_integer;
194 GUM_ERROR(TypeError, __typeErrorMsg(
"an integer"));
208 GUM_ERROR(TypeError,
"the string does not contain an integer");
209 __val_integer = std::stoi(elt);
217 return __strings().first(__val_index);
219 GUM_ERROR(TypeError, __typeErrorMsg(
"a string"));
228 GUM_ERROR(TypeError, __typeErrorMsg(
"a string"));
234 return __strings().first(index);
240 if (!__strings().existsFirst(str)) {
241 __strings().insert(str, __string_max_index);
242 __val_index = __string_max_index;
243 ++__string_max_index;
245 __val_index = __strings().second(str);
void setString(const std::string &elt)
sets the content of the DBCell
bool isMissing() const
indicates whether the cell contains a missing value
static bool isInteger(const std::string &str)
determines whether a string corresponds precisely to an integer
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const std::string & string() const
returns the DBcell as a string
int integer() const
returns the DBcell as an integer
float real() const
returns the DBcell as a real number
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
static bool isReal(const std::string &str)
determine whether a string corresponds precisely to a real number
bool operator!=(const DBCell &from) const
test of inequality
DBCell & operator=(const DBCell &from)
copy operator
void setReal(const float x)
sets the content of the DBCell
int stringIndex() const
returns the DBcell as the index of a string in a static bijection
EltType type() const noexcept
returns the current type of the DBCell
bool operator==(const DBCell &from) const
test of equality
void setInteger(const int x)
sets the content of the DBCell
EltType
the set of types possibly taken by the last element read
void setMissingState()
sets the DBCell as a missing element
#define GUM_ERROR(type, msg)
DBCell()
default constructor (ontains a missing value)