#include <featuredata.h>
Inheritance diagram for FeatureData:
Public Member Functions | |
FeatureData (db_recno_t readRecno=0, TR_DNA startPos=0, TR_DNA endPos=0) | |
virtual | ~FeatureData () |
virtual void | readDom (QDomElement &elem) |
virtual void | writeDom (QDomElement &elem) |
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) |
Protected Member Functions | |
virtual FeatureGui * | makeGui ()=0 |
virtual FeatureInfo * | makeInfo () |
Protected Attributes | |
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.
|
Definition at line 24 of file featuredata.cpp. References FeatureData::StorageData::endPos, m_gui, m_info, FeatureData::StorageData::readRecno, s, and FeatureData::StorageData::startPos. 00024 : GeneralData() 00025 { 00026 s.readRecno = readRecno; 00027 s.startPos = startPos; 00028 s.endPos = endPos; 00029 m_gui = NULL; 00030 m_info = NULL; 00031 }
|
|
Definition at line 33 of file featuredata.cpp.
|
|
Definition at line 435 of file featuredata.cpp. Referenced by getIndexMap(). 00436 { 00437 /* order after row and then after end position */ 00438 db_recno_t * recno1 = ( db_recno_t *) dbt1->data; 00439 db_recno_t * recno2 = ( db_recno_t *) dbt2->data; 00440 if ( *recno1 > *recno2 ) 00441 return 1; 00442 if ( *recno1 < *recno2 ) 00443 return -1; 00444 if ( *recno1 == *recno2 ) 00445 return 0; 00446 /* should never reach this point */ 00447 return 0; 00448 }
|
|
Definition at line 52 of file featuredata.h. References FeatureData::StorageData::endPos, and s. Referenced by FeatureInfo::getPosInfo(), FeatureInfo::getRangeInfo(), TrapperDoc::importPhd(), FeatureGui::paint(), and ChromatGui::paintMe().
|
|
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 DnpData. Definition at line 63 of file featuredata.cpp. References bt_compare_seqRecNo(), getSeqRecNo(), and TrDb::Index::name. Referenced by DnpData::getIndexMap(). 00064 { 00065 TrDb::IndexMap iMap; 00066 TrDb::Index i = { 00067 &FeatureData::bt_compare_seqRecNo, 00068 &FeatureData::getSeqRecNo, 00069 QString("readRecno"), 00070 NULL 00071 }; 00072 iMap.insert( make_pair( i.name.ascii(), i ) );//Have to use ascii function since call is otherwise ambigous... 00073 return iMap; 00074 }
|
|
Definition at line 450 of file featuredata.cpp. References FeatureData::StorageData::readRecno. Referenced by getIndexMap(). 00451 { 00452 memset(skey, 0, sizeof(Dbt)); 00453 StorageData * data = ( StorageData * ) pdata->get_data(); 00454 skey->set_data( ( u_int8_t * ) (& (data->readRecno)) ); 00455 skey->set_size(sizeof( db_recno_t )); 00456 return(0); 00457 }
|
|
Definition at line 39 of file featuredata.cpp. References m_gui, and makeGui(). Referenced by TrapperView::paintFeatures().
|
|
Definition at line 48 of file featuredata.cpp. References m_info, and makeInfo(). Referenced by TrapperView::getInfo().
|
|
Implemented in DnpData, DnaStrData, ChromatData, and QualityData. Referenced by gui(). |
|
Reimplemented in DnpData, DnaStrData, and QualityData. Definition at line 57 of file featuredata.cpp. Referenced by info(). 00058 { 00059 00060 return new FeatureInfo(this); 00061 }
|
|
Prints some info for debugging, this should be removed in release version! Reimplemented from GeneralData. Definition at line 132 of file featuredata.cpp. References FeatureData::StorageData::readRecno, and s.
|
|
Loads the state of this object from QXmlAttributes.This method is used for importing. Implements GeneralData. Reimplemented in DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 110 of file featuredata.cpp. References FeatureData::StorageData::endPos, s, and FeatureData::StorageData::startPos. Referenced by ChromatData::readAttributes(), QualityData::readAttributes(), DnaStrData::readAttributes(), and DnpData::readAttributes(). 00111 { 00112 00113 if ( attr.value("startPos") != "" ) { 00114 QString startPosStr = attr.value("startPos"); 00115 long startPosLong = startPosStr.toLong(); 00116 // is long the same thing as Q_INT64 ? 00117 s.startPos = startPosLong; 00118 } 00119 if ( attr.value("endPos") != "" ) { 00120 QString endPosStr = attr.value("endPos"); 00121 ulong endPosLong = endPosStr.toLong(); 00122 s.endPos = endPosLong; 00123 } 00124 }
|
|
Loads the state of this object from a dom tree. Or in other words reads in the values of the data members of this class from a dom tree underneath the QDomElement elem. This method is used for importing. Reimplemented from GeneralData. Reimplemented in DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 95 of file featuredata.cpp. References FeatureData::StorageData::endPos, GeneralData::readDom(), FeatureData::StorageData::readRecno, s, and FeatureData::StorageData::startPos. Referenced by ChromatData::readDom(), QualityData::readDom(), DnaStrData::readDom(), and DnpData::readDom(). 00096 { 00097 GeneralData::readDom( elem ); 00098 QString startPosStr = elem.attribute("startPos"); 00099 long startPosLong = startPosStr.toLong(); 00100 // is long the same thing as Q_INT64 ? 00101 s.startPos = startPosLong; 00102 QString endPosStr = elem.attribute("endPos"); 00103 ulong endPosLong = endPosStr.toLong(); 00104 s.endPos = endPosLong; 00105 QString readRecnoStr = elem.attribute("readRecno"); 00106 ulong readRecnoLong = readRecnoStr.toLong(); 00107 s.readRecno = static_cast< db_recno_t >( readRecnoLong ); 00108 }
|
|
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 DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 88 of file featuredata.cpp. References s. Referenced by ChromatData::readStream(), QualityData::readStream(), DnaStrData::readStream(), and DnpData::readStream(). 00089 { 00090 QIODevice * dev = stream.device(); 00091 Q_ASSERT( dev ); 00092 stream.readRawBytes( ( char * ) &s, sizeof ( StorageData ) ); 00093 }
|
|
Definition at line 54 of file featuredata.h. References FeatureData::StorageData::endPos, and s.
|
|
Definition at line 55 of file featuredata.h. References FeatureData::StorageData::readRecno, and s. Referenced by MAl::commit_feat_to_db(), Destroyer::destroy(), TrapperView::getInfo(), TrapperDoc::importChromat(), TrapperDoc::importPhd(), TrapperView::paintFeatures(), MAl_Readonly::read_feat_from_db(), TrapperView::readSelected(), TrapperDoc::saveExport(), TrapperParser::startElement(), and TrapperView::writeSelected().
|
|
Definition at line 53 of file featuredata.h. References s, and FeatureData::StorageData::startPos.
|
|
Definition at line 51 of file featuredata.h. References s, and FeatureData::StorageData::startPos. Referenced by DnpInfo::myInfoRange(), FeatureGui::paint(), and ChromatGui::paintMe().
|
|
Saves the state of this object to a dom tree. Or in other words writes out the internal data held in this class to a dom tree underneath the QDomElement elem. This method is used for exporting. Reimplemented from GeneralData. Reimplemented in DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 137 of file featuredata.cpp. References FeatureData::StorageData::endPos, FeatureData::StorageData::readRecno, s, FeatureData::StorageData::startPos, and GeneralData::writeDom(). Referenced by ChromatData::writeDom(), QualityData::writeDom(), DnaStrData::writeDom(), and DnpData::writeDom(). 00138 { 00139 GeneralData::writeDom( elem ); 00140 Q_UINT32 readRecno = s.readRecno; 00141 QString startPosStr, endPosStr, readRecnoStr; 00142 startPosStr.setNum( ( Q_INT32 ) s.startPos ); 00143 endPosStr.setNum( ( Q_INT32 ) s.endPos ); 00144 readRecnoStr.setNum( readRecno ); 00145 elem.setAttribute("startPos", startPosStr ); 00146 elem.setAttribute("endPos", endPosStr); 00147 elem.setAttribute("readRecno", readRecnoStr); 00148 }
|
|
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 DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 76 of file featuredata.cpp. References s. Referenced by TrapperView::writeSelected(), ChromatData::writeStream(), QualityData::writeStream(), DnaStrData::writeStream(), and DnpData::writeStream(). 00077 { 00078 QIODevice * dev = stream.device(); 00079 Q_ASSERT( dev ); 00080 if ( ! ( IO_WriteOnly & dev->mode() ) ) 00081 { 00082 cerr << "data stream should be writeonly" << endl; 00083 exit(1); 00084 } 00085 stream.writeRawBytes( ( char * ) &s, sizeof ( StorageData ) ); 00086 }
|
|
Reimplemented in DnpData, DnaStrData, ChromatData, and QualityData. Definition at line 125 of file featuredata.cpp. References FeatureData::StorageData::endPos, s, FeatureData::StorageData::startPos, and GeneralData::uniqueName(). Referenced by TrapperDoc::saveExport(), ChromatData::writeXml(), QualityData::writeXml(), DnaStrData::writeXml(), and DnpData::writeXml(). 00126 { 00127 stream<<'<'<<uniqueName()<<' ' 00128 <<"startPos=\""<<s.startPos<<"\" " 00129 <<"endPos=\""<<s.endPos<<"\""; 00130 }
|
|
Definition at line 86 of file featuredata.h. Referenced by FeatureData(), gui(), and ~FeatureData(). |
|
Definition at line 88 of file featuredata.h. Referenced by FeatureData(), info(), and ~FeatureData(). |
|
Definition at line 85 of file featuredata.h. Referenced by endPos(), FeatureData(), print_debug_info(), readAttributes(), readDom(), readStream(), setEndPos(), setReadRecno(), setStartPos(), startPos(), writeDom(), writeStream(), and writeXml(). |