Public Member Functions | Protected Member Functions | Protected Attributes
DUtils::BinaryFile Class Reference

#include <BinaryFile.h>

List of all members.

Public Member Functions

 BinaryFile (void)
 BinaryFile (const char *filename, const FILE_MODES mode)
 BinaryFile (const string &filename, const FILE_MODES mode)
unsigned int BytesRead ()
void Close ()
void DiscardBytes (int count)
void DiscardNextByte ()
bool Eof ()
void OpenForAppending (const char *filename)
void OpenForAppending (const string &filename)
void OpenForReading (const char *filename)
void OpenForReading (const string &filename)
void OpenForWriting (const char *filename)
void OpenForWriting (const string &filename)
BinaryFileoperator<< (char v)
BinaryFileoperator<< (int v)
BinaryFileoperator<< (float v)
BinaryFileoperator<< (double v)
BinaryFileoperator>> (char &v)
BinaryFileoperator>> (int &v)
BinaryFileoperator>> (float &v)
BinaryFileoperator>> (double &v)
 ~BinaryFile (void)

Protected Member Functions

void hton_d (double d, char buf[8]) const
void hton_f (float v, char buf[8]) const
void Init (const char *filename, const FILE_MODES mode)
bool isLittleEndian () const
double ntoh_d (char buf[8]) const
float ntoh_f (char buf[8]) const
void setEndianness ()

Protected Attributes

char m_aux [8]
fstream m_f
int m_is_little_endian
FILE_MODES m_mode

Detailed Description

Definition at line 36 of file BinaryFile.h.


Constructor & Destructor Documentation

Definition at line 47 of file BinaryFile.cpp.

Definition at line 52 of file BinaryFile.cpp.

BinaryFile::BinaryFile ( const char *  filename,
const FILE_MODES  mode 
)

Definition at line 62 of file BinaryFile.cpp.

BinaryFile::BinaryFile ( const string &  filename,
const FILE_MODES  mode 
)

Definition at line 67 of file BinaryFile.cpp.


Member Function Documentation

unsigned int BinaryFile::BytesRead ( )

Returns the number of bytes read in reading mode

Returns:
number of bytes read

Definition at line 139 of file BinaryFile.cpp.

Definition at line 57 of file BinaryFile.cpp.

void BinaryFile::DiscardBytes ( int  count)

Reads n bytes and discards them

Parameters:
countnumber of bytes to discard
Exceptions:
DExceptionif wrong access mode

Definition at line 124 of file BinaryFile.cpp.

Reads the next byte and throws it away

Exceptions:
DExceptionif wrong access mode

Definition at line 102 of file BinaryFile.h.

bool BinaryFile::Eof ( ) [inline]

Definition at line 134 of file BinaryFile.cpp.

void BinaryFile::hton_d ( double  d,
char  buf[8] 
) const [protected]

Converts a double into 8 bytes in network order

Parameters:
vdouble value
buf(out) byte buffer output

Definition at line 290 of file BinaryFile.cpp.

void BinaryFile::hton_f ( float  v,
char  buf[8] 
) const [protected]

Converts a float into 4 bytes in network order

Parameters:
vfloat value
buf(out) byte buffer output. Only buf[0..3] is used

Definition at line 251 of file BinaryFile.cpp.

void BinaryFile::Init ( const char *  filename,
const FILE_MODES  mode 
) [protected]

Initializes the object by opening a file

Parameters:
filenamefile to open
modeopening mode
Exceptions:
DExceptionif cannot open the file

Definition at line 72 of file BinaryFile.cpp.

bool DUtils::BinaryFile::isLittleEndian ( ) const [inline, protected]

Returns if this machine uses little endian

Returns:
true iif little endian

Definition at line 206 of file BinaryFile.h.

double BinaryFile::ntoh_d ( char  buf[8]) const [protected]

Converts an array of bytes in network order into a 8 byte double

Parameters:
bufbyte array
Returns:
double value

Definition at line 316 of file BinaryFile.cpp.

float BinaryFile::ntoh_f ( char  buf[8]) const [protected]

Converts an array of bytes in network order into a 4 byte float

Parameters:
bufbyte array. only buf[0..3] is used
Returns:
float value

Definition at line 269 of file BinaryFile.cpp.

void BinaryFile::OpenForAppending ( const char *  filename)

Definition at line 112 of file BinaryFile.cpp.

void DUtils::BinaryFile::OpenForAppending ( const string &  filename) [inline]

Definition at line 81 of file BinaryFile.h.

void BinaryFile::OpenForReading ( const char *  filename)

Definition at line 88 of file BinaryFile.cpp.

void DUtils::BinaryFile::OpenForReading ( const string &  filename) [inline]

Definition at line 61 of file BinaryFile.h.

void BinaryFile::OpenForWriting ( const char *  filename)

Definition at line 100 of file BinaryFile.cpp.

void DUtils::BinaryFile::OpenForWriting ( const string &  filename) [inline]

Definition at line 71 of file BinaryFile.h.

BinaryFile & BinaryFile::operator<< ( char  v)

Definition at line 147 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator<< ( int  v)

Definition at line 159 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator<< ( float  v)

Definition at line 172 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator<< ( double  v)

Definition at line 185 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator>> ( char &  v)

Definition at line 198 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator>> ( int &  v)

Definition at line 210 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator>> ( float &  v)

Definition at line 224 of file BinaryFile.cpp.

BinaryFile & BinaryFile::operator>> ( double &  v)

Definition at line 237 of file BinaryFile.cpp.

void BinaryFile::setEndianness ( ) [protected]

Checks the endianness of this machine

Definition at line 345 of file BinaryFile.cpp.


Member Data Documentation

char DUtils::BinaryFile::m_aux[8] [protected]

Definition at line 214 of file BinaryFile.h.

fstream DUtils::BinaryFile::m_f [protected]

Definition at line 213 of file BinaryFile.h.

Definition at line 217 of file BinaryFile.h.

Definition at line 212 of file BinaryFile.h.


The documentation for this class was generated from the following files:


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:34:29