28 #ifndef GUM_LEARNING_DB_CELL_H 29 #define GUM_LEARNING_DB_CELL_H 34 #include <type_traits> 93 DBCell(
const std::string& str);
163 void setReal(
const std::string& elt);
183 const std::string&
string()
const;
214 static const std::string&
string(
const int index);
221 template <
template <
typename >
class ALLOC = std::allocator >
223 const std::string& str,
224 const std::vector< std::string, ALLOC< std::string > >& missingVals);
231 template <
template <
typename >
class ALLOC = std::allocator >
233 const std::string& str,
234 const std::vector< std::string, ALLOC< std::string > >& missingVals);
240 template <
template <
typename >
class ALLOC = std::allocator >
241 std::string
toString(
const std::vector< std::string, ALLOC< std::string > >&
245 static bool isInteger(
const std::string& str);
248 static bool isReal(
const std::string& str);
251 template <
template <
typename >
class ALLOC = std::allocator >
253 const std::string& str,
254 const std::vector< std::string, ALLOC< std::string > >& missingVals);
259 #ifndef DOXYGEN_SHOULD_SKIP_THIS 275 using UnionType =
typename std::
276 conditional< sizeof(int) < sizeof(float), float, int >::type;
279 std::string __typeErrorMsg(
const std::string& real_type)
const;
286 static int __string_max_index;
296 #ifndef GUM_NO_INLINE
bool convertType(const EltType newtype)
try to convert the content of the DBCell into another type
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
The class representing the original values of the cells of databases.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
static DBCell bestDBCell(const std::string &str, const std::vector< std::string, ALLOC< std::string > > &missingVals)
returns the DBCell with the best type for an element encoded as a string
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
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
Set of pairs of elements with fast search for both elements.
static EltType bestType(const std::string &str, const std::vector< std::string, ALLOC< std::string > > &missingVals)
returns the best type to store a given element encoded as a string
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
std::string toString(const std::vector< std::string, ALLOC< std::string > > &missingVals) const
returns the content of the DBCell as a string, whatever its type
void setInteger(const int x)
sets the content of the DBCell
EltType
the set of types possibly taken by the last element read
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setMissingState()
sets the DBCell as a missing element
DBCell()
default constructor (ontains a missing value)