/******************************************************************************/ /* MEMORY STREAMS - INLINE CODE ***********************************************/ /******************************************************************************/ #ifndef _H_EBCL_INLINE_MEMORYSTREAMS #define _H_EBCL_INLINE_MEMORYSTREAMS #include namespace ebcl { /*= T_MemoryInputStream ======================================================*/ template< size_t S , typename T > inline T_MemoryInputStream::T_MemoryInputStream( T_FixedBuffer< S , T > const& buffer ) : T_MemoryInputStream( buffer.data( ) , buffer.bytes( ) ) { } template< typename T > inline T_MemoryInputStream::T_MemoryInputStream( T_Buffer< T > const& buffer ) : T_MemoryInputStream( buffer.data( ) , buffer.bytes( ) ) { } /*= T_MemoryOutputStream =====================================================*/ template< size_t S , typename T > inline T_MemoryOutputStream::T_MemoryOutputStream( T_FixedBuffer< S , T >& buffer ) : T_MemoryOutputStream( buffer.data( ) , buffer.bytes( ) ) { } template< typename T > inline T_MemoryOutputStream::T_MemoryOutputStream( T_Buffer< T >& buffer ) : T_MemoryOutputStream( buffer.data( ) , buffer.bytes( ) , [&buffer] ( uint8_t* , size_t reqSize ) -> uint8_t* { const size_t mod( reqSize % sizeof( T ) ); const size_t nItems( reqSize / sizeof( T ) + ( mod ? 1 : 0 ) ); buffer.resize( nItems ); return buffer.data( ); } ) { } } // namespace #endif // _H_EBCL_INLINE_MEMORYSTREAMS