From 9b7841e89ea4c5ebbbff6113aeabc7ccc9791401 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Wed, 14 Feb 2018 16:35:55 +0100 Subject: [PATCH] FairMQ: Remove deprecated TransportFactory factory method --- fairmq/CMakeLists.txt | 2 +- fairmq/FairMQChannel.h | 20 +++--- fairmq/FairMQDevice.cxx | 68 +++++---------------- fairmq/FairMQDevice.h | 23 +++---- fairmq/FairMQMessage.h | 10 +-- fairmq/FairMQPoller.h | 8 +-- fairmq/FairMQSocket.h | 8 +-- fairmq/FairMQTransportFactory.cxx | 14 +++-- fairmq/FairMQTransportFactory.h | 14 ++--- fairmq/{FairMQTransports.h => Transports.h} | 6 ++ fairmq/ofi/TransportFactory.cxx | 22 +++---- 11 files changed, 71 insertions(+), 124 deletions(-) rename fairmq/{FairMQTransports.h => Transports.h} (94%) diff --git a/fairmq/CMakeLists.txt b/fairmq/CMakeLists.txt index 9e7854dc..5abfe175 100644 --- a/fairmq/CMakeLists.txt +++ b/fairmq/CMakeLists.txt @@ -75,8 +75,8 @@ set(FAIRMQ_HEADER_FILES FairMQSocket.h FairMQStateMachine.h FairMQTransportFactory.h - FairMQTransports.h Tools.h + Transports.h devices/FairMQBenchmarkSampler.h devices/FairMQMerger.h devices/FairMQMultiplier.h diff --git a/fairmq/FairMQChannel.h b/fairmq/FairMQChannel.h index 746a9a90..192bd267 100644 --- a/fairmq/FairMQChannel.h +++ b/fairmq/FairMQChannel.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -/** - * FairMQChannel.h - * - * @since 2015-06-02 - * @author A. Rybalchenko - */ #ifndef FAIRMQCHANNEL_H_ #define FAIRMQCHANNEL_H_ @@ -21,12 +15,12 @@ #include #include -#include "FairMQTransportFactory.h" -#include "FairMQSocket.h" -#include "FairMQPoller.h" -#include "FairMQTransports.h" -#include "FairMQLogger.h" -#include "FairMQParts.h" +#include +#include +#include +#include +#include +#include class FairMQChannel { diff --git a/fairmq/FairMQDevice.cxx b/fairmq/FairMQDevice.cxx index 933c9d3f..38a2f2ae 100644 --- a/fairmq/FairMQDevice.cxx +++ b/fairmq/FairMQDevice.cxx @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include +#include +#include +#include + +#include +#include + +#include // join/split + +#include +#include +#include + #include #include #include @@ -14,24 +28,7 @@ #include #include #include - -#include // join/split - -#include -#include -#include - -#include "FairMQSocket.h" -#include "FairMQDevice.h" -#include "FairMQLogger.h" -#include - -#include "options/FairMQProgOptions.h" -#include "zeromq/FairMQTransportFactoryZMQ.h" -#include "shmem/FairMQTransportFactorySHM.h" -#ifdef NANOMSG_FOUND -#include "nanomsg/FairMQTransportFactoryNN.h" -#endif +#include using namespace std; @@ -804,39 +801,6 @@ shared_ptr FairMQDevice::AddTransport(const string& tran } } -unique_ptr FairMQDevice::MakeTransport(const string& transport) -{ - unique_ptr tr; - - if (transport == "zeromq") - { - tr = fair::mq::tools::make_unique(); - } - else if (transport == "shmem") - { - tr = fair::mq::tools::make_unique(); - } -#ifdef NANOMSG_FOUND - else if (transport == "nanomsg") - { - tr = fair::mq::tools::make_unique(); - } -#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() { // TODO: make fConfig a shared_ptr when no old user code has FairMQProgOptions ptr* diff --git a/fairmq/FairMQDevice.h b/fairmq/FairMQDevice.h index 26ec0a5b..dcefb31d 100644 --- a/fairmq/FairMQDevice.h +++ b/fairmq/FairMQDevice.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -9,16 +9,15 @@ #ifndef FAIRMQDEVICE_H_ #define FAIRMQDEVICE_H_ -#include "FairMQStateMachine.h" -#include "FairMQTransportFactory.h" -#include "FairMQTransports.h" +#include +#include +#include -#include "FairMQSocket.h" -#include "FairMQChannel.h" -#include "FairMQMessage.h" -#include "FairMQParts.h" -#include "FairMQUnmanagedRegion.h" -#include "options/FairMQProgOptions.h" +#include +#include +#include +#include +#include #include #include // unique_ptr @@ -297,10 +296,6 @@ class FairMQDevice : public FairMQStateMachine /// @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 MakeTransport(const std::string& transport) __attribute__((deprecated("Use 'static auto FairMQTransportFactory::CreateTransportFactory() -> std::shared_ptr' from instead."))); - void SetConfig(FairMQProgOptions& config); const FairMQProgOptions* GetConfig() const { diff --git a/fairmq/FairMQMessage.h b/fairmq/FairMQMessage.h index 70887740..d0b0a70a 100644 --- a/fairmq/FairMQMessage.h +++ b/fairmq/FairMQMessage.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -/** - * FairMQMessage.h - * - * @since 2012-12-05 - * @author D. Klein, A. Rybalchenko - */ #ifndef FAIRMQMESSAGE_H_ #define FAIRMQMESSAGE_H_ @@ -18,7 +12,7 @@ #include // for size_t #include // unique_ptr -#include "FairMQTransports.h" +#include using fairmq_free_fn = void(void* data, void* hint); diff --git a/fairmq/FairMQPoller.h b/fairmq/FairMQPoller.h index 436d5be5..a78f1e94 100644 --- a/fairmq/FairMQPoller.h +++ b/fairmq/FairMQPoller.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -/** - * FairMQPoller.h - * - * @since 2014-01-23 - * @author A. Rybalchenko - */ #ifndef FAIRMQPOLLER_H_ #define FAIRMQPOLLER_H_ diff --git a/fairmq/FairMQSocket.h b/fairmq/FairMQSocket.h index 87ed5731..e79c92f4 100644 --- a/fairmq/FairMQSocket.h +++ b/fairmq/FairMQSocket.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -/** - * FairMQSocket.h - * - * @since 2012-12-05 - * @author D. Klein, A. Rybalchenko - */ #ifndef FAIRMQSOCKET_H_ #define FAIRMQSOCKET_H_ diff --git a/fairmq/FairMQTransportFactory.cxx b/fairmq/FairMQTransportFactory.cxx index 01a5f912..b81ca56d 100644 --- a/fairmq/FairMQTransportFactory.cxx +++ b/fairmq/FairMQTransportFactory.cxx @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -12,6 +12,7 @@ #ifdef NANOMSG_FOUND #include #endif /* NANOMSG_FOUND */ +#include #include #include @@ -38,18 +39,22 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con if (type == "zeromq") { - return std::make_shared(finalId, config); + return make_shared(finalId, config); } else if (type == "shmem") { - return std::make_shared(finalId, config); + return make_shared(finalId, config); } #ifdef NANOMSG_FOUND else if (type == "nanomsg") { - return std::make_shared(finalId, config); + return make_shared(finalId, config); } #endif /* NANOMSG_FOUND */ + else if (type == "ofi") + { + return make_shared(finalId, config); + } else { LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: " @@ -58,6 +63,7 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con #ifdef NANOMSG_FOUND << ", \"nanomsg\"" #endif /* NANOMSG_FOUND */ + << ", and \"ofi\"" << ". Exiting."; exit(EXIT_FAILURE); } diff --git a/fairmq/FairMQTransportFactory.h b/fairmq/FairMQTransportFactory.h index 0b6ea596..309fa65d 100644 --- a/fairmq/FairMQTransportFactory.h +++ b/fairmq/FairMQTransportFactory.h @@ -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 * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -9,12 +9,12 @@ #ifndef FAIRMQTRANSPORTFACTORY_H_ #define FAIRMQTRANSPORTFACTORY_H_ -#include "FairMQMessage.h" -#include "FairMQSocket.h" -#include "FairMQPoller.h" -#include "FairMQUnmanagedRegion.h" -#include "FairMQLogger.h" -#include "FairMQTransports.h" +#include +#include +#include +#include +#include +#include #include #include diff --git a/fairmq/FairMQTransports.h b/fairmq/Transports.h similarity index 94% rename from fairmq/FairMQTransports.h rename to fairmq/Transports.h index c664a7f7..0d56b508 100644 --- a/fairmq/FairMQTransports.h +++ b/fairmq/Transports.h @@ -10,6 +10,8 @@ #define FAIR_MQ_TRANSPORTS_H #include + +#include #include #include @@ -21,7 +23,9 @@ enum class Transport { DEFAULT, ZMQ, +#ifdef NANOMSG_FOUND NN, +#endif SHM, OFI }; @@ -30,7 +34,9 @@ enum class Transport static std::unordered_map TransportTypes { { "default", Transport::DEFAULT }, { "zeromq", Transport::ZMQ }, +#ifdef NANOMSG_FOUND { "nanomsg", Transport::NN }, +#endif { "shmem", Transport::SHM }, { "ofi", Transport::OFI } }; diff --git a/fairmq/ofi/TransportFactory.cxx b/fairmq/ofi/TransportFactory.cxx index ce34700a..8ed410d5 100644 --- a/fairmq/ofi/TransportFactory.cxx +++ b/fairmq/ofi/TransportFactory.cxx @@ -25,57 +25,57 @@ TransportFactory::TransportFactory(const string& id, const FairMQProgOptions* co auto TransportFactory::CreateMessage() const -> MessagePtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreateMessage(const size_t size) const -> MessagePtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreateMessage(void* data, const size_t size, fairmq_free_fn* ffn, void* hint) const -> MessagePtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreateMessage(UnmanagedRegionPtr& region, void* data, const size_t size, void* hint) const -> MessagePtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreateSocket(const string& type, const string& name) const -> SocketPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreatePoller(const vector& channels) const -> PollerPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreatePoller(const vector& channels) const -> PollerPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreatePoller(const unordered_map>& channelsMap, const vector& channelList) const -> PollerPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreatePoller(const FairMQSocket& cmdSocket, const FairMQSocket& dataSocket) const -> PollerPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::CreateUnmanagedRegion(const size_t size, FairMQRegionCallback callback) const -> UnmanagedRegionPtr { - throw runtime_error{"Not yet implemented."}; + throw runtime_error{"Not yet implemented."}; } auto TransportFactory::GetType() const -> Transport { - return Transport::OFI; + return Transport::OFI; } TransportFactory::~TransportFactory()