#include <featuredata.h>
Inheritance diagram for FeatureData:
Public Member Functions | |
FeatureData (db_recno_t readRec=0) | |
virtual | ~FeatureData () |
virtual TrDb::IndexMap | getIndexMap () |
void | setReadRecno (db_recno_t readRec) |
FeatureGui * | gui () |
FeatureInfo * | info () |
virtual void | readStream (QDataStream &str) |
virtual void | writeStream (QDataStream &str) |
virtual void | readAttributes (const QXmlAttributes &attr) |
virtual void | writeXml (ostream &stream) |
virtual void | print_debug_info () |
db_recno_t | readRecno () |
FeatureData (db_recno_t readRecno=0, TR_DNA startPos=0, TR_DNA endPos=0) | |
virtual | ~FeatureData () |
TrDb::IndexMap | getIndexMap () |
TR_DNA | startPos () |
TR_DNA | endPos () |
void | setStartPos (TR_DNA startPos) |
void | setEndPos (TR_DNA endPos) |
void | setReadRecno (db_recno_t readRecno) |
FeatureGui * | gui () |
FeatureInfo * | info () |
virtual void | readStream (QDataStream &str) |
virtual void | writeStream (QDataStream &str) |
virtual void | readAttributes (const QXmlAttributes &attr) |
virtual void | writeXml (ostream &stream) |
virtual void | print_debug_info () |
Static Public Member Functions | |
static int | getSeqRecNo (Db *, const Dbt *, const Dbt *pdata, Dbt *skey) |
static int | bt_compare_seqRecNo (DB *db, const DBT *dbt1, const DBT *dbt2) |
static int | getSeqRecNo (Db *, const Dbt *, const Dbt *pdata, Dbt *skey) |
static int | bt_compare_seqRecNo (DB *db, const DBT *dbt1, const DBT *dbt2) |
Protected Member Functions | |
virtual FeatureGui * | makeGui ()=0 |
virtual FeatureInfo * | makeInfo ()=0 |
virtual FeatureGui * | makeGui ()=0 |
virtual FeatureInfo * | makeInfo () |
Protected Attributes | |
db_recno_t | readRecno_ |
to keep the order of the data members when serializing/unserializing | |
FeatureGui * | m_gui |
FeatureInfo * | m_info |
StorageData | s |
FeatureGui * | m_gui |
FeatureInfo * | m_info |
Classes | |
struct | StorageData |
to keep the order of the data members when serializing/unserializing More... |
The geometrical placement of this feature should be inside the dimensions of its read.
Definition at line 43 of file featuredata.h.
FeatureData::FeatureData | ( | db_recno_t | readRec = 0 |
) |
Definition at line 24 of file featuredata.cpp.
References m_gui, m_info, and readRecno_.
00024 : GeneralData() 00025 { 00026 readRecno_ = readRec; 00027 m_gui = NULL; 00028 m_info = NULL; 00029 }
FeatureData::~FeatureData | ( | ) | [virtual] |
FeatureData::FeatureData | ( | db_recno_t | readRecno = 0 , |
|
TR_DNA | startPos = 0 , |
|||
TR_DNA | endPos = 0 | |||
) |
virtual FeatureData::~FeatureData | ( | ) | [virtual] |
TrDb::IndexMap FeatureData::getIndexMap | ( | ) | [virtual] |
Returns a TrDb::IndexMap that specifies which secondary indexes should be generated for stored data objects of this class in the Berkeley Db backend. Each record in the TrDb::IndexMap generates a secondary index built as a btree ( a DB_BTREE in Berkeley Db wording ). The secondary index is sorted which makes it possible to do queries like "Give me the object that has the smallest value, bigger or equal than x".
And about speed performance, a quote from Berkeley Db documentation says: "Searches take O(log base_b N) time, where base_b is the average number of keys per page, and N is the total number of keys stored"
Implements GeneralData.
Reimplemented in TagData, ReadMetaData, and ReadMetaData.
Definition at line 56 of file featuredata.cpp.
References QString::ascii(), bt_compare_seqRecNo(), getSeqRecNo(), and TrDb::Index::name.
Referenced by ReadMetaData::getIndexMap(), and TagData::getIndexMap().
00057 { 00058 TrDb::IndexMap iMap; 00059 TrDb::Index i = { 00060 &FeatureData::bt_compare_seqRecNo, 00061 &FeatureData::getSeqRecNo, 00062 QString("readRecno"), 00063 NULL 00064 }; 00065 iMap.insert( make_pair( i.name.ascii(), i ) );//Have to use ascii function since call is otherwise ambigous... 00066 return iMap; 00067 }
void FeatureData::setReadRecno | ( | db_recno_t | readRec | ) | [inline] |
Definition at line 49 of file featuredata.h.
References readRecno_.
Referenced by Destroyer::destroy(), MacsimParser::endElement(), TrapperView::getInfo(), TrapperDoc::importChromat(), TrapperDoc::importPhd(), TrapperView::paintFeatures(), MAl_Readonly::read_feat_from_db(), TrapperView::readSelected(), TrapperDoc::saveExport(), FindMatesAlgo::start(), and TrapperParser::startElement().
00049 { readRecno_ = readRec; }
FeatureGui * FeatureData::gui | ( | ) |
Definition at line 37 of file featuredata.cpp.
References m_gui, and makeGui().
Referenced by TrapperView::paintFeatures().
FeatureInfo * FeatureData::info | ( | ) |
Definition at line 46 of file featuredata.cpp.
References m_info, and makeInfo().
Referenced by TagData::getInfo(), TagData::getInfoAssoc(), TagData::readAttributes(), TagData::readStream(), TagData::setInfo(), TagData::writeStream(), and TagData::writeXml().
int FeatureData::getSeqRecNo | ( | Db * | , | |
const Dbt * | , | |||
const Dbt * | pdata, | |||
Dbt * | skey | |||
) | [static] |
Definition at line 84 of file featuredata.cpp.
Referenced by getIndexMap().
00085 { 00086 memset(skey, 0, sizeof(Dbt)); 00087 db_recno_t * data = ( db_recno_t * ) pdata->get_data(); 00088 skey->set_data( data ); 00089 skey->set_size(sizeof( db_recno_t )); 00090 return(0); 00091 }
int FeatureData::bt_compare_seqRecNo | ( | DB * | db, | |
const DBT * | dbt1, | |||
const DBT * | dbt2 | |||
) | [static] |
Definition at line 69 of file featuredata.cpp.
Referenced by getIndexMap().
00070 { 00071 /* order after row and then after end position */ 00072 db_recno_t * recno1 = ( db_recno_t *) dbt1->data; 00073 db_recno_t * recno2 = ( db_recno_t *) dbt2->data; 00074 if ( *recno1 > *recno2 ) 00075 return 1; 00076 if ( *recno1 < *recno2 ) 00077 return -1; 00078 if ( *recno1 == *recno2 ) 00079 return 0; 00080 /* should never reach this point */ 00081 return 0; 00082 }
void FeatureData::readStream | ( | QDataStream & | str | ) | [virtual] |
Loads the state of this object from a byte stream. Or in other words reads and unserializes a byte stream to set the values of this class object. This method is used for loading a GeneralData object from Berkeley Db.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
Definition at line 106 of file featuredata.cpp.
References QDataStream::device(), and readRecno_.
Referenced by SpatialFeatureData::readStream().
00107 { 00108 QIODevice * dev = stream.device(); 00109 Q_ASSERT( dev ); 00110 // stream.readRawBytes( ( char * ) &s, sizeof ( StorageData ) ); 00111 stream>>readRecno_; 00112 }
void FeatureData::writeStream | ( | QDataStream & | str | ) | [virtual] |
Saves the state of this object to a byte stream. Or in other words serializes and writes the internal data held in this class object to a byte stream. This method is used for storing a GeneralData object into Berkeley Db.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
Definition at line 93 of file featuredata.cpp.
References QDataStream::device(), QIODevice::mode(), and readRecno_.
Referenced by SpatialFeatureData::writeStream().
00094 { 00095 QIODevice * dev = stream.device(); 00096 Q_ASSERT( dev ); 00097 if ( ! ( IO_WriteOnly & dev->mode() ) ) 00098 { 00099 cerr << "data stream should be writeonly" << endl; 00100 exit(1); 00101 } 00102 // stream.writeRawBytes( ( char * ) &s, sizeof ( StorageData ) ); 00103 stream<<readRecno_; 00104 }
void FeatureData::readAttributes | ( | const QXmlAttributes & | attr | ) | [virtual] |
Loads the state of this object from QXmlAttributes.This method is used for importing.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
Definition at line 114 of file featuredata.cpp.
Referenced by SpatialFeatureData::readAttributes().
void FeatureData::writeXml | ( | ostream & | stream | ) | [virtual] |
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
Definition at line 118 of file featuredata.cpp.
References GeneralData::uniqueName().
Referenced by TrapperDoc::saveExport(), and SpatialFeatureData::writeXml().
00119 { 00120 stream<<'<'<<uniqueName()<<' '; 00121 }
void FeatureData::print_debug_info | ( | ) | [virtual] |
Prints some info for debugging, this should be removed in release version!
Reimplemented from GeneralData.
Reimplemented in SpatialFeatureData, ReadMetaData, and ReadMetaData.
Definition at line 123 of file featuredata.cpp.
References readRecno_.
Referenced by ReadMetaData::print_debug_info(), and SpatialFeatureData::print_debug_info().
00124 { 00125 cerr<<"readRecno: "<<readRecno_<<endl; 00126 }
db_recno_t FeatureData::readRecno | ( | ) | [inline] |
Definition at line 60 of file featuredata.h.
References readRecno_.
Referenced by TrapperView::findTag(), and ReadMetaData::ReadMetaData().
00060 { return readRecno_; }
virtual FeatureGui* FeatureData::makeGui | ( | ) | [protected, pure virtual] |
Implemented in DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
Referenced by gui().
virtual FeatureInfo* FeatureData::makeInfo | ( | ) | [protected, pure virtual] |
Implemented in SpatialFeatureData, DnpData, DnaStrData, QualityData, TagData, ReadMetaData, DnpData, DnaStrData, QualityData, and TagData.
Referenced by info().
TrDb::IndexMap FeatureData::getIndexMap | ( | ) | [virtual] |
Returns a TrDb::IndexMap that specifies which secondary indexes should be generated for stored data objects of this class in the Berkeley Db backend. Each record in the TrDb::IndexMap generates a secondary index built as a btree ( a DB_BTREE in Berkeley Db wording ). The secondary index is sorted which makes it possible to do queries like "Give me the object that has the smallest value, bigger or equal than x".
And about speed performance, a quote from Berkeley Db documentation says: "Searches take O(log base_b N) time, where base_b is the average number of keys per page, and N is the total number of keys stored"
Implements GeneralData.
Reimplemented in TagData, ReadMetaData, and ReadMetaData.
TR_DNA FeatureData::startPos | ( | ) | [inline] |
Reimplemented in SpatialFeatureData.
Definition at line 49 of file spatialfeaturedata.h.
References s, and FeatureData::StorageData::startPos.
Referenced by DnpInfo::myInfoRange(), and ChromatGui::paintMe().
TR_DNA FeatureData::endPos | ( | ) | [inline] |
Reimplemented in SpatialFeatureData.
Definition at line 50 of file spatialfeaturedata.h.
References FeatureData::StorageData::endPos, and s.
Referenced by TrapperDoc::importPhd(), and ChromatGui::paintMe().
void FeatureData::setStartPos | ( | TR_DNA | startPos | ) | [inline] |
Reimplemented in SpatialFeatureData.
Definition at line 51 of file spatialfeaturedata.h.
References s, and FeatureData::StorageData::startPos.
void FeatureData::setEndPos | ( | TR_DNA | endPos | ) | [inline] |
Reimplemented in SpatialFeatureData.
Definition at line 52 of file spatialfeaturedata.h.
References FeatureData::StorageData::endPos, and s.
void FeatureData::setReadRecno | ( | db_recno_t | readRecno | ) | [inline] |
Definition at line 53 of file spatialfeaturedata.h.
References FeatureData::StorageData::readRecno, and s.
FeatureGui* FeatureData::gui | ( | ) |
FeatureInfo* FeatureData::info | ( | ) |
static int FeatureData::getSeqRecNo | ( | Db * | , | |
const Dbt * | , | |||
const Dbt * | pdata, | |||
Dbt * | skey | |||
) | [static] |
static int FeatureData::bt_compare_seqRecNo | ( | DB * | db, | |
const DBT * | dbt1, | |||
const DBT * | dbt2 | |||
) | [static] |
virtual void FeatureData::readStream | ( | QDataStream & | str | ) | [virtual] |
Loads the state of this object from a byte stream. Or in other words reads and unserializes a byte stream to set the values of this class object. This method is used for loading a GeneralData object from Berkeley Db.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
virtual void FeatureData::writeStream | ( | QDataStream & | str | ) | [virtual] |
Saves the state of this object to a byte stream. Or in other words serializes and writes the internal data held in this class object to a byte stream. This method is used for storing a GeneralData object into Berkeley Db.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
virtual void FeatureData::readAttributes | ( | const QXmlAttributes & | attr | ) | [virtual] |
Loads the state of this object from QXmlAttributes.This method is used for importing.
Implements GeneralData.
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
virtual void FeatureData::writeXml | ( | ostream & | stream | ) | [virtual] |
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
virtual void FeatureData::print_debug_info | ( | ) | [virtual] |
Prints some info for debugging, this should be removed in release version!
Reimplemented from GeneralData.
Reimplemented in SpatialFeatureData, ReadMetaData, and ReadMetaData.
virtual FeatureGui* FeatureData::makeGui | ( | ) | [protected, pure virtual] |
Implemented in DnpData, DnaStrData, ChromatData, QualityData, TagData, ReadMetaData, DnpData, DnaStrData, ChromatData, QualityData, and TagData.
virtual FeatureInfo* FeatureData::makeInfo | ( | ) | [protected, virtual] |
Reimplemented in SpatialFeatureData, DnpData, DnaStrData, QualityData, TagData, ReadMetaData, DnpData, DnaStrData, QualityData, and TagData.
db_recno_t FeatureData::readRecno_ [protected] |
to keep the order of the data members when serializing/unserializing
This might make the serializing/unserializing a bit faster ( probably not significant at all, not tested ). But the main reason for the existence of this class is that the order is kept right between serializing and unserializing. But a problem with this approach might be that the endian awareness of QDataStream might be lost, when we don't serialize the types one by one. It might be a problem when moving berkeley dbs around archictures. But berkeley db probably doesn't allow this anyway?
Definition at line 73 of file featuredata.h.
Referenced by FeatureData(), ReadMetaData::print_debug_info(), print_debug_info(), readRecno(), ReadMetaData::readStream(), readStream(), setReadRecno(), ReadMetaData::writeStream(), and writeStream().
FeatureGui* FeatureData::m_gui [protected] |
Definition at line 75 of file featuredata.h.
Referenced by FeatureData(), gui(), and ~FeatureData().
FeatureInfo* FeatureData::m_info [protected] |
Reimplemented in ReadMetaData, and ReadMetaData.
Definition at line 77 of file featuredata.h.
Referenced by FeatureData(), info(), and ~FeatureData().
StorageData FeatureData::s [protected] |
Definition at line 83 of file spatialfeaturedata.h.
Referenced by endPos(), setEndPos(), setReadRecno(), setStartPos(), and startPos().
FeatureGui* FeatureData::m_gui [protected] |
Definition at line 84 of file spatialfeaturedata.h.
FeatureInfo* FeatureData::m_info [protected] |
Reimplemented in ReadMetaData, and ReadMetaData.
Definition at line 86 of file spatialfeaturedata.h.