7 #ifndef __FWTOOLS_DYNAMICTYPE_HXX__ 8 #define __FWTOOLS_DYNAMICTYPE_HXX__ 12 #include <fwCore/base.hpp> 14 #include "fwTools/StringKeyTypeMapping.hpp" 15 #include "fwTools/Dispatcher.hpp" 24 d.template setType<TYPE>();
37 template<
class KEYTYPE>
53 template<
typename PIXEL >
54 void operator()( std::pair<T,T> &minMax )
56 minMax.first =
static_cast< T
>( std::numeric_limits< PIXEL >::min() );
57 minMax.second =
static_cast< T
>( std::numeric_limits< PIXEL >::max() );
60 if(!std::numeric_limits< PIXEL >::is_integer)
63 minMax.first = minMax.second * -1;
71 std::list< std::string>::const_iterator supportedTypesIter;
73 supportedTypesIter = m_managedTypes.begin();
74 while ( supportedTypesIter != m_managedTypes.end() )
76 if ( isMapping<TYPE>( *supportedTypesIter) )
78 m_value = *supportedTypesIter;
79 m_sizeof =
sizeof(TYPE);
84 throw std::invalid_argument(
"DynamicType::setType<TYPE> incorrect TYPE");
91 return isMapping<TYPE>(m_value);
104 template<
class NEWTYPE>
109 if ( isMapping<NEWTYPE>(newKey) ==
false )
111 throw std::invalid_argument(
"Dynamic::registerNewType misconception with isMapping");
115 if ( std::find( m_managedTypes.begin(),m_managedTypes.end(), newKey ) != m_managedTypes.end() )
117 throw std::invalid_argument(
"Dynamic::registerNewType newKey already used");
126 catch ( std::exception )
129 m_managedTypes.push_back(newKey);
133 throw std::invalid_argument(
"Dynamic::registerNewType another isMapping is responding");
141 std::pair<T,T> minMax;
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...