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

TrDb::Index Struct Reference

this defines a secondary index. More...

#include <trdb.h>

List of all members.

Public Attributes

bt_compare_func_t bt_compare_func
associate_func_t associate_func
QString name
Db * db

Detailed Description

this defines a secondary index.


Right now only in FeatureData and in ReadData is indexing done. Right now the serializing there is done with structs. But if we want to index in both in a class and also in its child classes we should probably use an associate() function where we don't unserialize with a struct but instead use the GeneralData::readStream(). For pulling out an integer value from a GeneralData we do something like (note the DB_DBT_APPMALLOC flag):

int SubClassOfGeneralData::associateFunc( Db * dbp , const Dbt * , const Dbt *pdata, Dbt *skey)


memset(skey, 0, sizeof(Dbt));

SubClassOfGeneralData d;

Database::setFromDbt( pdata, &d )

int answer = d.getInterestingValue();

int * allocatedInt = malloc(sizeof( int ));

allocatedInt = answer;

skey->set_data( ( u_int8_t * ) allocatedInt;

skey->set_size(sizeof( int ));

skey->set_flags( DB_DBT_APPMALLOC );

return 0; }

Definition at line 77 of file trdb.h.

Member Data Documentation

associate_func_t TrDb::Index::associate_func

Definition at line 80 of file trdb.h.

Referenced by Database::SecondaryIterator< T >::fillSecondaryDataDbt().

bt_compare_func_t TrDb::Index::bt_compare_func

Definition at line 79 of file trdb.h.

Db* TrDb::Index::db

lookup string

Definition at line 82 of file trdb.h.

Referenced by Database::SecondaryIterator< T >::delCurrentInclDups(), Database::SecondaryIterator< T >::fillSecondaryDataDbt(), Database::SecondaryIterator< T >::pget(), and Database::SecondaryIterator< T >::SecondaryIterator().

QString TrDb::Index::name

Definition at line 81 of file trdb.h.

Referenced by ReadData::getIndexMap(), FeatureData::getIndexMap(), and hookBeforeCreate().

The documentation for this struct was generated from the following file:
Generated on Fri Mar 17 17:45:02 2006 for trapper by  doxygen 1.4.4