#include <BALL/SYSTEM/file.h>
Public Member Functions | |
Constructors and destructor | |
BinaryFileAdaptor () | |
Default constructor. | |
BinaryFileAdaptor (const T &data, bool swap_endian=false) | |
Detailed constructor. | |
Accessors | |
void | setSwapEndian (bool swap_endian) |
Set the swap_endian flag. | |
bool | getSwapEndian () const |
return the swap_endian flag | |
void | setData (const T &data) |
const T & | getData () const |
T & | getData () |
Protected Attributes | |
T | data_ |
bool | swap_endian_ |
Helper class for data conversion. BinaryFileAdaptors are used to read and write binary data from and to streams. This is done by reading the member data
as a byte stream through an explicit cast and utilizing the stream read() and write() functions.
BALL_INLINE BALL::BinaryFileAdaptor< T >::BinaryFileAdaptor | ( | ) | [inline] |
Default constructor.
BALL_INLINE BALL::BinaryFileAdaptor< T >::BinaryFileAdaptor | ( | const T & | data, | |
bool | swap_endian = false | |||
) | [inline] |
Detailed constructor.
BALL_INLINE T & BALL::BinaryFileAdaptor< T >::getData | ( | ) | [inline] |
Returns a mutable reference to the data stored in the adaptor
References BALL::BinaryFileAdaptor< T >::data_.
BALL_INLINE const T & BALL::BinaryFileAdaptor< T >::getData | ( | ) | const [inline] |
Returns a const reference to the data stored in the adaptor
References BALL::BinaryFileAdaptor< T >::data_.
Referenced by BALL::TRegularData3D< ValueType >::binaryRead(), BALL::TRegularData2D< ValueType >::binaryRead(), BALL::TRegularData1D< ValueType >::binaryRead(), and BALL::operator>>().
BALL_INLINE bool BALL::BinaryFileAdaptor< T >::getSwapEndian | ( | ) | const [inline] |
return the swap_endian flag
References BALL::BinaryFileAdaptor< T >::swap_endian_.
Referenced by BALL::operator>>().
BALL_INLINE void BALL::BinaryFileAdaptor< T >::setData | ( | const T & | data | ) | [inline] |
Sets the member data
to the desired value.
data | data of type T |
References BALL::BinaryFileAdaptor< T >::data_.
Referenced by BALL::TRegularData3D< ValueType >::binaryWrite(), BALL::TRegularData2D< ValueType >::binaryWrite(), BALL::TRegularData1D< ValueType >::binaryWrite(), and BALL::operator>>().
BALL_INLINE void BALL::BinaryFileAdaptor< T >::setSwapEndian | ( | bool | swap_endian | ) | [inline] |
Set the swap_endian flag.
References BALL::BinaryFileAdaptor< T >::swap_endian_.
T BALL::BinaryFileAdaptor< T >::data_ [protected] |
Referenced by BALL::BinaryFileAdaptor< T >::getData(), and BALL::BinaryFileAdaptor< T >::setData().
bool BALL::BinaryFileAdaptor< T >::swap_endian_ [protected] |