ISIS Core Library 0.7.2 (api 3.0.0)
|
00001 #ifndef TYPES_HPP_INCLUDED 00002 #define TYPES_HPP_INCLUDED 00003 00004 #include <boost/mpl/vector/vector30.hpp> 00005 #include <boost/mpl/distance.hpp> 00006 #include <boost/mpl/plus.hpp> 00007 #include <boost/mpl/int.hpp> 00008 #include <boost/mpl/find.hpp> 00009 #include <boost/mpl/contains.hpp> 00010 00011 #ifndef _MSC_VER 00012 #include <stdint.h> 00013 #endif 00014 00015 #include <boost/date_time/gregorian/gregorian_types.hpp> 00016 #include <boost/date_time/posix_time/posix_time_types.hpp> 00017 #include "vector.hpp" 00018 #include "color.hpp" 00019 #include "selection.hpp" 00020 00021 #include <complex> 00022 00023 namespace isis 00024 { 00025 namespace util 00026 { 00027 00028 typedef std::list<int32_t> ilist; 00029 typedef std::list<double> dlist; 00030 typedef std::list<std::string> slist; 00031 00033 namespace _internal 00034 { 00035 00037 typedef boost::mpl::vector27 < //increase this if a type is added (if >30 consider including vector40 above) 00038 bool //1 00039 , int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t // 9 00040 , float, double // 11 00041 , color24, color48 // 13 00042 , fvector3, dvector3 // 15 00043 , fvector4, dvector4, ivector4 // 18 00044 , ilist, dlist, slist // 21 00045 , std::string, isis::util::Selection //23 00046 , std::complex<float>, std::complex<double> //25 00047 , boost::posix_time::ptime, boost::gregorian::date //27 00048 > types; 00049 00056 template<class T> struct TypeID { 00057 typedef boost::mpl::plus < 00058 boost::mpl::int_<1>, 00059 typename boost::mpl::distance < 00060 boost::mpl::begin<types>::type, 00061 typename boost::mpl::find<types, T>::type 00062 >::type 00063 > type; 00064 static const unsigned short value = type::value; 00065 }; 00066 } 00068 00073 template< typename T > struct checkType { 00074 BOOST_MPL_ASSERT_MSG( 00075 ( boost::mpl::contains<_internal::types, T>::value ) 00076 , TYPE_IS_NOT_KNOWN 00077 , ( T ) 00078 ); 00079 }; 00080 00081 std::map<unsigned short, std::string> getTypeMap( bool withValues = true, bool withValueArrays = true ); 00082 00083 std::map< std::string, unsigned short> getTransposedTypeMap( bool withValues = true, bool withValueArrays = true ); 00084 } 00085 } 00086 00087 #endif //TYPES_HPP_INCLUDED