mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Refactor the transport interface
- give transport Initialize() method with access to device config. - avoid using global context in the transport. - simplify shutdown procedure (no need for extra thread).
This commit is contained in:
committed by
Mohammad Al-Turany
parent
d7eb692951
commit
5aaf27bf02
@@ -13,6 +13,9 @@
|
||||
*/
|
||||
|
||||
#include "FairMQTransportFactoryNN.h"
|
||||
#include "../options/FairMQProgOptions.h"
|
||||
|
||||
#include <nanomsg/nn.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -23,6 +26,11 @@ FairMQTransportFactoryNN::FairMQTransportFactoryNN()
|
||||
LOG(DEBUG) << "Transport: Using nanomsg library";
|
||||
}
|
||||
|
||||
void FairMQTransportFactoryNN::Initialize(const FairMQProgOptions* config)
|
||||
{
|
||||
// nothing to do for nanomsg, transport is ready to be used any time (until nn_term()).
|
||||
}
|
||||
|
||||
FairMQMessagePtr FairMQTransportFactoryNN::CreateMessage() const
|
||||
{
|
||||
return unique_ptr<FairMQMessage>(new FairMQMessageNN());
|
||||
@@ -38,9 +46,9 @@ FairMQMessagePtr FairMQTransportFactoryNN::CreateMessage(void* data, const size_
|
||||
return unique_ptr<FairMQMessage>(new FairMQMessageNN(data, size, ffn, hint));
|
||||
}
|
||||
|
||||
FairMQSocketPtr FairMQTransportFactoryNN::CreateSocket(const string& type, const string& name, const int numIoThreads, const string& id /*= ""*/) const
|
||||
FairMQSocketPtr FairMQTransportFactoryNN::CreateSocket(const string& type, const string& name, const string& id /*= ""*/) const
|
||||
{
|
||||
return unique_ptr<FairMQSocket>(new FairMQSocketNN(type, name, numIoThreads, id));
|
||||
return unique_ptr<FairMQSocket>(new FairMQSocketNN(type, name, id));
|
||||
}
|
||||
|
||||
FairMQPollerPtr FairMQTransportFactoryNN::CreatePoller(const vector<FairMQChannel>& channels) const
|
||||
@@ -58,6 +66,16 @@ FairMQPollerPtr FairMQTransportFactoryNN::CreatePoller(const FairMQSocket& cmdSo
|
||||
return unique_ptr<FairMQPoller>(new FairMQPollerNN(cmdSocket, dataSocket));
|
||||
}
|
||||
|
||||
void FairMQTransportFactoryNN::Shutdown()
|
||||
{
|
||||
// nothing to do for nanomsg, transport is ready to be terminated any time.
|
||||
}
|
||||
|
||||
void FairMQTransportFactoryNN::Terminate()
|
||||
{
|
||||
nn_term();
|
||||
}
|
||||
|
||||
FairMQ::Transport FairMQTransportFactoryNN::GetType() const
|
||||
{
|
||||
return fTransportType;
|
||||
|
Reference in New Issue
Block a user