FairMQ: Remove deprecated TransportFactory factory method

This commit is contained in:
Dennis Klein 2018-02-14 16:35:55 +01:00 committed by Mohammad Al-Turany
parent 7cfd93c998
commit 9b7841e89e
11 changed files with 71 additions and 124 deletions

View File

@ -75,8 +75,8 @@ set(FAIRMQ_HEADER_FILES
FairMQSocket.h FairMQSocket.h
FairMQStateMachine.h FairMQStateMachine.h
FairMQTransportFactory.h FairMQTransportFactory.h
FairMQTransports.h
Tools.h Tools.h
Transports.h
devices/FairMQBenchmarkSampler.h devices/FairMQBenchmarkSampler.h
devices/FairMQMerger.h devices/FairMQMerger.h
devices/FairMQMultiplier.h devices/FairMQMultiplier.h

View File

@ -1,16 +1,10 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
/**
* FairMQChannel.h
*
* @since 2015-06-02
* @author A. Rybalchenko
*/
#ifndef FAIRMQCHANNEL_H_ #ifndef FAIRMQCHANNEL_H_
#define FAIRMQCHANNEL_H_ #define FAIRMQCHANNEL_H_
@ -21,12 +15,12 @@
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>
#include "FairMQTransportFactory.h" #include <FairMQTransportFactory.h>
#include "FairMQSocket.h" #include <FairMQSocket.h>
#include "FairMQPoller.h" #include <FairMQPoller.h>
#include "FairMQTransports.h" #include <fairmq/Transports.h>
#include "FairMQLogger.h" #include <FairMQLogger.h>
#include "FairMQParts.h" #include <FairMQParts.h>
class FairMQChannel class FairMQChannel
{ {

View File

@ -1,11 +1,25 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2012-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2012-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
#include <FairMQSocket.h>
#include <FairMQDevice.h>
#include <FairMQLogger.h>
#include <options/FairMQProgOptions.h>
#include <fairmq/Tools.h>
#include <fairmq/Transports.h>
#include <boost/algorithm/string.hpp> // join/split
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <list> #include <list>
#include <cstdlib> #include <cstdlib>
#include <stdexcept> #include <stdexcept>
@ -14,24 +28,7 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <functional> #include <functional>
#include <sstream>
#include <boost/algorithm/string.hpp> // join/split
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include "FairMQSocket.h"
#include "FairMQDevice.h"
#include "FairMQLogger.h"
#include <fairmq/Tools.h>
#include "options/FairMQProgOptions.h"
#include "zeromq/FairMQTransportFactoryZMQ.h"
#include "shmem/FairMQTransportFactorySHM.h"
#ifdef NANOMSG_FOUND
#include "nanomsg/FairMQTransportFactoryNN.h"
#endif
using namespace std; using namespace std;
@ -804,39 +801,6 @@ shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& tran
} }
} }
unique_ptr<FairMQTransportFactory> FairMQDevice::MakeTransport(const string& transport)
{
unique_ptr<FairMQTransportFactory> tr;
if (transport == "zeromq")
{
tr = fair::mq::tools::make_unique<FairMQTransportFactoryZMQ>();
}
else if (transport == "shmem")
{
tr = fair::mq::tools::make_unique<FairMQTransportFactorySHM>();
}
#ifdef NANOMSG_FOUND
else if (transport == "nanomsg")
{
tr = fair::mq::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;
}
return tr;
}
void FairMQDevice::CreateOwnConfig() void FairMQDevice::CreateOwnConfig()
{ {
// TODO: make fConfig a shared_ptr when no old user code has FairMQProgOptions ptr* // TODO: make fConfig a shared_ptr when no old user code has FairMQProgOptions ptr*

View File

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2012-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2012-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
@ -9,16 +9,15 @@
#ifndef FAIRMQDEVICE_H_ #ifndef FAIRMQDEVICE_H_
#define FAIRMQDEVICE_H_ #define FAIRMQDEVICE_H_
#include "FairMQStateMachine.h" #include <FairMQStateMachine.h>
#include "FairMQTransportFactory.h" #include <FairMQTransportFactory.h>
#include "FairMQTransports.h" #include <fairmq/Transports.h>
#include "FairMQSocket.h" #include <FairMQSocket.h>
#include "FairMQChannel.h" #include <FairMQChannel.h>
#include "FairMQMessage.h" #include <FairMQMessage.h>
#include "FairMQParts.h" #include <FairMQParts.h>
#include "FairMQUnmanagedRegion.h" #include <FairMQUnmanagedRegion.h>
#include "options/FairMQProgOptions.h"
#include <vector> #include <vector>
#include <memory> // unique_ptr #include <memory> // unique_ptr
@ -297,10 +296,6 @@ class FairMQDevice : public FairMQStateMachine
/// @param transport Transport string ("zeromq"/"nanomsg"/"shmem") /// @param transport Transport string ("zeromq"/"nanomsg"/"shmem")
void SetTransport(const std::string& transport = "zeromq"); 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) __attribute__((deprecated("Use 'static auto FairMQTransportFactory::CreateTransportFactory() -> std::shared_ptr<FairMQTransportFactory>' from <FairMQTransportFactory.h> instead.")));
void SetConfig(FairMQProgOptions& config); void SetConfig(FairMQProgOptions& config);
const FairMQProgOptions* GetConfig() const const FairMQProgOptions* GetConfig() const
{ {

View File

@ -1,16 +1,10 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
/**
* FairMQMessage.h
*
* @since 2012-12-05
* @author D. Klein, A. Rybalchenko
*/
#ifndef FAIRMQMESSAGE_H_ #ifndef FAIRMQMESSAGE_H_
#define FAIRMQMESSAGE_H_ #define FAIRMQMESSAGE_H_
@ -18,7 +12,7 @@
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory> // unique_ptr #include <memory> // unique_ptr
#include "FairMQTransports.h" #include <fairmq/Transports.h>
using fairmq_free_fn = void(void* data, void* hint); using fairmq_free_fn = void(void* data, void* hint);

View File

@ -1,16 +1,10 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
/**
* FairMQPoller.h
*
* @since 2014-01-23
* @author A. Rybalchenko
*/
#ifndef FAIRMQPOLLER_H_ #ifndef FAIRMQPOLLER_H_
#define FAIRMQPOLLER_H_ #define FAIRMQPOLLER_H_

View File

@ -1,16 +1,10 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
/**
* FairMQSocket.h
*
* @since 2012-12-05
* @author D. Klein, A. Rybalchenko
*/
#ifndef FAIRMQSOCKET_H_ #ifndef FAIRMQSOCKET_H_
#define FAIRMQSOCKET_H_ #define FAIRMQSOCKET_H_

View File

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2017-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
@ -12,6 +12,7 @@
#ifdef NANOMSG_FOUND #ifdef NANOMSG_FOUND
#include <nanomsg/FairMQTransportFactoryNN.h> #include <nanomsg/FairMQTransportFactoryNN.h>
#endif /* NANOMSG_FOUND */ #endif /* NANOMSG_FOUND */
#include <fairmq/ofi/TransportFactory.h>
#include <FairMQLogger.h> #include <FairMQLogger.h>
#include <fairmq/Tools.h> #include <fairmq/Tools.h>
@ -38,18 +39,22 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con
if (type == "zeromq") if (type == "zeromq")
{ {
return std::make_shared<FairMQTransportFactoryZMQ>(finalId, config); return make_shared<FairMQTransportFactoryZMQ>(finalId, config);
} }
else if (type == "shmem") else if (type == "shmem")
{ {
return std::make_shared<FairMQTransportFactorySHM>(finalId, config); return make_shared<FairMQTransportFactorySHM>(finalId, config);
} }
#ifdef NANOMSG_FOUND #ifdef NANOMSG_FOUND
else if (type == "nanomsg") else if (type == "nanomsg")
{ {
return std::make_shared<FairMQTransportFactoryNN>(finalId, config); return make_shared<FairMQTransportFactoryNN>(finalId, config);
} }
#endif /* NANOMSG_FOUND */ #endif /* NANOMSG_FOUND */
else if (type == "ofi")
{
return make_shared<fair::mq::ofi::TransportFactory>(finalId, config);
}
else else
{ {
LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: " LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: "
@ -58,6 +63,7 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con
#ifdef NANOMSG_FOUND #ifdef NANOMSG_FOUND
<< ", \"nanomsg\"" << ", \"nanomsg\""
#endif /* NANOMSG_FOUND */ #endif /* NANOMSG_FOUND */
<< ", and \"ofi\""
<< ". Exiting."; << ". Exiting.";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (C) 2014-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* * * *
* This software is distributed under the terms of the * * This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
@ -9,12 +9,12 @@
#ifndef FAIRMQTRANSPORTFACTORY_H_ #ifndef FAIRMQTRANSPORTFACTORY_H_
#define FAIRMQTRANSPORTFACTORY_H_ #define FAIRMQTRANSPORTFACTORY_H_
#include "FairMQMessage.h" #include <FairMQMessage.h>
#include "FairMQSocket.h" #include <FairMQSocket.h>
#include "FairMQPoller.h" #include <FairMQPoller.h>
#include "FairMQUnmanagedRegion.h" #include <FairMQUnmanagedRegion.h>
#include "FairMQLogger.h" #include <FairMQLogger.h>
#include "FairMQTransports.h" #include <fairmq/Transports.h>
#include <string> #include <string>
#include <memory> #include <memory>

View File

@ -10,6 +10,8 @@
#define FAIR_MQ_TRANSPORTS_H #define FAIR_MQ_TRANSPORTS_H
#include <fairmq/Tools.h> #include <fairmq/Tools.h>
#include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@ -21,7 +23,9 @@ enum class Transport
{ {
DEFAULT, DEFAULT,
ZMQ, ZMQ,
#ifdef NANOMSG_FOUND
NN, NN,
#endif
SHM, SHM,
OFI OFI
}; };
@ -30,7 +34,9 @@ enum class Transport
static std::unordered_map<std::string, Transport> TransportTypes { static std::unordered_map<std::string, Transport> TransportTypes {
{ "default", Transport::DEFAULT }, { "default", Transport::DEFAULT },
{ "zeromq", Transport::ZMQ }, { "zeromq", Transport::ZMQ },
#ifdef NANOMSG_FOUND
{ "nanomsg", Transport::NN }, { "nanomsg", Transport::NN },
#endif
{ "shmem", Transport::SHM }, { "shmem", Transport::SHM },
{ "ofi", Transport::OFI } { "ofi", Transport::OFI }
}; };