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

PLearn::AutoSDBVMatrix Class Reference

A VMatrix view of a SimpleDB: columns whose type is string are removed from the view, all others are converted to real (characters to their ascii code, and dates to the float date format: 990324). More...

#include <AutoSDBVMatrix.h>

Inheritance diagram for PLearn::AutoSDBVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AutoSDBVMatrix (const string &dbname)
int nstrings ()
 Returns the number of string fields (these will not be used in getRow!).

void getMappings ()
 gets mappings for each string field

virtual string getValString (int col, real val) const
 returns the string associated with value val for field# col.


Protected Member Functions

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


Protected Attributes

SDB sdb_
Row row_
hash_map< string, StringFieldMappingstring_field_map
hash_map< string, NumToStringMappingnum2string_map

Detailed Description

A VMatrix view of a SimpleDB: columns whose type is string are removed from the view, all others are converted to real (characters to their ascii code, and dates to the float date format: 990324).

Definition at line 155 of file AutoSDBVMatrix.h.


Constructor & Destructor Documentation

PLearn::AutoSDBVMatrix::AutoSDBVMatrix const string dbname  ) 
 

Definition at line 51 of file AutoSDBVMatrix.cc.

References PLearn::DateType, PLearn::extract_directory(), PLearn::extract_filename(), PLearn::force_mkdir(), getMappings(), PLearn::SimpleDB< KeyType, QueryResult >::getSchema(), PLearn::SimpleDB< KeyType, QueryResult >::length(), PLWARNING, row_, PLearn::SDB, sdb_, and PLearn::SimpleDB< KeyType, QueryResult >::width().


Member Function Documentation

void PLearn::AutoSDBVMatrix::getMappings  ) 
 

gets mappings for each string field

Definition at line 110 of file AutoSDBVMatrix.cc.

References PLearn::SimpleDB< KeyType, QueryResult >::getSchema(), PLearn::isfile(), PLearn::load(), MISSING_VALUE, num2string_map, sdb_, slash, string_field_map, and PLearn::StringType.

Referenced by AutoSDBVMatrix().

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

This is the only method requiring implementation in subclasses.

Implements PLearn::RowBufferedVMatrix.

Definition at line 85 of file AutoSDBVMatrix.cc.

References PLearn::RowIterator::asCharacter(), PLearn::RowIterator::asString(), PLearn::Row::begin(), PLearn::Row::const_iterator, PLearn::SimpleDB< KeyType, QueryResult >::getInRow(), PLearn::RowIterator::isCharacter(), PLearn::RowIterator::isMissing(), PLearn::RowIterator::isString(), PLearn::TVec< T >::length(), MISSING_VALUE, PLearn::RowIterator::name(), PLERROR, row_, sdb_, string_field_map, PLearn::RowIterator::toDouble(), PLearn::Vec, and PLearn::VMatrix::width().

virtual string PLearn::AutoSDBVMatrix::getValString int  col,
real  val
const [inline, virtual]
 

returns the string associated with value val for field# col.

Or returns "" if no string is associated.

Reimplemented from PLearn::VMatrix.

Definition at line 169 of file AutoSDBVMatrix.h.

References getValString(), num2string_map, and val.

Referenced by getValString().

int PLearn::AutoSDBVMatrix::nstrings  )  [inline]
 

Returns the number of string fields (these will not be used in getRow!).

Definition at line 162 of file AutoSDBVMatrix.h.

References sdb_, PLearn::VMatrix::width(), and PLearn::SimpleDB< KeyType, QueryResult >::width().


Member Data Documentation

hash_map<string, NumToStringMapping> PLearn::AutoSDBVMatrix::num2string_map [protected]
 

Definition at line 185 of file AutoSDBVMatrix.h.

Referenced by getMappings(), and getValString().

Row PLearn::AutoSDBVMatrix::row_ [mutable, protected]
 

Definition at line 183 of file AutoSDBVMatrix.h.

Referenced by AutoSDBVMatrix(), and getNewRow().

SDB PLearn::AutoSDBVMatrix::sdb_ [protected]
 

Definition at line 182 of file AutoSDBVMatrix.h.

Referenced by AutoSDBVMatrix(), getMappings(), getNewRow(), and nstrings().

hash_map<string, StringFieldMapping> PLearn::AutoSDBVMatrix::string_field_map [protected]
 

Definition at line 184 of file AutoSDBVMatrix.h.

Referenced by getMappings(), and getNewRow().


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