CrossFramework Library

XBase/ScalerStruct.hpp

説明を見る。
00001 
00006 #if defined(XBASE_INCLUDED_SCALERSTRUCT_HPP)
00007 #else
00008 #define XBASE_INCLUDED_SCALERSTRUCT_HPP
00009 
00010 //------------------------------------------------------------
00011 #include <limits>
00012 #include <XBase/PODStruct.hpp>
00013 #include <XBase/ShortString.hpp>
00014 #include <XBase/ShortStringFactory.hpp>
00015 #include <XBase/StaticAssert.hpp>
00016 #include <XBase/TypeTraits.hpp>
00017 
00018 //------------------------------------------------------------
00019 namespace XBase {
00021 
00022 
00023     template< typename T >
00024     struct ScalerStruct : public PODStruct<T>
00025     {
00026         static typename PODStruct<T>::ValueType MaxValue() { return std::numeric_limits< typename PODStruct<T>::ValueType >::max(); } 
00027         static typename PODStruct<T>::ValueType MinValue(){ return std::numeric_limits< typename PODStruct<T>::ValueType >::min(); } 
00028 
00030         const ShortString toShortString()const { return ::XBase::ShortStringFactory::Create( PODStruct<T>::readRef() ); }
00031 
00032     private:
00033         typedef ::XBase::PODStruct< T > SuperStruct; // 親クラスのエイリアス。
00034         XBASE_STATIC_ASSERT( TypeTraits::IsPOD< SuperStruct >::Value ); // POD型のチェック。
00035         XBASE_STATIC_ASSERT( sizeof( SuperStruct ) == sizeof( ValueType ) ); // サイズが同じであることを保証。        
00036     };
00038 }
00039 //------------------------------------------------------------
00040 #endif
00041 // EOF
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義