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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include "SpectralPeakArray.hxx"
#include "SpectralPeakArrayAdapter.hxx"
#include "StdioSpectralPeakArrayPresentation.hxx"
#include "XMLStorage.hxx"
#include "Err.hxx"
#include <iostream>
#include <exception>
#include <string>
using CLAM::SpectralPeakArray;
using CLAM::XMLStorage;
using CLAMVM::SpectralPeakArrayAdapter;
using CLAMVM::StdioSpectralPeakArrayPresentation;
static const char* sPathToData = "./Datasets/";
bool TestBasicUseCase( SpectralPeakArrayAdapter& view, StdioSpectralPeakArrayPresentation& presentation )
{
XMLStorage x;
SpectralPeakArray specPeakArrayObj;
std::string filename = "SpectralPeakArray.xml";
std::string pathToFile = sPathToData;
pathToFile+=filename;
x.Restore( specPeakArrayObj, pathToFile );
view.BindTo( specPeakArrayObj );
view.Publish();
presentation.Show();
return true;
}
int main( int argc, char** argv )
{
try
{
SpectralPeakArrayAdapter view;
StdioSpectralPeakArrayPresentation presentation;
presentation.AttachTo( view );
std::cerr << "BASIC SPECTRAL PEAK ARRAY USE CASE TEST LAUNCHED" << std::endl;
if ( !TestBasicUseCase( view, presentation ) )
std::cerr << "Basic Use case Test...... FAILED!" << std::endl;
else
std::cerr << "Basic Use case Test...... Passed!" << std::endl;
}
catch ( CLAM::Err& e )
{
std::cerr << "A CLAM controlled error has occured" << std::endl;
e.Print();
std::cerr << "<==== END OF ERROR MESSAGE" << std::endl;
return -1;
}
catch( std::exception& e )
{
std::cerr << "An standard library error has occured" << std::endl;
std::cerr << e.what() << std::endl;
std::cerr << "<==== END OF ERROR MESSAGE" << std::endl;
return -1;
}
catch( ... )
{
std::cerr << "An unknown error has occured!" << std::endl;
return -1;
}
return 0;
}
|