PLearn 0.1
|
#include <SimpleDB.h>
Public Types | |
typedef KeyType | ByteArr |
typedef ByteArr::iterator | iterator |
Public Member Functions | |
SimpleDBIndexKey () | |
default ctor | |
SimpleDBIndexKey (size_t len) | |
SimpleDBIndexKey (const unsigned char *the_raw, size_t len) | |
SimpleDBIndexKey (const ByteArr &the_raw) | |
operator char * () const | |
size_t | byteLength () const |
bool | operator== (const SimpleDBIndexKey &other) const |
relational operators | |
bool | operator!= (const SimpleDBIndexKey &other) const |
void | resize (size_t len) |
ByteArr::iterator | begin () |
ByteArr::iterator | end () |
Private Attributes | |
ByteArr | raw |
An IndexKey is used by hash tables for indexing purposes. It contains* a tiny vector of bytes (cannot be a pointer onto a row, since full row objects are fairly short-lived).
Definition at line 415 of file SimpleDB.h.
typedef KeyType PLearn::SimpleDBIndexKey< KeyType >::ByteArr |
These is a small semantic clash between what Hash requires and the way database rows are implemented. According to the C++ standard, the only type that is guaranteed to map to any preconceived notion of "amorphous byte" is the unsigned char (assuming 8-bit chars). Hence, all our internal data storage is performed this way. However, Hash works with plain chars, which causes a somewhat annoying compiler complaint of possible conversion error. This is why you see the static_cast in operator char*().
Definition at line 427 of file SimpleDB.h.
typedef ByteArr::iterator PLearn::SimpleDBIndexKey< KeyType >::iterator |
Definition at line 428 of file SimpleDB.h.
PLearn::SimpleDBIndexKey< KeyType >::SimpleDBIndexKey | ( | ) | [inline] |
default ctor
Definition at line 430 of file SimpleDB.h.
PLearn::SimpleDBIndexKey< KeyType >::SimpleDBIndexKey | ( | size_t | len | ) | [inline, explicit] |
Definition at line 432 of file SimpleDB.h.
: raw(len, '\0') {}
PLearn::SimpleDBIndexKey< KeyType >::SimpleDBIndexKey | ( | const unsigned char * | the_raw, |
size_t | len | ||
) | [inline] |
Definition at line 435 of file SimpleDB.h.
References std::copy().
PLearn::SimpleDBIndexKey< KeyType >::SimpleDBIndexKey | ( | const ByteArr & | the_raw | ) | [inline] |
Definition at line 441 of file SimpleDB.h.
: raw(the_raw) {}
ByteArr::iterator PLearn::SimpleDBIndexKey< KeyType >::begin | ( | ) | [inline] |
Definition at line 475 of file SimpleDB.h.
References PLearn::raw.
Referenced by PLearn::SimpleDB< KeyType, QueryResult >::findEqualLinear(), and PLearn::SimpleDB< KeyType, QueryResult >::indexColumn().
{ return raw.begin(); }
size_t PLearn::SimpleDBIndexKey< KeyType >::byteLength | ( | ) | const [inline] |
ByteArr::iterator PLearn::SimpleDBIndexKey< KeyType >::end | ( | ) | [inline] |
PLearn::SimpleDBIndexKey< KeyType >::operator char * | ( | ) | const [inline] |
default copy constructor default destructor default assignment operator
REquired interface. There is one small thing that our dear Hash Table class does not account for: operator char*() MUST BE CONST! or otherwise, the conversion operator is not called properly.
Definition at line 454 of file SimpleDB.h.
References PLearn::raw.
{ return (char*)(&raw[0]); }
bool PLearn::SimpleDBIndexKey< KeyType >::operator!= | ( | const SimpleDBIndexKey< KeyType > & | other | ) | const [inline] |
Definition at line 467 of file SimpleDB.h.
References PLearn::SimpleDBIndexKey< KeyType >::raw, and PLearn::raw.
{ return raw != other.raw; }
bool PLearn::SimpleDBIndexKey< KeyType >::operator== | ( | const SimpleDBIndexKey< KeyType > & | other | ) | const [inline] |
relational operators
Definition at line 463 of file SimpleDB.h.
References PLearn::SimpleDBIndexKey< KeyType >::raw, and PLearn::raw.
{ return raw == other.raw; }
void PLearn::SimpleDBIndexKey< KeyType >::resize | ( | size_t | len | ) | [inline] |
ByteArr PLearn::SimpleDBIndexKey< KeyType >::raw [private] |
Definition at line 484 of file SimpleDB.h.
Referenced by PLearn::SimpleDBIndexKey< KeyType >::operator!=(), and PLearn::SimpleDBIndexKey< KeyType >::operator==().