/** * runTestDetectorProcessorBoost.cxx * * Created on: Oct 26, 2012 * Author: dklein */ #include #include #include "FairMQLogger.h" #include "CbmMicroSliceMerger.h" #include "FairMQProcessor.h" //#include "CbmProcessor.h" #ifdef NANOMSG #include "FairMQTransportFactoryNN.h" #else #include "FairMQTransportFactoryZMQ.h" #endif #include "CbmMicroSliceMergerTask.h" #include #include #include #include using std::cout; using std::cin; using std::endl; using std::stringstream; typedef boost::archive::binary_iarchive TBoostBinPayloadIn; // boost binary format typedef boost::archive::text_iarchive TBoostTextPayloadIn; // boost text format typedef boost::archive::binary_oarchive TBoostBinPayloadOut; // boost binary format typedef boost::archive::text_oarchive TBoostTextPayloadOut; // boost text format typedef CbmMicroSliceMergerTask TProcessorTask; CbmMicroSliceMerger processor; static void s_signal_handler (int signal) { cout << endl << "Caught signal " << signal << endl; processor.ChangeState(CbmMicroSliceMerger::STOP); processor.ChangeState(CbmMicroSliceMerger::END); cout << "Shutdown complete. Bye!" << endl; exit(1); } static void s_catch_signals (void) { struct sigaction action; action.sa_handler = s_signal_handler; action.sa_flags = 0; sigemptyset(&action.sa_mask); sigaction(SIGINT, &action, NULL); sigaction(SIGTERM, &action, NULL); } int main(int argc, char** argv) { if ( argc != 18 ) { cout<<"argc="<> MSNumber; processor.SetMicroSliceNum(MSNumber);// MicroSlice number to merge ++i; uint64_t TSIndex; stringstream(argv[i]) >> TSIndex; processor.SetTimeSliceIdx(TSIndex);// TimeSlice index ++i; processor.SetProperty(CbmMicroSliceMerger::Id, argv[i]); ++i; int numIoThreads; stringstream(argv[i]) >> numIoThreads; processor.SetProperty(CbmMicroSliceMerger::NumIoThreads, numIoThreads); ++i; int numInputs; stringstream(argv[i]) >> numInputs; processor.SetProperty(CbmMicroSliceMerger::NumInputs, numInputs); ++i; processor.SetProperty(CbmMicroSliceMerger::NumOutputs, 1); processor.ChangeState(CbmMicroSliceMerger::INIT); for (int iInput = 0; iInput < numInputs; iInput++) { //cout<<""<< argv[i] <::InputSocketType, argv[i], iInput); ++i;//cout<<""<< argv[i] <> inputRcvBufSize; processor.SetProperty(CbmMicroSliceMerger::InputRcvBufSize, inputRcvBufSize, iInput); ++i;//cout<<""<< argv[i] <::InputMethod, argv[i], iInput); ++i;//cout<<""<< argv[i] <::InputAddress, argv[i], iInput); ++i; } processor.SetProperty(CbmMicroSliceMerger::OutputSocketType, argv[i], 0); ++i; int outputSndBufSize; stringstream(argv[i]) >> outputSndBufSize; processor.SetProperty(CbmMicroSliceMerger::OutputSndBufSize, outputSndBufSize, 0); ++i; processor.SetProperty(CbmMicroSliceMerger::OutputMethod, argv[i], 0); ++i; processor.SetProperty(CbmMicroSliceMerger::OutputAddress, argv[i], 0); ++i; processor.ChangeState(CbmMicroSliceMerger::SETOUTPUT); processor.ChangeState(CbmMicroSliceMerger::SETINPUT); try { processor.ChangeState(CbmMicroSliceMerger::RUN); } catch (boost::archive::archive_exception& e) { LOG(ERROR) << e.what(); } char ch; cin.get(ch); processor.ChangeState(CbmMicroSliceMerger::STOP); processor.ChangeState(CbmMicroSliceMerger::END); return 0; }