Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

annie::File Class Reference

#include <File.h>

List of all members.

Public Methods

 File ()
 Creates an empty File object. More...

 File (std::string filename)
 Opens a given filename in the File object. More...

void open (std::string filename)
 Explicitly opens a given filename in the File object. More...

char readChar ()
 Reads one character from the file. More...

int readInt ()
 Returns an integer read from the file. More...

real readDouble ()
 Returns a real read from the file. More...

std::string readWord ()
 Returns a "word" (a string with no word separators/delimiters) read from the file. More...

void close ()
 Closes the file. More...

std::string readLine ()
 Returns a complete line. More...

bool eof ()
 checks if the file has reached the end. More...


Private Methods

void _next ()

Private Attributes

std::string _filename
std::ifstream _file
bool _isOpen


Detailed Description

The idea is that this class will be used to read in information from text files created by the "save" function in various annie classes. When a file is opened, we check that the first non-commented line contains "ANNIE_FILE <ver>" where <ver> is the version number. This has been done to allow for future changes to file formats used by ANNIE. All save functions should save in the same format. Current version is 1.0.

Comments in an ANNIE file are given by a '#'. The rest of the line following '#' is ignored. The member functions of this class return values ignoring any and all comments that may have appeared in between.


Constructor & Destructor Documentation

annie::File::File  
 

Creates an empty File object.

annie::File::File std::string    filename
 

Opens a given filename in the File object.

Parameters:
filename  The name of the file to be opened.
Exceptions:
Throws  an Exception if the first line of the file is not ANNIE_FILE or the version of the ANNIE file is an incorrect one (not supported by this compilation of code)


Member Function Documentation

void annie::File::_next   [private]
 

void annie::File::close  
 

Closes the file.

bool annie::File::eof  
 

checks if the file has reached the end.

Returns:
true if the file has reached the end, false otherwise

void annie::File::open std::string    filename
 

Explicitly opens a given filename in the File object.

Parameters:
filename  The name of the file to be opened.
Exceptions:
Exception  if the first line of the file is not ANNIE_FILE or the version of the ANNIE file is an incorrect one (not supported by this compilation of code)
Exception  if another file is already opened and hasn't been closed.

char annie::File::readChar  
 

Reads one character from the file.

real annie::File::readDouble  
 

Returns a real read from the file.

int annie::File::readInt  
 

Returns an integer read from the file.

std::string annie::File::readLine  
 

Returns a complete line.

std::string annie::File::readWord  
 

Returns a "word" (a string with no word separators/delimiters) read from the file.


Member Data Documentation

std::ifstream annie::File::_file [private]
 

std::string annie::File::_filename [private]
 

bool annie::File::_isOpen [private]
 


The documentation for this class was generated from the following file:
Generated on Wed Apr 23 10:42:36 2003 for BioFilter by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002