Tanl Linguistic Pipeline

IXE::Field Class Reference
[Reflection]

Abstract class for representing fields in tables. More...

#include <metaclass.h>

Inheritance diagram for IXE::Field:
IXE::ArrayField< ArrayType > IXE::ArrayField< ArrayOf< T > > IXE::ArrayField< std::vector< char const * > > IXE::ArrayField< std::vector< std::string > > IXE::ArrayField< std::vector< T > > IXE::CompositeField IXE::FixedField< T > IXE::ReferenceField< T > IXE::VarField< T >

List of all members.

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 Fieldclone () 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 Itemitem ()=0
 Create an Item to store a value for the Field.
virtual MetaClassitemClass () 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*.
Fieldoperator, (Field &field)

Public Attributes

Fieldnext
 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

Detailed Description

Abstract class for representing fields in tables.

By defining suitable specializations, other types of fields can be stored into records.


Constructor & Destructor Documentation

IXE::Field::Field ( char const *  name,
Size  offset,
IndexType  indexType,
char const *  merge = 0 
) [inline]
Parameters:
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.


Member Function Documentation

virtual byte* IXE::Field::fetch ( byte *  dst,
byte *&  src 
) [pure virtual]

Method to fetch fields from a buffer.

Parameters:
dst the location of the field.
src the buffer from which the field is fetched; it is advanced to the next field
Returns:
the position at the end of the 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.

Parameters:
dst the location of the field.
src the buffer from which the field is fetched.
Returns:
the location of the field.

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]
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

Parameters:
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]
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.

Parameters:
dst the buffer where to store the field; it is advanced to the next field.
src the field in the object being stored.
Returns:
the position at the end of the 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 >.

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.

Parameters:
dst the buffer where to store the field.
src the field in the object being stored.
Returns:
the size of the field.

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().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
 
Copyright © 2005-2011 G. Attardi. Generated on 4 Mar 2011 by doxygen 1.6.1.