Tanl Linguistic Pipeline |
Abstract class for representing fields in tables. More...
#include <metaclass.h>
Public Types | |
enum | Type { Int, Float, String, Pointer, Composite, Date, Array } |
enum | IndexType { none = 0, primary, autoincrement, mapped, fulltext = 4, fulltextMerged = 5, facet = 6, indexed = 8, unique = 9, uniqueHash = 10 } |
Public Member Functions | |
Field (char const *name, Size offset, IndexType indexType, char const *merge=0) | |
virtual Field * | clone () const =0 |
virtual void | clear (void **fieldPtr) |
for avoiding destructors | |
virtual Size | size ()=0 |
Size in bytes of field. | |
virtual Size | length (byte *base) |
Number of items, if field contains pointer (or else its size). | |
Size & | maxLength () |
virtual Size | packSize (byte *base)=0 |
Compute size of record needed for storing the field. | |
virtual std::ostream & | print (std::ostream &out)=0 |
Display the Field information. | |
virtual bool | isType (Type t) |
Check Field type. | |
virtual bool | isReference () |
Whether the type is a reference type. | |
virtual bool | isPointer () |
Whether the type is a pointer type (subsumes isReference()). | |
virtual Item * | item ()=0 |
Create an Item to store a value for the Field. | |
virtual MetaClass * | itemClass () const |
The metaclass of items. | |
virtual Size | itemSize () |
virtual byte * | fetch (byte *dst, byte *&src)=0 |
Method to fetch fields from a buffer. | |
virtual byte * | fetchKey (byte *dst, byte *src)=0 |
Same as fetch() from key data, without header information, which gets converted from BigEndian order to host order. | |
virtual byte * | store (byte *&dst, byte *src)=0 |
Method to store fields into a buffer. | |
virtual Size | storeKey (byte *dst, byte *src)=0 |
Same as store() but without field header information, and BigEndian order to ensure comparison by bt_compare works. | |
virtual void | setKey (byte *row, int8 const value) |
Needed for storing a fixed size value, specific field method will cast to appropriate type. | |
virtual void | setKey (byte *row, byte const *value, Size &len, Size maxLen) |
Needed for (interactive) query processing: value to be stored is char*. | |
Field & | operator, (Field &field) |
Public Attributes | |
Field * | next |
next field | |
char const * | name |
field name | |
std::type_info const * | type |
for display and checking queries | |
IndexType | indexType |
type of indexing for the field | |
Size | offset |
in class structure | |
Count | position |
(in fulltext or indexed columns or in mappedFields) | |
char const * | merge |
column to be merged with | |
Text::Normalizer * | normalizer |
applied to tokens. | |
Size | maxLength_ |
Maximum number of items for variable length fields, 1 for fixed size fields. | |
Static Public Attributes | |
static MetaClass | _metaClass |
Abstract class for representing fields in tables.
By defining suitable specializations, other types of fields can be stored into records.
IXE::Field::Field | ( | char const * | name, | |
Size | offset, | |||
IndexType | indexType, | |||
char const * | merge = 0 | |||
) | [inline] |
name,name | of the field. | |
offset,byte | offset from start of object. | |
indexType,type | of indexing for the field. | |
merge,the | name of another field with which the content of this field should be added. |
References merge, and normalizer.
virtual byte* IXE::Field::fetch | ( | byte * | dst, | |
byte *& | src | |||
) | [pure virtual] |
Method to fetch fields from a buffer.
dst | the location of the field. | |
src | the buffer from which the field is fetched; it is advanced to the next field |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, IXE::ArrayField< std::vector< std::string > >, IXE::ArrayField< std::vector< char const * > >, IXE::FixedField< T >, and IXE::FixedField< T >.
Referenced by IXE::DynamicTable::Cursor::get(), and IXE::Table< T, IndexerClass >::Cursor::get().
virtual byte* IXE::Field::fetchKey | ( | byte * | dst, | |
byte * | src | |||
) | [pure virtual] |
Same as fetch() from key data, without header information, which gets converted from BigEndian order to host order.
dst | the location of the field. | |
src | the buffer from which the field is fetched. |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, and IXE::ArrayField< std::vector< char const * > >.
Referenced by IXE::Table< T, IndexerClass >::Cursor::getKey(), and IXE::Table< T, IndexerClass >::Cursor::getPrimaryKey().
virtual Size IXE::Field::itemSize | ( | ) | [inline, virtual] |
Reimplemented in IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, and IXE::ArrayField< std::vector< char const * > >.
Referenced by IXE::Table< ItemType, IndexerClass >::mappedField().
virtual Size IXE::Field::packSize | ( | byte * | base | ) | [pure virtual] |
Compute size of record needed for storing the field.
This includes header information (eg. length) and padding for alignment
base | the location of the object to be stored. If base == 0, return the maximum size. |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, IXE::ArrayField< std::vector< std::string > >, IXE::ArrayField< std::vector< char const * > >, IXE::FixedField< T >, and IXE::FixedField< T >.
virtual std::ostream& IXE::Field::print | ( | std::ostream & | out | ) | [pure virtual] |
Display the Field information.
out | the output stream |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, and IXE::ArrayField< std::vector< char const * > >.
virtual void IXE::Field::setKey | ( | byte * | row, | |
byte const * | value, | |||
Size & | len, | |||
Size | maxLen | |||
) | [inline, virtual] |
Needed for (interactive) query processing: value to be stored is char*.
Used for VarField and Array field. Does not advance row.
Reimplemented in IXE::VarField< T >, IXE::ArrayField< ArrayOf< T > >, and IXE::ArrayField< std::vector< T > >.
virtual void IXE::Field::setKey | ( | byte * | row, | |
int8 const | value | |||
) | [inline, virtual] |
Needed for storing a fixed size value, specific field method will cast to appropriate type.
Used only for FixedField. Does not advance row.
Reimplemented in IXE::FixedField< T >.
Referenced by IXE::Table< T, IndexerClass >::Cursor::get(), and IXE::Table< T, IndexerClass >::Cursor::setKey().
virtual byte* IXE::Field::store | ( | byte *& | dst, | |
byte * | src | |||
) | [pure virtual] |
Method to store fields into a buffer.
Advances dst to next field.
dst | the buffer where to store the field; it is advanced to the next field. | |
src | the field in the object being stored. |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, IXE::ArrayField< std::vector< std::string > >, IXE::ArrayField< std::vector< char const * > >, IXE::FixedField< T >, and IXE::FixedField< T >.
virtual Size IXE::Field::storeKey | ( | byte * | dst, | |
byte * | src | |||
) | [pure virtual] |
Same as store() but without field header information, and BigEndian order to ensure comparison by bt_compare works.
dst | the buffer where to store the field. | |
src | the field in the object being stored. |
Implemented in IXE::CompositeField, IXE::FixedField< T >, IXE::VarField< T >, IXE::ReferenceField< T >, IXE::ArrayField< ArrayOf< T > >, IXE::ArrayField< std::vector< T > >, and IXE::ArrayField< std::vector< char const * > >.
Referenced by IXE::DynamicTable::insert(), IXE::Table< ItemType, IndexerClass >::merge(), and IXE::Table< T, IndexerClass >::Cursor::update().