#include <matrix-stream.h>
Public Member Functions | |
virtual const char * | getName () const =0 |
virtual bool | isSparse () const =0 |
MatrixStreamError | init (std::istream *, MatrixStream< Field > *) |
MatrixStreamError | nextTriple (size_t &, size_t &, Element &) |
MatrixStreamError | saveNext () |
MatrixStreamError | getRows (size_t &) |
MatrixStreamError | getColumns (size_t &) |
virtual int | getLineNumber () const |
virtual | ~MatrixStreamReader () |
Protected Member Functions | |
bool | readWhiteSpace (bool allowBreaks=false) |
bool | readSomeWhiteSpace (bool allowBreaks=false) |
bool | readWhiteSpace (int &breaks, bool allowBreaks=true) |
bool | readSomeWhiteSpace (int &breaks, bool allowBreaks=true) |
bool | readBreaks (int breaks=1) |
bool | readUntil (char c, std::stringstream *ss=NULL, int limit=-1) |
std::vector< char * >::const_iterator | readUntil (const std::vector< char * > &cm, std::stringstream *ss=NULL, int limit=-1) |
bool | readElement (Element &x) |
template<class Object> bool | readObject (Object &o) |
bool | moreData () |
void | saveTriple (size_t m, size_t n, const Element &v) |
virtual MatrixStreamError | nextTripleImpl (size_t &, size_t &, Element &)=0 |
virtual MatrixStreamError | initImpl ()=0 |
MatrixStreamReader () | |
Protected Attributes | |
std::istream * | sin |
MatrixStream< Field > * | ms |
int | lineNumber |
size_t | _m |
bool | knowM |
size_t | _n |
bool | knowN |
bool | atEnd |
|
A protected constructor that is called automatically when subclasses are instantiated. |
|
Virtual destructor. |
|
Read white space. Function returns true if and only if at least one character of white space is read. After a successful call, there will be at least one character available on the stream.
|
|
Read white space. Does not require that any white space characters be read. After a successful call, there will be at least one character available on the stream.
|
|
Read white space. Function returns true if and only if at least one character of white space is read. After a successful call, there will be at least one character available on the stream.
|
|
Read white space. Does not require that any white space characters be read. After a successful call, there will be at least one character available on the stream.
|
|
Read up to breaks breaks. Reading will stop on the first non-whitespace character or first newline after breaks newlines. After a successful call, there will be at least one character available on the stream.
|
|
Read up to a given character.
|
|
Read until an unmatched character.
|
|
Read a field element. Uses the read method of the field for the parent MatrixStream object.
|
|
Read any object. Uses the overloaded stream extraction operator >>, which must be defined for this type.
|
|
Try and get more data from the underlying input stream. Should be called when an EOF is reached on input.
|
|
Save the triple (m,n,v) onto the savedTriples std::queue. |
|
Read the next triple of row index, column index, value and store it in the given references.
|
|
Read the beginning (header) of the matrix from the stream and attempt to determine if it is of this reader's type.
|
|
Get a unique string describing this format. |
|
Determine if this format is sparse or dense.
|
|
Initialize this MatrixStreamReader. Calls the initImpl method of the subclass. |
|
Get the next triple of row index, column index, value and store it into the three referenced variables. Uses the nextTripleImpl method of the subclass. |
|
Reads the next triple from the subclass nextTripleImpl method and saves it to the savedTriples std::queue rather than returning it. The error returned is that given from the subclass method. |
|
Get the number of rows in this matrix, store it in the given int. |
|
Get the number of columns in this matrix, store it in the given int. |
|
Get the line number that this reader is currently on. |
|
The stream that provides the data to the reader. NOTE: subclasses should NOT use this stream directly except for one-byte reading as in sin->get(). This stream only contains a portion of the matrix data; this data must be replentished with calls to moreData(). If at all possible use sin->get() only and use the various read... methods below to read data. |
|
A pointer to the MatrixStream that is using this reader. Useful to get an instance of the field via ms->getField(). |
|
The lineNumber is recorded in case the user wants to know at which line an error occurs. This will be updated automatically by any of the read methods below if they encounter breaks; it is up to the subclasses to increment lineNumber if they read any newline characters independently. |
|
The number of rows in the matrix. This will be set by default to 0. |
|
Indicates whether the number above is accurate |
|
Number of columns in the matrix. Similar requirements as _m above. |
|
Indicates whether the number above is accurate |
|
Indicates that the end of the matrix has been reached; no more calls to nextTripleImpl will be made once this value is true. This will automatically be set to true if nextTripleImple returns END_OF_MATRIX. |