- Add multipart support to the interface and enable its use out of tasks.

Examples on the use out of tasks are provided in:
  `example/Tutorial3/digitization/TestDetectorDigiLoader.tpl:76-85`: sending a part.
  `example/Tutorial3/reconstruction/FairTestDetectorMQRecoTask.tpl:177-182`: receiving a part.

- This commit also makes structure within processorTask more consistent with samplerTask.

- add macro MQLOG to FairMQLogger.
This commit is contained in:
Alexey Rybalchenko
2014-07-25 12:07:47 +02:00
parent 281fcc459c
commit 8cd120aef4
9 changed files with 71 additions and 25 deletions

View File

@@ -69,7 +69,7 @@ void FairMQSocketNN::Connect(const string& address)
}
}
size_t FairMQSocketNN::Send(FairMQMessage* msg)
size_t FairMQSocketNN::Send(FairMQMessage* msg, const string& flag)
{
void* ptr = msg->GetMessage();
int rc = nn_send(fSocket, &ptr, NN_MSG, 0);
@@ -87,7 +87,7 @@ size_t FairMQSocketNN::Send(FairMQMessage* msg)
return rc;
}
size_t FairMQSocketNN::Receive(FairMQMessage* msg)
size_t FairMQSocketNN::Receive(FairMQMessage* msg, const string& flag)
{
void* ptr = NULL;
int rc = nn_recv(fSocket, &ptr, NN_MSG, 0);
@@ -130,6 +130,14 @@ void FairMQSocketNN::SetOption(const string& option, const void* value, size_t v
}
}
void FairMQSocketNN::GetOption(const string& option, void* value, size_t* valueSize)
{
int rc = nn_getsockopt(fSocket, NN_SOL_SOCKET, GetConstant(option), value, valueSize);
if (rc < 0) {
LOG(ERROR) << "failed getting socket option, reason: " << nn_strerror(errno);
}
}
unsigned long FairMQSocketNN::GetBytesTx()
{
return fBytesTx;
@@ -152,6 +160,8 @@ unsigned long FairMQSocketNN::GetMessagesRx()
int FairMQSocketNN::GetConstant(const string& constant)
{
if (constant == "")
return 0;
if (constant == "sub")
return NN_SUB;
if (constant == "pub")
@@ -168,6 +178,14 @@ int FairMQSocketNN::GetConstant(const string& constant)
return NN_SNDBUF;
if (constant == "rcv-hwm")
return NN_RCVBUF;
if (constant == "snd-more") {
LOG(ERROR) << "Multipart messages functionality currently not supported by nanomsg!";
return -1;
}
if (constant == "rcv-more") {
LOG(ERROR) << "Multipart messages functionality currently not supported by nanomsg!";
return -1;
}
return -1;
}