mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
- 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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user