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

PLearn::RowIterator Class Reference

#include <SimpleDB.h>

Collaboration diagram for PLearn::RowIterator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RowIterator ()
 -- Requirements from trivial iterator

 RowIterator (const RowIterator &x)
bool operator== (const RowIterator &x)
bool operator!= (const RowIterator &x)
 RowIterator (int curf, unsigned char *curp, const Schema *sc)
 Non-trivial ctor.

RowIteratoroperator= (const RowIterator &x)
 Default destructor is being used Assignment.

void copyFrom (const RowIterator &it)
 Copying of value.

FieldRowRef operator * () const
 Dereference.

RowIteratoroperator++ ()
 -- Requirements from input iterator

RowIterator operator++ (int)
 Post-increment is expressed as a pre-increment.

RowIterator operator[] (int i)
 Permit limited random access from an iterator (positive directions only!).

FieldType getFieldType () const
bool isString () const
 -- Predicates to test whether current element is of a certain type.

bool isCharacter () const
bool isSignedChar () const
bool isShort () const
bool isInt () const
bool isFloat () const
bool isDouble () const
bool isDate () const
char * asString ()
unsigned char * asCharacter ()
signed char * asSignedChar ()
short * asShort ()
intasInt ()
float * asFloat ()
double * asDouble ()
PDateasDate ()
const char * asString () const
const unsigned char * asCharacter () const
const signed char * asSignedChar () const
const short * asShort () const
const intasInt () const
const float * asFloat () const
const double * asDouble () const
const PDateasDate () const
double toDouble () const
 -- GENERIC CONVERSIONS.

string toString () const
bool isMissing () const
 -- The following functions deal with missing values

void setMissing ()
string name () const
 Return the name of the current field, or "" if not currently pointing to any valid field.

int precision () const
 Return the precision of the current field (number of bytes), or -1 if not currently pointing to any valid field.

int char_width () const
 Return the size in characters required to print out the current field.

unsigned char * raw ()
 Return the physical address of the iterator.

const unsigned char * raw () const
FieldPtr makePtr () const

Private Attributes

unsigned curfield
 current field number in schema

unsigned char * curptr
 current ptr in rawrow

const Schemaschema

Constructor & Destructor Documentation

PLearn::RowIterator::RowIterator  )  [inline]
 

-- Requirements from trivial iterator

Definition at line 745 of file SimpleDB.h.

PLearn::RowIterator::RowIterator const RowIterator x  )  [inline]
 

Definition at line 746 of file SimpleDB.h.

References x.

PLearn::RowIterator::RowIterator int  curf,
unsigned char *  curp,
const Schema sc
[inline]
 

Non-trivial ctor.

Definition at line 762 of file SimpleDB.h.


Member Function Documentation

const unsigned char* PLearn::RowIterator::asCharacter  )  const [inline]
 

Definition at line 927 of file SimpleDB.h.

unsigned char* PLearn::RowIterator::asCharacter  )  [inline]
 

Definition at line 886 of file SimpleDB.h.

Referenced by PLearn::AutoSDBVMatrix::getNewRow(), isMissing(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const PDate* PLearn::RowIterator::asDate  )  const [inline]
 

Definition at line 953 of file SimpleDB.h.

PDate* PLearn::RowIterator::asDate  )  [inline]
 

Definition at line 912 of file SimpleDB.h.

Referenced by isMissing(), PLearn::SimpleDB< KeyType, QueryResult >::memoryToDisk(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const double* PLearn::RowIterator::asDouble  )  const [inline]
 

Definition at line 949 of file SimpleDB.h.

double* PLearn::RowIterator::asDouble  )  [inline]
 

Definition at line 908 of file SimpleDB.h.

Referenced by isMissing(), PLearn::SimpleDB< KeyType, QueryResult >::memoryToDisk(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const float* PLearn::RowIterator::asFloat  )  const [inline]
 

Definition at line 945 of file SimpleDB.h.

float* PLearn::RowIterator::asFloat  )  [inline]
 

Definition at line 904 of file SimpleDB.h.

Referenced by isMissing(), PLearn::SimpleDB< KeyType, QueryResult >::memoryToDisk(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const int* PLearn::RowIterator::asInt  )  const [inline]
 

Definition at line 941 of file SimpleDB.h.

int* PLearn::RowIterator::asInt  )  [inline]
 

Definition at line 900 of file SimpleDB.h.

Referenced by isMissing(), PLearn::SimpleDB< KeyType, QueryResult >::memoryToDisk(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const short* PLearn::RowIterator::asShort  )  const [inline]
 

Definition at line 937 of file SimpleDB.h.

short* PLearn::RowIterator::asShort  )  [inline]
 

Definition at line 896 of file SimpleDB.h.

Referenced by isMissing(), PLearn::SimpleDB< KeyType, QueryResult >::memoryToDisk(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const signed char* PLearn::RowIterator::asSignedChar  )  const [inline]
 

Definition at line 932 of file SimpleDB.h.

signed char* PLearn::RowIterator::asSignedChar  )  [inline]
 

Definition at line 891 of file SimpleDB.h.

Referenced by isMissing(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), setMissing(), toDouble(), and toString().

const char* PLearn::RowIterator::asString  )  const [inline]
 

-- CONST VERSIONS. Return a pointer to the CURRENT element, as the correct type. Return 0 element if the wrong type is specified. The current element may be modified through this pointer.

Definition at line 923 of file SimpleDB.h.

char* PLearn::RowIterator::asString  )  [inline]
 

-- Return a pointer to the CURRENT element, as the correct type. Return 0 element if the wrong type is specified. The current element may be modified through this pointer.

Definition at line 877 of file SimpleDB.h.

Referenced by PLearn::AutoSDBVMatrix::getNewRow(), isMissing(), PLearn::FieldRowRef::operator FieldValue(), PLearn::operator<<(), PLearn::FieldRowRef::operator=(), PLearn::Row::sanitize(), setMissing(), toDouble(), and toString().

int PLearn::RowIterator::char_width  )  const
 

Return the size in characters required to print out the current field.

Definition at line 602 of file SimpleDB.cc.

References c_str(), curfield, isCharacter(), isDate(), isDouble(), isFloat(), isInt(), isShort(), isSignedChar(), isString(), name(), PLERROR, and precision().

Referenced by PLearn::operator<<(), and PLearn::printFieldName().

void PLearn::RowIterator::copyFrom const RowIterator it  )  [inline]
 

Copying of value.

Definition at line 781 of file SimpleDB.h.

References std::copy(), getFieldType(), PLERROR, precision(), PLearn::raw, and raw().

FieldType PLearn::RowIterator::getFieldType  )  const [inline]
 

Definition at line 825 of file SimpleDB.h.

References PLearn::FieldType.

Referenced by PLearn::SDBWithStats::computeStats(), and copyFrom().

bool PLearn::RowIterator::isCharacter  )  const [inline]
 

Definition at line 836 of file SimpleDB.h.

References PLearn::CharacterType.

Referenced by char_width(), and PLearn::AutoSDBVMatrix::getNewRow().

bool PLearn::RowIterator::isDate  )  const [inline]
 

Definition at line 866 of file SimpleDB.h.

References PLearn::DateType.

Referenced by char_width().

bool PLearn::RowIterator::isDouble  )  const [inline]
 

Definition at line 861 of file SimpleDB.h.

References PLearn::DoubleType.

Referenced by char_width().

bool PLearn::RowIterator::isFloat  )  const [inline]
 

Definition at line 856 of file SimpleDB.h.

References PLearn::FloatType.

Referenced by char_width().

bool PLearn::RowIterator::isInt  )  const [inline]
 

Definition at line 851 of file SimpleDB.h.

References PLearn::IntType.

Referenced by char_width().

bool PLearn::RowIterator::isMissing  )  const
 

-- The following functions deal with missing values

Definition at line 560 of file SimpleDB.cc.

References asCharacter(), asDate(), asDouble(), asFloat(), asInt(), asShort(), asSignedChar(), asString(), PLearn::MissingCharacter, PLearn::MissingDate, PLearn::MissingInt, PLearn::MissingShort, PLearn::MissingSignedChar, PLearn::MissingString, and x.

Referenced by PLearn::SDBWithStats::computeStats(), PLearn::AutoSDBVMatrix::getNewRow(), PLearn::operator<<(), toDouble(), and toString().

bool PLearn::RowIterator::isShort  )  const [inline]
 

Definition at line 846 of file SimpleDB.h.

References PLearn::ShortType.

Referenced by char_width().

bool PLearn::RowIterator::isSignedChar  )  const [inline]
 

Definition at line 841 of file SimpleDB.h.

References PLearn::SignedCharType.

Referenced by char_width().

bool PLearn::RowIterator::isString  )  const [inline]
 

-- Predicates to test whether current element is of a certain type.

Always false for null or past-end iterators.

Definition at line 831 of file SimpleDB.h.

References PLearn::StringType.

Referenced by char_width(), and PLearn::AutoSDBVMatrix::getNewRow().

FieldPtr PLearn::RowIterator::makePtr  )  const [inline]
 

Make a FieldPtr from the current iterator position (this operation is not extremely fast, since we must loop from the beginning of the row)

Definition at line 1000 of file SimpleDB.h.

References PLearn::Schema::findColumn().

string PLearn::RowIterator::name  )  const [inline]
 

Return the name of the current field, or "" if not currently pointing to any valid field.

Definition at line 971 of file SimpleDB.h.

Referenced by char_width(), PLearn::AutoSDBVMatrix::getNewRow(), and PLearn::printFieldName().

FieldRowRef PLearn::RowIterator::operator *  )  const [inline]
 

Dereference.

Definition at line 1192 of file SimpleDB.h.

bool PLearn::RowIterator::operator!= const RowIterator x  )  [inline]
 

Definition at line 757 of file SimpleDB.h.

References x.

RowIterator PLearn::RowIterator::operator++ int   )  [inline]
 

Post-increment is expressed as a pre-increment.

Definition at line 809 of file SimpleDB.h.

References x.

RowIterator& PLearn::RowIterator::operator++  )  [inline]
 

-- Requirements from input iterator

Preincrement : the distance of the increment depends on the current field size. And end() iterator has a current field number that is 1 beyond the maximum number of field. A null iterator has everything equal to zero.

Definition at line 800 of file SimpleDB.h.

RowIterator& PLearn::RowIterator::operator= const RowIterator x  )  [inline]
 

Default destructor is being used Assignment.

Definition at line 769 of file SimpleDB.h.

References x.

bool PLearn::RowIterator::operator== const RowIterator x  )  [inline]
 

Definition at line 751 of file SimpleDB.h.

References x.

RowIterator PLearn::RowIterator::operator[] int  i  )  [inline]
 

Permit limited random access from an iterator (positive directions only!).

Definition at line 817 of file SimpleDB.h.

int PLearn::RowIterator::precision  )  const [inline]
 

Return the precision of the current field (number of bytes), or -1 if not currently pointing to any valid field.

Definition at line 978 of file SimpleDB.h.

Referenced by char_width(), copyFrom(), PLearn::FieldRowRef::operator=(), and PLearn::Row::sanitize().

const unsigned char* PLearn::RowIterator::raw  )  const [inline]
 

Definition at line 992 of file SimpleDB.h.

unsigned char* PLearn::RowIterator::raw  )  [inline]
 

Return the physical address of the iterator.

Definition at line 988 of file SimpleDB.h.

Referenced by copyFrom().

void PLearn::RowIterator::setMissing  ) 
 

Definition at line 582 of file SimpleDB.cc.

References asCharacter(), asDate(), asDouble(), asFloat(), asInt(), asShort(), asSignedChar(), asString(), PLearn::MissingCharacter, PLearn::MissingDate, PLearn::MissingDouble, PLearn::MissingFloat, PLearn::MissingInt, PLearn::MissingShort, PLearn::MissingSignedChar, PLearn::MissingString, and x.

double PLearn::RowIterator::toDouble  )  const
 

-- GENERIC CONVERSIONS.

To string and to double, from nearly any type of field

Definition at line 627 of file SimpleDB.cc.

References asCharacter(), asDate(), asDouble(), asFloat(), asInt(), asShort(), asSignedChar(), asString(), PLearn::date_to_float(), isMissing(), MISSING_VALUE, PLERROR, and x.

Referenced by PLearn::AutoSDBVMatrix::getNewRow(), and PLearn::todouble().

string PLearn::RowIterator::toString  )  const
 

Definition at line 650 of file SimpleDB.cc.

References asCharacter(), asDate(), asDouble(), asFloat(), asInt(), asShort(), asSignedChar(), asString(), isMissing(), PLearn::space_to_underscore(), PLearn::tostring(), and x.

Referenced by PLearn::tostring().


Member Data Documentation

unsigned PLearn::RowIterator::curfield [private]
 

current field number in schema

Definition at line 1005 of file SimpleDB.h.

Referenced by char_width().

unsigned char* PLearn::RowIterator::curptr [private]
 

current ptr in rawrow

Definition at line 1006 of file SimpleDB.h.

const Schema* PLearn::RowIterator::schema [private]
 

Definition at line 1007 of file SimpleDB.h.


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