25 #ifndef GUM_LEARNING_DB_CELL_H 26 #define GUM_LEARNING_DB_CELL_H 31 #include <type_traits> 90 DBCell(
const std::string& str);
160 void setReal(
const std::string& elt);
180 const std::string&
string()
const;
211 static const std::string&
string(
const int index);
218 template <
template <
typename >
class ALLOC = std::allocator >
220 const std::string& str,
221 const std::vector< std::string, ALLOC< std::string > >& missingVals);
228 template <
template <
typename >
class ALLOC = std::allocator >
230 const std::string& str,
231 const std::vector< std::string, ALLOC< std::string > >& missingVals);
237 template <
template <
typename >
class ALLOC = std::allocator >
238 std::string
toString(
const std::vector< std::string, ALLOC< std::string > >&
242 static bool isInteger(
const std::string& str);
245 static bool isReal(
const std::string& str);
248 template <
template <
typename >
class ALLOC = std::allocator >
250 const std::string& str,
251 const std::vector< std::string, ALLOC< std::string > >& missingVals);
256 #ifndef DOXYGEN_SHOULD_SKIP_THIS 272 using UnionType =
typename std::
273 conditional< sizeof(int) < sizeof(float), float, int >::type;
276 std::string __typeErrorMsg(
const std::string& real_type)
const;
283 static int __string_max_index;
293 #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.
The inlined implementation of DBCells.
gum is the global namespace for all aGrUM entities
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
The inlined implementation of DBCells.
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
Set of pairs of elements with fast search for both elements.
void setMissingState()
sets the DBCell as a missing element
DBCell()
default constructor (ontains a missing value)