mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
FairMQ: MakeTransport to create stand-alone transport for tests.
This commit is contained in:
parent
085de240c2
commit
459b42add2
|
@ -923,6 +923,41 @@ shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& tran
|
|||
}
|
||||
}
|
||||
|
||||
unique_ptr<FairMQTransportFactory> FairMQDevice::MakeTransport(const string& transport)
|
||||
{
|
||||
unique_ptr<FairMQTransportFactory> tr;
|
||||
|
||||
if (transport == "zeromq")
|
||||
{
|
||||
tr = FairMQ::tools::make_unique<FairMQTransportFactoryZMQ>();
|
||||
}
|
||||
else if (transport == "shmem")
|
||||
{
|
||||
tr = FairMQ::tools::make_unique<FairMQTransportFactorySHM>();
|
||||
}
|
||||
#ifdef NANOMSG_FOUND
|
||||
else if (transport == "nanomsg")
|
||||
{
|
||||
tr = FairMQ::tools::make_unique<FairMQTransportFactoryNN>();
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Unavailable transport requested: " << "\"" << transport << "\"" << ". Available are: "
|
||||
<< "\"zeromq\""
|
||||
<< "\"shmem\""
|
||||
#ifdef NANOMSG_FOUND
|
||||
<< ", \"nanomsg\""
|
||||
#endif
|
||||
<< ". Returning nullptr.";
|
||||
return tr;
|
||||
}
|
||||
|
||||
tr->Initialize(nullptr);
|
||||
|
||||
return move(tr);
|
||||
}
|
||||
|
||||
void FairMQDevice::SetTransport(const string& transport)
|
||||
{
|
||||
if (fTransports.empty())
|
||||
|
|
|
@ -336,6 +336,10 @@ class FairMQDevice : public FairMQStateMachine, public FairMQConfigurable
|
|||
/// @param transport Transport string ("zeromq"/"nanomsg"/"shmem")
|
||||
void SetTransport(const std::string& transport = "zeromq");
|
||||
|
||||
/// Creates stand-alone transport factory
|
||||
/// @param transport Transport string ("zeromq"/"nanomsg"/"shmem")
|
||||
static std::unique_ptr<FairMQTransportFactory> MakeTransport(const std::string& transport);
|
||||
|
||||
void SetConfig(FairMQProgOptions& config);
|
||||
const FairMQProgOptions* GetConfig() const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user