Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::AsciiVMatrix Class Reference

#include <AsciiVMatrix.h>

Inheritance diagram for PLearn::AsciiVMatrix:

Inheritance graph
[legend]
Collaboration diagram for PLearn::AsciiVMatrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AsciiVMatrix ()
 default constructor (for automatic deserialization)

 AsciiVMatrix (const string &fname, bool readwrite=true)
 AsciiVMatrix (const string &fname, int the_width, const TVec< string > &fieldnames=TVec< string >(), const string &the_comment="")
virtual void appendRow (Vec v)
 Append a row at the end of the file.

virtual void put (int i, int j, real value)
 These methods send an error message since, by choice, we accept only to append row at the end of the file.

virtual void putSubRow (int i, int j, Vec v)
virtual void putRow (int i, Vec v)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

virtual ~AsciiVMatrix ()
 PLEARN_DECLARE_OBJECT (AsciiVMatrix)
 Declares name and deepCopy methods.


Protected Member Functions

virtual void getNewRow (int i, const Vec &v) const
 This is the only method requiring implementation.


Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Protected Attributes

string filename
fstream * file
vector< streampos > pos_rows
streampos vmatlength_pos
bool readwritemode
bool newfile
bool rewrite_length
int length_max

Private Types

typedef RowBufferedVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

typedef RowBufferedVMatrix PLearn::AsciiVMatrix::inherited [private]
 

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 51 of file AsciiVMatrix.h.

Referenced by AsciiVMatrix().


Constructor & Destructor Documentation

PLearn::AsciiVMatrix::AsciiVMatrix  ) 
 

default constructor (for automatic deserialization)

Definition at line 48 of file AsciiVMatrix.cc.

PLearn::AsciiVMatrix::AsciiVMatrix const string fname,
bool  readwrite = true
 

Definition at line 53 of file AsciiVMatrix.cc.

References build(), and fname.

PLearn::AsciiVMatrix::AsciiVMatrix const string fname,
int  the_width,
const TVec< string > &  fieldnames = TVecstring >(),
const string the_comment = ""
 

Definition at line 60 of file AsciiVMatrix.cc.

References PLearn::endl(), file, filename, fname, inherited, PLearn::isfile(), k, PLearn::TVec< T >::length(), length_max, PLERROR, PLearn::space_to_underscore(), vmatlength_pos, and PLearn::VMatrix::width().

PLearn::AsciiVMatrix::~AsciiVMatrix  )  [virtual]
 

Definition at line 306 of file AsciiVMatrix.cc.

References file.


Member Function Documentation

void PLearn::AsciiVMatrix::appendRow Vec  v  )  [virtual]
 

Append a row at the end of the file.

Reimplemented from PLearn::VMatrix.

Definition at line 263 of file AsciiVMatrix.cc.

References PLearn::endl(), file, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), length_max, PLERROR, pos_rows, readwritemode, rewrite_length, vmatlength_pos, and PLearn::VMatrix::width().

void PLearn::AsciiVMatrix::build  )  [virtual]
 

Should call simply inherited::build(), then this class's build_().

This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::VMatrix.

Definition at line 107 of file AsciiVMatrix.cc.

References build_().

Referenced by AsciiVMatrix().

void PLearn::AsciiVMatrix::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 113 of file AsciiVMatrix.cc.

References PLearn::countNonBlankLinesOfFile(), file, filename, PLearn::getNextNonBlankLine(), PLearn::isfile(), length_max, PLearn::log(), newfile, PLERROR, PLWARNING, pos_rows, PLearn::pow(), PLearn::removeblanks(), PLearn::removenewline(), rewrite_length, PLearn::split(), PLearn::toint(), vmatlength_pos, and PLearn::ws().

Referenced by build().

void PLearn::AsciiVMatrix::declareOptions OptionList ol  )  [static, protected]
 

Declares this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 299 of file AsciiVMatrix.cc.

References PLearn::declareOption(), and PLearn::OptionList.

void PLearn::AsciiVMatrix::getNewRow int  i,
const Vec v
const [protected, virtual]
 

This is the only method requiring implementation.

Implements PLearn::RowBufferedVMatrix.

Definition at line 249 of file AsciiVMatrix.cc.

References file, PLearn::TVec< T >::length(), PLearn::VMatrix::length(), PLERROR, pos_rows, PLearn::Vec, and PLearn::VMatrix::width().

PLearn::AsciiVMatrix::PLEARN_DECLARE_OBJECT AsciiVMatrix   ) 
 

Declares name and deepCopy methods.

void PLearn::AsciiVMatrix::put int  i,
int  j,
real  value
[virtual]
 

These methods send an error message since, by choice, we accept only to append row at the end of the file.

Reimplemented from PLearn::VMatrix.

Definition at line 292 of file AsciiVMatrix.cc.

References PLERROR.

void PLearn::AsciiVMatrix::putRow int  i,
Vec  v
[virtual]
 

Reimplemented from PLearn::VMatrix.

Definition at line 296 of file AsciiVMatrix.cc.

References PLERROR.

void PLearn::AsciiVMatrix::putSubRow int  i,
int  j,
Vec  v
[virtual]
 

It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead)

Reimplemented from PLearn::VMatrix.

Definition at line 294 of file AsciiVMatrix.cc.

References PLERROR.


Member Data Documentation

fstream* PLearn::AsciiVMatrix::file [mutable, protected]
 

Definition at line 55 of file AsciiVMatrix.h.

Referenced by appendRow(), AsciiVMatrix(), build_(), getNewRow(), and ~AsciiVMatrix().

string PLearn::AsciiVMatrix::filename [protected]
 

Definition at line 54 of file AsciiVMatrix.h.

Referenced by AsciiVMatrix(), and build_().

int PLearn::AsciiVMatrix::length_max [protected]
 

Definition at line 61 of file AsciiVMatrix.h.

Referenced by appendRow(), AsciiVMatrix(), and build_().

bool PLearn::AsciiVMatrix::newfile [protected]
 

Definition at line 59 of file AsciiVMatrix.h.

Referenced by build_().

vector<streampos> PLearn::AsciiVMatrix::pos_rows [protected]
 

Definition at line 56 of file AsciiVMatrix.h.

Referenced by appendRow(), build_(), and getNewRow().

bool PLearn::AsciiVMatrix::readwritemode [protected]
 

Definition at line 58 of file AsciiVMatrix.h.

Referenced by appendRow().

bool PLearn::AsciiVMatrix::rewrite_length [protected]
 

Definition at line 60 of file AsciiVMatrix.h.

Referenced by appendRow(), and build_().

streampos PLearn::AsciiVMatrix::vmatlength_pos [protected]
 

Definition at line 57 of file AsciiVMatrix.h.

Referenced by appendRow(), AsciiVMatrix(), and build_().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:25:59 2004 for PLearn by doxygen 1.3.7