/* * Processor.cxx * * Created on: Dec 6, 2012 * Author: dklein */ #include "Processor.h" namespace Highway { Processor::Processor() : fTask(NULL) { } Processor::~Processor() { delete fTask; } void Processor::SetTask(ProcessorTask* task) { fTask = task; } void Processor::Init() { DEVICE::Init(); fTask->Init(); } void Processor::Run() { Logger::GetInstance()->Log(Logger::INFO, ">>>>>>> Run <<<<<<<"); std::thread logger([&]() { DEVICE::LogSocketRates();}); // Initialize poll set zmq_pollitem_t items[] = { { *(fPayloadInputs->at(0)->GetSocket()), 0, ZMQ_POLLIN, 0 } }; bool received = false; while (true) { Message msg; zmq_poll(items, 1, -1); if (items[0].revents & ZMQ_POLLIN) { received = fPayloadInputs->at(0)->Receive(&msg); } if (received) { fTask->Exec(&msg); fPayloadOutputs->at(0)->Send(&msg); } } logger.join(); } } /* namespace Highway */