BALL::BinaryFileAdaptor< T > Class Template Reference
[Operating system support]

#include <BALL/SYSTEM/file.h>

List of all members.


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

data_
bool swap_endian_

Detailed Description

template<typename T>
class BALL::BinaryFileAdaptor< T >

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.

Caveat: This concept relies on the C++ memory layout and thus is highly non-portable!
The flag swap_endian can be used to swap between big- and little-endian.

Definition at line 625 of file file.h.


Constructor & Destructor Documentation

template<typename T >
BALL_INLINE BALL::BinaryFileAdaptor< T >::BinaryFileAdaptor (  )  [inline]

Default constructor.

Definition at line 675 of file file.h.

template<typename T>
BALL_INLINE BALL::BinaryFileAdaptor< T >::BinaryFileAdaptor ( const T &  data,
bool  swap_endian = false 
) [inline]

Detailed constructor.

Definition at line 683 of file file.h.


Member Function Documentation

template<typename T >
BALL_INLINE T & BALL::BinaryFileAdaptor< T >::getData (  )  [inline]

Returns a mutable reference to the data stored in the adaptor

Definition at line 719 of file file.h.

template<typename T >
BALL_INLINE const T & BALL::BinaryFileAdaptor< T >::getData (  )  const [inline]

Returns a const reference to the data stored in the adaptor

Definition at line 712 of file file.h.

template<typename T >
BALL_INLINE bool BALL::BinaryFileAdaptor< T >::getSwapEndian (  )  const [inline]

return the swap_endian flag

Definition at line 698 of file file.h.

template<typename T>
BALL_INLINE void BALL::BinaryFileAdaptor< T >::setData ( const T &  data  )  [inline]

Sets the member data to the desired value.

Parameters:
data data of type T

Definition at line 705 of file file.h.

template<typename T >
BALL_INLINE void BALL::BinaryFileAdaptor< T >::setSwapEndian ( bool  swap_endian  )  [inline]

Set the swap_endian flag.

Definition at line 691 of file file.h.


Member Data Documentation

template<typename T>
T BALL::BinaryFileAdaptor< T >::data_ [protected]

Definition at line 667 of file file.h.

template<typename T>
bool BALL::BinaryFileAdaptor< T >::swap_endian_ [protected]

Definition at line 670 of file file.h.


Generated on Tue Dec 7 19:13:01 2010 for BALL by  doxygen 1.5.9