Storing a numeric value.
More...
#include <Numeric.hpp>
|
enum | NumericType {
EMPTY = 0,
INT,
UINT,
FLOAT,
DOUBLE
} |
|
typedef ::boost::variant< ::boost::blank, std::int64_t, std::uint64_t, float, double > | ValueType |
|
enum | AtomType {
BOOLEAN = 1,
NUMERIC,
STRING,
OBJECT,
SEQUENCE,
MAP,
BLOB
} |
|
typedef ::fwAtoms::factory::Key | Key |
|
|
virtual bool | isA (const std::string &type) const override |
|
| Numeric (::fwAtoms::Base::Key key) |
| Constructor. More...
|
|
virtual | ~Numeric () |
| Destructor.
|
|
virtual FWATOMS_API Base::sptr | clone () const override |
| Returns a clone object.
|
|
::fwAtoms::Base::AtomType | type () const override |
| returns Atom type
|
|
NumericType | variantType () const |
| Returns currently held numeric type.
|
|
const ValueType & | getVariant () const |
| Returns const reference to numeric's variant. More...
|
|
virtual FWATOMS_API std::string | getString () const override |
| Returns a string representing the currently held numeric value.
|
|
FWATOMS_API void | setFromString (const std::string &s, NumericType type=EMPTY) |
| Sets Numeric's value from given string, using Numeric::valueFromString.
|
|
template<typename T > |
T | getValue () const |
| Returns the held value static_casted to T. More...
|
|
bool | isValue () const |
| Test if the current base is a value or not (Value = {string;numeric;boolean}) More...
|
|
bool | isBoolean () const |
| Test if the current base is a boolean. More...
|
|
bool | isNumeric () const |
| Test if the current base is a Numeric (real or integer) More...
|
|
bool | isString () const |
| Test if the current base is a string. More...
|
|
bool | isSequence () const |
| Test if the current base is a sequence. More...
|
|
bool | isMapping () const |
| Test if the current base is a mapping. More...
|
|
bool | isBlob () const |
| Test if the current base is a blob (a object with a buffer) More...
|
|
bool | isObject () const |
| Test if the current base is an object (representation of fwData) More...
|
|
|
static bool | isTypeOf (const std::string &type) |
|
template<typename T > |
static Numeric::sptr | New (T value) |
| Build a new numeric type. More...
|
|
static FWATOMS_API ValueType | valueFromString (const std::string &s, NumericType type=EMPTY) |
| Retuns a ValueType from a std::string. More...
|
|
static bool | isTypeOf (const std::string &type) |
|
static const std::string & | classname () |
| return full object's classname with its namespace, i.e. fwCore::BaseObject
|
|
static bool | isTypeOf (const std::string &type) |
|
static const std::string & | leafClassname () |
| return object's classname without its namespace, i.e. BaseObject
|
|
static const std::string & | classname () |
| return object's classname without its namespace, i.e. BaseObject
|
|
|
template<class , class , class > |
class | ::fwTools::ClassFactory |
|
class | ::fwTools::Factory |
|
|
virtual const std::string & | getLeafClassname () const override |
| return object's classname without its namespace, i.e. BaseObject
|
|
virtual const std::string & | getClassname () const override |
| return full object's classname with its namespace, i.e. fwCore::BaseObject
|
|
static const std::string & | leafClassname () |
| return object's classname without its namespace, i.e. BaseObject
|
|
static const std::string & | classname () |
| return object's classname without its namespace, i.e. BaseObject
|
|
Storing a numeric value.
Definition at line 25 of file Numeric.hpp.
Constructor.
- Parameters
-
key | Private construction key |
Definition at line 46 of file Numeric.hpp.
template<typename T >
T fwAtoms::Numeric::getValue |
( |
| ) |
const |
Returns the held value static_casted to T.
- Template Parameters
-
- Exceptions
-
boost::positive_overflow | |
boost::negative_overflow | |
Definition at line 119 of file Numeric.hxx.
const ValueType& fwAtoms::Numeric::getVariant |
( |
| ) |
const |
|
inline |
Returns const reference to numeric's variant.
- Returns
Definition at line 91 of file Numeric.hpp.
template<typename T >
Numeric::sptr fwAtoms::Numeric::New |
( |
T |
value | ) |
|
|
static |
Numeric::ValueType fwAtoms::Numeric::valueFromString |
( |
const std::string & |
s, |
|
|
Numeric::NumericType |
type = EMPTY |
|
) |
| |
|
static |
Retuns a ValueType from a std::string.
- Parameters
-
s | source string |
type | type hint |
If hint is EMPTY (default), this method tries to find a fitting type ( in order : int64, uint64, double)
- Exceptions
-
- Returns
- a ValueType containing the numeric value
Definition at line 61 of file Numeric.cpp.
References SLM_ASSERT.
Referenced by setFromString().
The documentation for this class was generated from the following files: