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

generaldata.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  *                                                                             *
00003  *   Copyright (C) 2003  Erik Sjolund,  (<html>Erik Sj&ouml;lund</html>)       *
00004  *                       Center for Genomics and Bioinformatics,               *
00005  *                       Karolinska Institutet,                                *
00006  *                       Stockholm,                                            *
00007  *                       Sweden                                                *
00008  *                                                                             *
00009  *  Author: Erik Sjolund                                                       *
00010  *  Email: erik.sjolund@adivo.se                                               *
00011  *                                                                             *
00012  *******************************************************************************
00013  */
00014 #include "generaldata.h"
00015 #include "generalmaker.h"
00016 
00017 #include <iostream>
00018 
00019 using namespace std;
00020 
00021 GeneralData::GeneralData()
00022 {}
00023 
00024 void GeneralData::writeDom( QDomElement & elem )
00025 {
00026     elem.setAttribute("recno",m_recno);
00027 }
00028 
00029 void GeneralData::readDom( QDomElement & elem )
00030 {
00031     Q_ASSERT( elem.hasAttribute( "recno" ));
00032     QString recnoStr = elem.attribute("recno");
00033     ulong recnoULong = recnoStr.toULong();
00034     m_recno = static_cast< db_recno_t > ( recnoULong );
00035     return;
00036 }
00037 
00038 db_recno_t GeneralData::getRecno()
00039 {
00040     return m_recno;
00041 }
00042 
00043 void GeneralData::copy(GeneralData* other)
00044 {
00045   if (this == other || this->uniqueName() != other->uniqueName()) {
00046     return;
00047   }
00048   QByteArray ar;
00049   QDataStream streamout( ar, IO_WriteOnly );
00050   other->writeStream(streamout);
00051   QDataStream streamin( ar, IO_ReadOnly );
00052   this->readStream(streamin);
00053   
00054   this->setRecno( other->getRecno() );
00055 }
00056 
00057 
00058 void Database::setFromDbt( const Dbt * dbtData, GeneralData * general)
00059 {
00060     QByteArray ar;
00061     ar.setRawData( (const char* ) dbtData->get_data(), ( uint ) dbtData->get_size() );
00062     QDataStream stream( ar, IO_ReadOnly );
00063     general->readStream( stream );
00064     ar.resetRawData( ( const char * ) dbtData->get_data(), ( uint ) dbtData->get_size() );
00065     return;
00066 }

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