fw4spl
fwTools::Type Class Reference

Class describing an elementary C++ type aka unsigned char, signed char, .... int, float, double. More...

#include <Type.hpp>

+ Collaboration diagram for fwTools::Type:

Classes

struct  Tool
 
struct  ToolBase
 

Public Types

typedef std::map< std::string, TypeTypeMapType
 
typedef std::int8_t Int8Type
 
typedef std::int16_t Int16Type
 
typedef std::int32_t Int32Type
 
typedef std::int64_t Int64Type
 
typedef std::uint8_t UInt8Type
 
typedef std::uint16_t UInt16Type
 
typedef std::uint32_t UInt32Type
 
typedef std::uint64_t UInt64Type
 
typedef float FloatType
 
typedef double DoubleType
 

Public Member Functions

FWTOOLS_API Type ()
 Default constructor.
 
FWTOOLS_API Type (const std::string &type)
 
FWTOOLS_API bool operator== (const Type &) const
 comparison operator
 
FWTOOLS_API bool operator!= (const Type &) const
 comparison operator
 
FWTOOLS_API bool operator< (const Type &) const
 define an order (lexicographic) for Type
 
template<class TYPE >
void setType ()
 Set Type value according given template. More...
 
template<class TYPE >
bool isOfType () const
 Return true iff the Type value represents the TYPE. More...
 
FWTOOLS_API unsigned char sizeOf () const
 Return the sizeof of the type.
 
FWTOOLS_API const std::string & string () const
 Return a human readable string.
 
FWTOOLS_API const std::type_info & typeId () const
 return type_info of represented type. If type is unspecified, return typeid(void)
 
template<class T >
const std::pair< T, T > minMax () const
 return the min and max storable in the Type. take care that min/max value are casted into template T
 
FWTOOLS_API bool isFixedPrecision () const
 return true iff the type use a fixed precision
 
FWTOOLS_API bool isSigned () const
 return true iff the type is signed
 
FWTOOLS_API std::string toString (const void *) const
 
template<>
FWTOOLS_API void setType ()
 
template<>
FWTOOLS_API void setType ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
FWTOOLS_API const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
const std::string & traitsToString ()
 
template<>
void setType ()
 
template<>
void setType ()
 

Static Public Member Functions

template<int SIZEOF, bool SIGNED, bool ISINTEGRAL>
static const std::string & traitsToString ()
 
template<typename T >
static Type create ()
 
static FWTOOLS_API Type create (std::string name)
 

Static Public Attributes

static FWTOOLS_API const Type s_UNSPECIFIED_TYPE
 
static FWTOOLS_API const Type s_INT8 = ::fwTools::Type::create< ::fwTools::Type::Int8Type >()
 
static FWTOOLS_API const Type s_INT16 = ::fwTools::Type::create< ::fwTools::Type::Int16Type >()
 
static FWTOOLS_API const Type s_INT32 = ::fwTools::Type::create< ::fwTools::Type::Int32Type >()
 
static FWTOOLS_API const Type s_INT64 = ::fwTools::Type::create< ::fwTools::Type::Int64Type >()
 
static FWTOOLS_API const Type s_UINT8 = ::fwTools::Type::create< ::fwTools::Type::UInt8Type >()
 
static FWTOOLS_API const Type s_UINT16 = ::fwTools::Type::create< ::fwTools::Type::UInt16Type >()
 
static FWTOOLS_API const Type s_UINT32 = ::fwTools::Type::create< ::fwTools::Type::UInt32Type >()
 
static FWTOOLS_API const Type s_UINT64 = ::fwTools::Type::create< ::fwTools::Type::UInt64Type >()
 
static FWTOOLS_API const Type s_FLOAT = ::fwTools::Type::create< ::fwTools::Type::FloatType >()
 
static FWTOOLS_API const Type s_DOUBLE = ::fwTools::Type::create< ::fwTools::Type::DoubleType >()
 
static FWTOOLS_API const std::string s_UNSPECIFIED_TYPENAME
 
static FWTOOLS_API const std::string s_INT8_TYPENAME
 
static FWTOOLS_API const std::string s_INT16_TYPENAME
 
static FWTOOLS_API const std::string s_INT32_TYPENAME
 
static FWTOOLS_API const std::string s_INT64_TYPENAME
 
static FWTOOLS_API const std::string s_UINT8_TYPENAME
 
static FWTOOLS_API const std::string s_UINT16_TYPENAME
 
static FWTOOLS_API const std::string s_UINT32_TYPENAME
 
static FWTOOLS_API const std::string s_UINT64_TYPENAME
 
static FWTOOLS_API const std::string s_FLOAT_TYPENAME
 
static FWTOOLS_API const std::string s_DOUBLE_TYPENAME
 

Protected Attributes

std::string m_name
 
unsigned char m_sizeof
 
bool m_isSigned
 
bool m_isFixedPrecision
 
::boost::any m_min
 
::boost::any m_max
 
std::shared_ptr< ToolBasem_tool
 

Static Protected Attributes

static FWTOOLS_API const TypeMapType s_TYPEMAP
 Value for not specified type. More...
 

Detailed Description

Class describing an elementary C++ type aka unsigned char, signed char, .... int, float, double.

Definition at line 32 of file Type.hpp.

Member Function Documentation

template<typename T >
bool fwTools::Type::isOfType ( ) const

Return true iff the Type value represents the TYPE.

Note
A BOOST_ASSERTION can be raised if TYPE is not managed by isMapping

Definition at line 227 of file Type.hpp.

template<typename T >
void fwTools::Type::setType ( )

Set Type value according given template.

Note
A BOOST_ASSERTION can be raised if TYPE is not managed by isMapping

Definition at line 235 of file Type.hpp.

References OSLM_ERROR, and SPTR.

Member Data Documentation

const Type::TypeMapType fwTools::Type::s_TYPEMAP
staticprotected
Initial value:
= {{
{Type::s_INT8_TYPENAME, Type::create< ::fwTools::Type::Int8Type >()},
{Type::s_INT16_TYPENAME, Type::create< ::fwTools::Type::Int16Type >()},
{Type::s_INT32_TYPENAME, Type::create< ::fwTools::Type::Int32Type >()},
{Type::s_INT64_TYPENAME, Type::create< ::fwTools::Type::Int64Type >()},
{Type::s_UINT8_TYPENAME, Type::create< ::fwTools::Type::UInt8Type >()},
{Type::s_UINT16_TYPENAME, Type::create< ::fwTools::Type::UInt16Type >()},
{Type::s_UINT32_TYPENAME, Type::create< ::fwTools::Type::UInt32Type >()},
{Type::s_UINT64_TYPENAME, Type::create< ::fwTools::Type::UInt64Type >()},
{Type::s_FLOAT_TYPENAME, Type::create< ::fwTools::Type::FloatType >()},
{Type::s_DOUBLE_TYPENAME, Type::create< ::fwTools::Type::DoubleType >()}
}}

Value for not specified type.

Definition at line 141 of file Type.hpp.


The documentation for this class was generated from the following files: