PLearn 0.1
|
#include <SimpleDB.h>
Public Member Functions | |
FieldPtr () | |
The default ctor makes a "null" field ptr. | |
int | field_index () const |
Using default copy ctor, dtor, and operator=. | |
ptrdiff_t | offset () const |
operator bool () const | |
Conversion to bool: true if pointer is non-null. | |
bool | operator! () const |
Negation: true if pointer is null. | |
bool | operator== (const FieldPtr &x) const |
Comparison operators. | |
bool | operator!= (const FieldPtr &x) const |
Private Member Functions | |
FieldPtr (int fi, ptrdiff_t o) | |
For use by Schema and Row::iterator. | |
Private Attributes | |
int | field_index_ |
field number in schema | |
ptrdiff_t | offset_ |
actual byte offset_into row | |
Friends | |
class | Row |
for binding | |
class | Schema |
for construction |
A FieldPtr is like a pointer-to-member in C++: it represents the abstract location of a single field within a Row. The operation of binding a FieldPtr with a Row, yielding a Row::iterator is very fast.
It is an error to bind a pointer created w.r.t. given schema to a row using an incompatible schema, although this is not checked for it would be prohibitively expensive (it's more complex than just checking a schema pointer).
Definition at line 175 of file SimpleDB.h.
PLearn::FieldPtr::FieldPtr | ( | ) | [inline] |
The default ctor makes a "null" field ptr.
Definition at line 181 of file SimpleDB.h.
: field_index_(-1), offset_(-1) {}
PLearn::FieldPtr::FieldPtr | ( | int | fi, |
ptrdiff_t | o | ||
) | [inline, private] |
For use by Schema and Row::iterator.
Definition at line 216 of file SimpleDB.h.
: field_index_(fi), offset_(o) {}
int PLearn::FieldPtr::field_index | ( | ) | const [inline] |
Using default copy ctor, dtor, and operator=.
Useful accessors
Definition at line 186 of file SimpleDB.h.
{ return field_index_; }
ptrdiff_t PLearn::FieldPtr::offset | ( | ) | const [inline] |
Definition at line 190 of file SimpleDB.h.
{ return offset_; }
PLearn::FieldPtr::operator bool | ( | ) | const [inline] |
Conversion to bool: true if pointer is non-null.
Definition at line 195 of file SimpleDB.h.
{ return field_index_ >= 0; }
bool PLearn::FieldPtr::operator! | ( | ) | const [inline] |
Negation: true if pointer is null.
Definition at line 200 of file SimpleDB.h.
{ return field_index_ == -1; }
Comparison operators.
Definition at line 205 of file SimpleDB.h.
References field_index_, and offset_.
{ return field_index_ == x.field_index_ && offset_ == x.offset_; }
friend class Row [friend] |
for binding
Definition at line 176 of file SimpleDB.h.
friend class Schema [friend] |
for construction
Definition at line 177 of file SimpleDB.h.
int PLearn::FieldPtr::field_index_ [private] |
field number in schema
Definition at line 219 of file SimpleDB.h.
Referenced by PLearn::Row::bind(), and operator==().
ptrdiff_t PLearn::FieldPtr::offset_ [private] |
actual byte offset_into row
Definition at line 220 of file SimpleDB.h.
Referenced by PLearn::Row::bind(), and operator==().