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

substringdata.h File Reference

Go to the source code of this file.

Functions

**Idea for the future to maybe
like *virtual void 
hookBeforeCreate (Txnid *) and *virtual void hookBeforeRemove(Txnid *).*Database

Variables

**Idea for the future to maybe implement


Function Documentation

* * Idea for the future to maybe like* virtual void hookBeforeCreate Txnid *   )  [virtual]
 

Definition at line 5 of file substringdata.h.

References GeneralData::getIndexMap(), and TrDb::Index::name.

00011                                            : public GeneralData that stores e.g. sequences 
00012   * of length 12. 
00013   * The DnaStrData::hookBeforeCreate(Txnid *) creates each possible 12-length-substring as records
00014   * in the SubStrData.
00015   * The SubStrData::getIndex() should return two secondary indices: one with sorting of the DnaStrData recno,
00016   * and one with sorting in lexicographical order of the 12-length-substring
00017 
00018 
00019 class SubStrData : public GeneralData
00020 {
00021  public:
00022   virtual TrDb::IndexMap GeneralData::getIndexMap()
00023     { 
00024     TrDb::IndexMap iMap;
00025     TrDb::Index i = {
00026       &SubStrData::bt_compare_dnaStrRecNo,
00027       &SubStrData::getDnaStrRecNo,
00028       QString("dnaStrRecno"),
00029                         NULL
00030     };
00031     iMap.insert( make_pair( i.name, i ) );
00032     i = {
00033       &SubStrData::bt_compare_subStr,
00034       &SubStrData::getSubStr,
00035       QString("substring"),
00036                       NULL
00037     };
00038     iMap.insert( make_pair( i.name, i ) );
00039     return iMap;
00040   }
00041 
00042   int getDnaStrRecNo( Db * /* dbp */ , const Dbt *  /* pkey */, const Dbt *pdata, Dbt *skey)
00043     {
00044       memset(skey, 0, sizeof(Dbt));
00045       StorageData * data = ( StorageData * ) pdata->get_data();
00046       skey->set_data( ( u_int8_t * ) (& (data->dnastrdataRecno)) );
00047       skey->set_size(sizeof( db_recno_t ));
00048       return(0);
00049     }
00050     struct StorageData
00051     {
00052       char[12] substring;
00053       db_recno_t dnastrdataRecno;
00054     };
00055 
00056 
00057     int bt_compare_dnaStrRecNo( DB * , const DBT *dbt1, const DBT *dbt2)
00058       {
00059         /* order after row and then after end position */
00060         db_recno_t * recno1  = ( db_recno_t *) dbt1->data;
00061         db_recno_t * recno2  = ( db_recno_t *) dbt2->data;
00062         if ( *recno1 > *recno2 )
00063           return 1;
00064         if ( *recno1 < *recno2 )
00065           return -1;
00066         if ( *recno1 == *recno2 )
00067           return 0;
00068         /* should never reach this point */
00069         return 0;
00070       }
00071 
00072   db_recno_t dnastrdataRecno;
00073  protected:
00074     std::string substr;
00075 };


Variable Documentation

* * Idea for the future to maybe implement
 

Definition at line 4 of file substringdata.h.


Generated on Fri Mar 17 17:44:47 2006 for trapper by  doxygen 1.4.4