1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include "ExtendedSubstitutionMatrix.h"
#include "SubstitutionMatrix.h"
#include "ScoreMatrix.h"
#include "Parameters.h"
#include "Debug.h"
const char* binary_name = "test_scorematrixserialization";
int main (int, const char**) {
Parameters& par = Parameters::getInstance();
SubstitutionMatrix subMat(par.scoringMatrixFile.aminoacids, 8.0, 0);
ScoreMatrix extMattwo = ExtendedSubstitutionMatrix::calcScoreMatrix(subMat, 2);
Debug(Debug::INFO) << extMattwo.elementSize << " " << extMattwo.rowSize << " "
<< extMattwo.score[0] << " " << extMattwo.index[0] << "\n";
char* serialized = ScoreMatrix::serialize(extMattwo);
ExtendedSubstitutionMatrix::freeScoreMatrix(extMattwo);
ScoreMatrix unserialized = ScoreMatrix::unserialize(serialized, subMat.alphabetSize, 2);
Debug(Debug::INFO) << unserialized.elementSize << " " << unserialized.rowSize << " "
<< unserialized.score[0] << "\n";
free(serialized);
free(extMattwo);
// Why not use an operator. Will free & destruct & will not SIGSEGV
delete(unserialized);
return EXIT_SUCCESS;
}
|