Update multi-part features (nanomsg) and various fixes

- Implement nanomsg multipart with MessagePack.
 - Use the MessagePack from FairSoft and handle not found case.
 - Update splitter, merger and proxy devices to handle multi-part.
 - Let FairMQParts.At() return pointer reference (can be used for moving).
 - Add missing const specifier in the message interface.
 - Add transmit kernel size setting to channels (ZMQ_SNDBUF).
 - Remove FairMQBuffer device.
 - Remove old multi-part methods from Tutorial3 example (to be replaced with Parts API).
 - Make callback mandatory for newMsg(data, size, callback).
 - Add missing <vector> include in FairMQSocket.
This commit is contained in:
Alexey Rybalchenko
2016-03-21 09:59:00 +01:00
parent 4ca66e33da
commit 732373faa2
25 changed files with 436 additions and 381 deletions

View File

@@ -28,30 +28,32 @@ FairMQSplitter::~FairMQSplitter()
void FairMQSplitter::Run()
{
// store the channel references to avoid traversing the map on every loop iteration
auto& dataOutChannelRef = fChannels.at("data-out");
const FairMQChannel& dataInChannel = fChannels.at("data-in").at(0);
int numOutputs = dataOutChannelRef.size();
std::vector<FairMQChannel*> dataOutChannels(numOutputs);
for (int i = 0; i < numOutputs; ++i)
{
dataOutChannels[i] = &(dataOutChannelRef.at(i));
}
int numOutputs = fChannels.at("data-out").size();
int direction = 0;
while (CheckCurrentState(RUNNING))
{
std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
FairMQParts parts;
if (dataInChannel.Receive(msg) >= 0)
if (Receive(parts, "data-in") >= 0)
{
dataOutChannels[direction]->Send(msg);
++direction;
if (direction >= numOutputs)
if (Send(parts, "data-out", direction) < 0)
{
direction = 0;
LOG(DEBUG) << "Transfer interrupted";
break;
}
}
else
{
LOG(DEBUG) << "Transfer interrupted";
break;
}
++direction;
if (direction >= numOutputs)
{
direction = 0;
}
}
}