mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
add nanomsg implementations + use factory for nanomsg + lots of small stuff
This commit is contained in:
41
fairmq/FairMQPollerZMQ.cxx
Normal file
41
fairmq/FairMQPollerZMQ.cxx
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* FairMQPollerZMQ.cxx
|
||||
*
|
||||
* @since 2014-01-23
|
||||
* @author A. Rybalchenko
|
||||
*/
|
||||
|
||||
#include <zmq.h>
|
||||
|
||||
#include "FairMQPollerZMQ.h"
|
||||
|
||||
FairMQPollerZMQ::FairMQPollerZMQ(const vector<FairMQSocket*>& inputs)
|
||||
{
|
||||
fNumItems = inputs.size();
|
||||
items = new zmq_pollitem_t[fNumItems];
|
||||
|
||||
for (int i = 0; i < fNumItems; i++) {
|
||||
items[i].socket = inputs.at(i)->GetSocket();
|
||||
items[i].fd = 0;
|
||||
items[i].events = ZMQ_POLLIN;
|
||||
items[i].revents = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void FairMQPollerZMQ::Poll(int timeout)
|
||||
{
|
||||
zmq_poll(items, fNumItems, timeout);
|
||||
}
|
||||
|
||||
bool FairMQPollerZMQ::CheckInput(int index)
|
||||
{
|
||||
if (items[index].revents & ZMQ_POLLIN)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FairMQPollerZMQ::~FairMQPollerZMQ()
|
||||
{
|
||||
if (items != NULL) delete [] items;
|
||||
}
|
Reference in New Issue
Block a user