Pol  Revision:3cfda13
Pol::Clib::BinaryFile Class Reference

#include <binaryfile.h>

Public Member Functions

 BinaryFile ()
 
 BinaryFile (const std::string &filename, std::ios::openmode mode)
 
 ~BinaryFile ()
 
void Close ()
 
std::fstream::pos_type FileSize ()
 
void Open (const std::string &filename, std::ios::openmode mode)
 
template<class T >
void Read (T &val)
 
template<class T >
void Read (T *arr, size_t count)
 
template<class T >
void ReadVector (std::vector< T > &vec)
 
void Seek (std::fstream::pos_type abs_offset)
 
size_t sizeEstimate () const
 

Private Member Functions

size_t GetElementCount (size_t elemsize)
 
void ReadBuffer (void *buffer, std::streamsize length)
 

Private Attributes

std::fstream _file
 
std::string _filename
 

Detailed Description

Definition at line 18 of file binaryfile.h.

Constructor & Destructor Documentation

Pol::Clib::BinaryFile::BinaryFile ( )

Definition at line 21 of file binaryfile.cpp.

Pol::Clib::BinaryFile::BinaryFile ( const std::string &  filename,
std::ios::openmode  mode 
)

Definition at line 23 of file binaryfile.cpp.

References Open().

Pol::Clib::BinaryFile::~BinaryFile ( )

Definition at line 28 of file binaryfile.cpp.

Member Function Documentation

void Pol::Clib::BinaryFile::Close ( )

Definition at line 42 of file binaryfile.cpp.

References _file, _filename, and passert.

std::fstream::pos_type Pol::Clib::BinaryFile::FileSize ( )

Definition at line 65 of file binaryfile.cpp.

References _file, _filename, and passert.

Referenced by GetElementCount(), Pol::Plib::MapServer::LoadSecondLevelIndex(), and ReadVector().

size_t Pol::Clib::BinaryFile::GetElementCount ( size_t  elemsize)
private

Definition at line 89 of file binaryfile.cpp.

References _filename, Pol::Clib::decint(), FileSize(), and Pol::Clib::filesize().

Referenced by ReadVector().

void Pol::Clib::BinaryFile::Open ( const std::string &  filename,
std::ios::openmode  mode 
)
template<class T >
void Pol::Clib::BinaryFile::Read ( T *  arr,
size_t  count 
)
inline

Definition at line 35 of file binaryfile.h.

References ReadBuffer().

void Pol::Clib::BinaryFile::ReadBuffer ( void *  buffer,
std::streamsize  length 
)
private

Definition at line 58 of file binaryfile.cpp.

References _file, _filename, and Pol::Clib::decint().

Referenced by Read(), and ReadVector().

template<class T >
void Pol::Clib::BinaryFile::ReadVector ( std::vector< T > &  vec)
inline
void Pol::Clib::BinaryFile::Seek ( std::fstream::pos_type  abs_offset)
size_t Pol::Clib::BinaryFile::sizeEstimate ( ) const

Member Data Documentation

std::fstream Pol::Clib::BinaryFile::_file
private

Definition at line 57 of file binaryfile.h.

Referenced by Close(), FileSize(), Open(), ReadBuffer(), and Seek().

std::string Pol::Clib::BinaryFile::_filename
private

Definition at line 58 of file binaryfile.h.

Referenced by Close(), FileSize(), GetElementCount(), Open(), ReadBuffer(), Seek(), and sizeEstimate().


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