FileReader handles file inputs for graph loading. More...
#include <FileReader.h>
Public Member Functions | |
FileReader (const string &file, bool &isIndexed) | |
Creates a new FileReader. | |
~FileReader () | |
Deletes this FileReader. | |
template<typename T > | |
T | read () |
Templated read Method. | |
streampos | tellg () |
Returns the position of the get pointer. | |
void | seekg (streamoff off, ios_base::seekdir dir) |
Sets the position of the get pointer. | |
bool | error () |
Returns true if an error occured while reading. | |
Private Attributes | |
ifstream | in |
The input filestream. | |
bool | isBinary |
If true, file will be read as binary. |
FileReader handles file inputs for graph loading.
Handles binary & ascii.
proland::FileReader::FileReader | ( | const string & | file, | |
bool & | isIndexed | |||
) |
Creates a new FileReader.
file | the path/name of the file to read. | |
isIndexed | after function call, will be true if the magic number was 1. False otherwise. |
proland::FileReader::~FileReader | ( | ) |
Deletes this FileReader.
bool proland::FileReader::error | ( | ) |
Returns true if an error occured while reading.
The errors corresponds to ifstream errors.
T proland::FileReader::read | ( | ) | [inline] |
Templated read Method.
Example : read<int>().
void proland::FileReader::seekg | ( | streamoff | off, | |
ios_base::seekdir | dir | |||
) |
Sets the position of the get pointer.
The get pointer determines the next location to be read in the source associated to the stream.
off | integral value of type streamoff representing the offset to be applied relative to an absolute position specified in the dir parameter. | |
dir | seeking direction. It is an object of type ios_base::seekdir that specifies an absolute position from where the offset parameter off is applied. It can take any of the following member constant values : ios_base::beg | ios_base::cur | ios_base::end. |
streampos proland::FileReader::tellg | ( | ) |
Returns the position of the get pointer.
ifstream proland::FileReader::in [private] |
The input filestream.
bool proland::FileReader::isBinary [private] |
If true, file will be read as binary.
Otherwise, ASCII.