18 #include "dataIStream.h" 
   19 #include "dataStreamArchiveException.h" 
   24 template< 
typename T >
 
   25 void DataIStreamArchive::load_array( boost::serialization::array< T >& a,
 
   28     _stream >> Array< T >( a.address(), a.count( ));
 
   31 template< 
class C, 
class T, 
class A >
 
   32 void DataIStreamArchive::load( std::basic_string< C, T, A >& s )
 
   35     BOOST_STATIC_ASSERT( 
sizeof(C) == 
sizeof(
char));
 
   39 template< 
typename T >
 
   40 typename boost::enable_if< boost::is_integral<T> >::type
 
   41 DataIStreamArchive::load( T& t )
 
   43 #if BOOST_VERSION < 104800 
   44     namespace bs = boost::detail;
 
   46     namespace bs = boost::spirit::detail;
 
   50     if( 
signed char size = _loadSignedChar( ))
 
   53         if( size < 0 && boost::is_unsigned<T>::value )
 
   54             throw DataStreamArchiveException();
 
   57         else if( (
unsigned)abs(size) > 
sizeof(T))
 
   58             throw DataStreamArchiveException( size );
 
   61         T temp = size < 0 ? -1 : 0;
 
   62         load_binary( &temp, abs(size));
 
   66         t = bs::load_little_endian<T, sizeof(T)>( &temp );
 
   73 template< 
typename T >
 
   74 typename boost::enable_if<boost::is_floating_point<T> >::type
 
   75 DataIStreamArchive::load( T& t )
 
   77     namespace fp = boost::spirit::math;
 
   78     typedef typename fp::detail::fp_traits<T>::type traits;
 
   86     typename traits::bits bits;
 
   87     BOOST_STATIC_ASSERT( 
sizeof(bits) == 
sizeof(T));
 
   88     BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_iec559 );
 
   91     traits::set_bits( t, bits );
 
   94     if( get_flags() & serialization::no_infnan && !fp::isfinite( t ))
 
   95         throw DataStreamArchiveException( t );
 
  100     if( std::numeric_limits<T>::has_denorm == std::denorm_absent &&
 
  101         fp::fpclassify(t) == (
int)FP_SUBNORMAL ) 
 
  103         throw DataStreamArchiveException( t );
 
Object-oriented network library.