From 662054871003aaa53d2775b2b4c8d9dd36ab162f Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Tue, 22 Mar 2022 13:59:37 +0100 Subject: [PATCH] fix: Use namespaced typenames/headers --- docs/Configuration.md | 10 ++++---- docs/Development.md | 2 +- docs/Device.md | 2 +- fairmq/DeviceRunner.h | 2 +- fairmq/MemoryResources.cxx | 12 +++++----- fairmq/ProgOptions.cxx | 5 ++-- fairmq/ofi/Context.cxx | 6 ++--- fairmq/ofi/Context.h | 8 +++---- fairmq/ofi/Message.cxx | 6 ++--- fairmq/ofi/Message.h | 8 +++---- fairmq/ofi/Socket.cxx | 6 ++--- fairmq/ofi/Socket.h | 6 ++--- fairmq/ofi/TransportFactory.h | 7 +++--- fairmq/runDevice.h | 4 ++-- fairmq/runFairMQDevice.h | 4 ++-- test/device/TestReceiver.h | 6 ++--- test/device/TestSender.h | 6 ++--- test/device/_version.cxx | 6 ++--- test/helper/devices/TestErrorState.h | 4 ++-- test/helper/devices/TestExceptions.h | 4 ++-- test/helper/devices/TestPairLeft.h | 4 ++-- test/helper/devices/TestPairRight.h | 4 ++-- test/helper/devices/TestPollOut.h | 8 +++---- test/helper/devices/TestPub.h | 14 +++++------ test/helper/devices/TestPull.h | 6 ++--- test/helper/devices/TestPush.h | 6 ++--- test/helper/devices/TestRep.h | 12 +++++----- test/helper/devices/TestReq.h | 8 +++---- test/helper/devices/TestSignals.h | 4 ++-- test/helper/devices/TestSub.h | 10 ++++---- test/helper/devices/TestWaitFor.h | 4 ++-- test/helper/runTestDevice.cxx | 36 ++++++++++++++-------------- 32 files changed, 114 insertions(+), 116 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 3346ef3d..733f0c66 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -16,11 +16,11 @@ Here is an overview of the device/channel options and when they are applied: | Property | Applied in | | --- | --- | -| `severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | -| `file-severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | -| `verbosity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | -| `color` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | -| `log-to-file` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | +| `severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | +| `file-severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | +| `verbosity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | +| `color` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | +| `log-to-file` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using ``)) | | `id` | at the end of `fair::mq::State::InitializingDevice` | | `io-threads` | at the end of `fair::mq::State::InitializingDevice` | | `transport` | at the end of `fair::mq::State::InitializingDevice` | diff --git a/docs/Development.md b/docs/Development.md index 44a09bd7..89d79d88 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -6,7 +6,7 @@ For unit testing it is often not feasible to boot up a full-blown distributed system with dozens of processes. -In some scenarios it is useful to not even instantiate a `FairMQDevice` at all. Please see [this example](../test/protocols/_push_pull_multipart.cxx) for single and multi threaded unit test without a device instance. If you store your transport factories and channels on the heap, pls make sure, you destroy the channels before you destroy the related transport factory for proper shutdown. Channels provide all the `Send/Receive` and `New*Message/New*Poller` APIs provided by the device too. +In some scenarios it is useful to not even instantiate a `fair::mq::Device` at all. Please see [this example](../test/protocols/_push_pull_multipart.cxx) for single and multi threaded unit test without a device instance. If you store your transport factories and channels on the heap, pls make sure, you destroy the channels before you destroy the related transport factory for proper shutdown. Channels provide all the `Send/Receive` and `New*Message/New*Poller` APIs provided by the device too. ## 4.2 Static Analysis diff --git a/docs/Device.md b/docs/Device.md index e0ce1c9c..6d9aefcd 100644 --- a/docs/Device.md +++ b/docs/Device.md @@ -2,7 +2,7 @@ # 1. Device -The components encapsulating the tasks are called **devices** and derive from the common base class `FairMQDevice`. FairMQ provides ready to use devices to organize the dataflow between the components (without touching the contents of a message), providing functionality like merging and splitting of the data stream (see subdirectory `devices`). +The components encapsulating the tasks are called **devices** and derive from the common base class `fair::mq::Device`. FairMQ provides ready to use devices to organize the dataflow between the components (without touching the contents of a message), providing functionality like merging and splitting of the data stream (see subdirectory `devices`). ## 1.1 Topology diff --git a/fairmq/DeviceRunner.h b/fairmq/DeviceRunner.h index 9e09aa6a..bdde7469 100644 --- a/fairmq/DeviceRunner.h +++ b/fairmq/DeviceRunner.h @@ -45,7 +45,7 @@ namespace fair::mq * Each hook has access to all members of the DeviceRunner and really only differs by the point in * time it is called. * - * For an example usage of this class see the fairmq/runFairMQDevice.h header. + * For an example usage of this class see the header. */ class DeviceRunner { diff --git a/fairmq/MemoryResources.cxx b/fairmq/MemoryResources.cxx index 1b571307..8bdfe758 100644 --- a/fairmq/MemoryResources.cxx +++ b/fairmq/MemoryResources.cxx @@ -1,10 +1,10 @@ /******************************************************************************** - * Copyright (C) 2018 CERN and copyright holders of ALICE O2 * - * Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018 CERN and copyright holders of ALICE O2 * + * Copyright (C) 2018-2022 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" * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * ********************************************************************************/ /// @brief Memory allocators and interfaces related to managing memory via the @@ -12,7 +12,7 @@ /// /// @author Mikolaj Krzewicki, mkrzewic@cern.ch -#include +#include #include void *fair::mq::ChannelResource::do_allocate(std::size_t bytes, std::size_t alignment) diff --git a/fairmq/ProgOptions.cxx b/fairmq/ProgOptions.cxx index b0e22b3f..a6282c4d 100644 --- a/fairmq/ProgOptions.cxx +++ b/fairmq/ProgOptions.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -12,9 +12,7 @@ * Created on March 11, 2015, 10:20 PM */ -#include "FairMQLogger.h" #include - #include #include @@ -22,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/fairmq/ofi/Context.cxx b/fairmq/ofi/Context.cxx index 44ef36b2..fd412b24 100644 --- a/fairmq/ofi/Context.cxx +++ b/fairmq/ofi/Context.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -24,8 +24,8 @@ namespace fair::mq::ofi using namespace std; -Context::Context(FairMQTransportFactory& sendFactory, - FairMQTransportFactory& receiveFactory, +Context::Context(mq::TransportFactory& sendFactory, + mq::TransportFactory& receiveFactory, int numberIoThreads) : fIoWork(fIoContext) , fReceiveFactory(receiveFactory) diff --git a/fairmq/ofi/Context.h b/fairmq/ofi/Context.h index 32cbc5fb..f9c8d884 100644 --- a/fairmq/ofi/Context.h +++ b/fairmq/ofi/Context.h @@ -51,8 +51,8 @@ struct Address { class Context { public: - Context(FairMQTransportFactory& sendFactory, - FairMQTransportFactory& receiveFactory, + Context(mq::TransportFactory& sendFactory, + mq::TransportFactory& receiveFactory, int numberIoThreads = 1); Context(const Context&) = delete; Context(Context&&) = delete; @@ -78,8 +78,8 @@ class Context asio::io_context fIoContext; asio::io_context::work fIoWork; std::vector fThreadPool; - FairMQTransportFactory& fReceiveFactory; - FairMQTransportFactory& fSendFactory; + mq::TransportFactory& fReceiveFactory; + mq::TransportFactory& fSendFactory; size_t fSizeHint; auto InitThreadPool(int numberIoThreads) -> void; diff --git a/fairmq/ofi/Message.cxx b/fairmq/ofi/Message.cxx index f754bf77..6f4b6e23 100644 --- a/fairmq/ofi/Message.cxx +++ b/fairmq/ofi/Message.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -69,7 +69,7 @@ Message::Message(pmr::memory_resource* pmr, const size_t size, Alignment /* alig Message::Message(pmr::memory_resource* pmr, void* data, const size_t size, - fairmq_free_fn* ffn, + FreeFn* ffn, void* hint) : fInitialSize(size) , fSize(size) @@ -137,7 +137,7 @@ auto Message::Rebuild(size_t size, Alignment /* alignment */) -> void Rebuild(size); } -auto Message::Rebuild(void* /*data*/, size_t size, fairmq_free_fn* ffn, void* hint) -> void +auto Message::Rebuild(void* /*data*/, size_t size, FreeFn* ffn, void* hint) -> void { if (fFreeFunction) { fFreeFunction(fData, fHint); diff --git a/fairmq/ofi/Message.h b/fairmq/ofi/Message.h index 20ab2613..9f47dd84 100644 --- a/fairmq/ofi/Message.h +++ b/fairmq/ofi/Message.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -37,7 +37,7 @@ class Message final : public fair::mq::Message Message(std::pmr::memory_resource* pmr, void* data, size_t size, - fairmq_free_fn* ffn, + FreeFn* ffn, void* hint = nullptr); Message(std::pmr::memory_resource* pmr, fair::mq::UnmanagedRegionPtr& region, @@ -54,7 +54,7 @@ class Message final : public fair::mq::Message auto Rebuild(Alignment alignment) -> void override; auto Rebuild(size_t size) -> void override; auto Rebuild(size_t size, Alignment alignment) -> void override; - auto Rebuild(void* data, size_t size, fairmq_free_fn* ffn, void* hint = nullptr) -> void override; + auto Rebuild(void* data, size_t size, FreeFn* ffn, void* hint = nullptr) -> void override; auto GetData() const -> void* override; auto GetSize() const -> size_t override; @@ -71,7 +71,7 @@ class Message final : public fair::mq::Message size_t fInitialSize; size_t fSize; void* fData; - fairmq_free_fn* fFreeFunction; + FreeFn* fFreeFunction; void* fHint; std::pmr::memory_resource* fPmr; }; /* class Message */ diff --git a/fairmq/ofi/Socket.cxx b/fairmq/ofi/Socket.cxx index c79e4bb8..5569b37b 100644 --- a/fairmq/ofi/Socket.cxx +++ b/fairmq/ofi/Socket.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -100,7 +100,7 @@ try { // TODO catch the correct ofi error catch (const SilentSocketError& e) { - // do not print error in this case, this is handled by FairMQDevice + // do not print error in this case, this is handled by fair::mq::Device // in case no connection could be established after trying a number of random ports from a range. return false; } @@ -189,7 +189,7 @@ try { } catch (const SilentSocketError& e) { - // do not print error in this case, this is handled by FairMQDevice + // do not print error in this case, this is handled by fair::mq::Device return false; } catch (const std::exception& e) diff --git a/fairmq/ofi/Socket.h b/fairmq/ofi/Socket.h index 444d9a84..7b36b0fc 100644 --- a/fairmq/ofi/Socket.h +++ b/fairmq/ofi/Socket.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -9,8 +9,8 @@ #ifndef FAIR_MQ_OFI_SOCKET_H #define FAIR_MQ_OFI_SOCKET_H -#include -#include +#include +#include #include #include diff --git a/fairmq/ofi/TransportFactory.h b/fairmq/ofi/TransportFactory.h index ecb88d0e..5656ce7d 100644 --- a/fairmq/ofi/TransportFactory.h +++ b/fairmq/ofi/TransportFactory.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -84,7 +83,7 @@ struct TransportFactory final : mq::TransportFactory return std::make_unique(&fMemoryResource, size); } - auto CreateMessage(void* data, std::size_t size, fairmq_free_fn* ffn, void* hint = nullptr) + auto CreateMessage(void* data, std::size_t size, FreeFn* ffn, void* hint = nullptr) -> std::unique_ptr override { return std::make_unique(&fMemoryResource, data, size, ffn, hint); @@ -117,7 +116,7 @@ struct TransportFactory final : mq::TransportFactory } auto CreatePoller( - std::unordered_map> const& /*channelsMap*/, + std::unordered_map> const& /*channelsMap*/, std::vector const& /*channelList*/) const -> std::unique_ptr override { diff --git a/fairmq/runDevice.h b/fairmq/runDevice.h index b6fa3514..34042729 100644 --- a/fairmq/runDevice.h +++ b/fairmq/runDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2017-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2017-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -10,7 +10,7 @@ #include #include -// to be implemented by the user to return a child class of FairMQDevice +// to be implemented by the user to return a child class of fair::mq::Device std::unique_ptr getDevice(fair::mq::ProgOptions& config); // to be implemented by the user to add custom command line options (or just with empty body) diff --git a/fairmq/runFairMQDevice.h b/fairmq/runFairMQDevice.h index b886aedb..5926e6e0 100644 --- a/fairmq/runFairMQDevice.h +++ b/fairmq/runFairMQDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2017-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -13,7 +13,7 @@ using FairMQDevicePtr = fair::mq::Device*; -// to be implemented by the user to return a child class of FairMQDevice +// to be implemented by the user to return a child class of fair::mq::Device FairMQDevicePtr getDevice(const fair::mq::ProgOptions& config); // to be implemented by the user to add custom command line options (or just with empty body) diff --git a/test/device/TestReceiver.h b/test/device/TestReceiver.h index 26918aba..3393f432 100644 --- a/test/device/TestReceiver.h +++ b/test/device/TestReceiver.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,7 @@ namespace fair::mq::test { -class Receiver : public FairMQDevice +class Receiver : public Device { public: Receiver(const std::string& channelName) @@ -33,7 +33,7 @@ class Receiver : public FairMQDevice auto Run() -> void override { - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); if (Receive(msg, fChannelName) >= 0) { LOG(info) << "received empty message"; } else { diff --git a/test/device/TestSender.h b/test/device/TestSender.h index 2f52842d..440ee9ec 100644 --- a/test/device/TestSender.h +++ b/test/device/TestSender.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,7 @@ namespace fair::mq::test { -class Sender : public FairMQDevice +class Sender : public Device { public: Sender(const std::string& channelName) @@ -33,7 +33,7 @@ class Sender : public FairMQDevice auto Run() -> void override { - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); if (Send(msg, fChannelName) >= 0) { LOG(info) << "sent empty message"; } else { diff --git a/test/device/_version.cxx b/test/device/_version.cxx index 6e54c6e3..9e71738d 100644 --- a/test/device/_version.cxx +++ b/test/device/_version.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -20,11 +20,11 @@ namespace using namespace std; -class TestVersion : public FairMQDevice +class TestVersion : public fair::mq::Device { public: TestVersion(fair::mq::tools::Version version) - : FairMQDevice(version) + : fair::mq::Device(version) {} }; diff --git a/test/helper/devices/TestErrorState.h b/test/helper/devices/TestErrorState.h index d848cb8b..1e0d428f 100644 --- a/test/helper/devices/TestErrorState.h +++ b/test/helper/devices/TestErrorState.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class ErrorState : public FairMQDevice +class ErrorState : public Device { public: void Init() override diff --git a/test/helper/devices/TestExceptions.h b/test/helper/devices/TestExceptions.h index 46a77f9c..106b88ac 100644 --- a/test/helper/devices/TestExceptions.h +++ b/test/helper/devices/TestExceptions.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,7 @@ namespace fair::mq::test { -class Exceptions : public FairMQDevice +class Exceptions : public Device { public: auto Init() -> void override diff --git a/test/helper/devices/TestPairLeft.h b/test/helper/devices/TestPairLeft.h index 05afa975..49202767 100644 --- a/test/helper/devices/TestPairLeft.h +++ b/test/helper/devices/TestPairLeft.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class PairLeft : public FairMQDevice +class PairLeft : public Device { protected: auto InitTask() -> void override diff --git a/test/helper/devices/TestPairRight.h b/test/helper/devices/TestPairRight.h index 2d3c5e8d..31e5ea02 100644 --- a/test/helper/devices/TestPairRight.h +++ b/test/helper/devices/TestPairRight.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class PairRight : public FairMQDevice +class PairRight : public Device { protected: auto InitTask() -> void override diff --git a/test/helper/devices/TestPollOut.h b/test/helper/devices/TestPollOut.h index 94a4af71..a8eaef5a 100644 --- a/test/helper/devices/TestPollOut.h +++ b/test/helper/devices/TestPollOut.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,7 @@ namespace fair::mq::test { -class PollOut : public FairMQDevice +class PollOut : public Device { protected: auto InitTask() -> void override @@ -25,8 +25,8 @@ class PollOut : public FairMQDevice auto Run() -> void override { - auto msg1 = FairMQMessagePtr{NewMessage()}; - auto msg2 = FairMQMessagePtr{NewMessage()}; + auto msg1 = NewMessage(); + auto msg2 = NewMessage(); Send(msg1, "data1"); Send(msg2, "data2"); }; diff --git a/test/helper/devices/TestPub.h b/test/helper/devices/TestPub.h index ee9c307f..4ae3ba94 100644 --- a/test/helper/devices/TestPub.h +++ b/test/helper/devices/TestPub.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class Pub : public FairMQDevice +class Pub : public Device { protected: auto InitTask() -> void override @@ -27,15 +27,15 @@ class Pub : public FairMQDevice auto Run() -> void override { - auto ready1 = FairMQMessagePtr{NewMessage()}; - auto ready2 = FairMQMessagePtr{NewMessage()}; + auto ready1 = NewMessage(); + auto ready2 = NewMessage(); auto r1 = Receive(ready1, "control"); auto r2 = Receive(ready2, "control"); if (r1 >= 0 && r2 >= 0) { LOG(info) << "Received both ready signals, proceeding to publish data"; - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); auto d1 = Send(msg, "data"); if (d1 >= 0) { @@ -46,8 +46,8 @@ class Pub : public FairMQDevice LOG(error) << "Failed sending data: d1 = " << d1; } - auto ack1 = FairMQMessagePtr{NewMessage()}; - auto ack2 = FairMQMessagePtr{NewMessage()}; + auto ack1 = NewMessage(); + auto ack2 = NewMessage(); auto a1 = Receive(ack1, "control"); auto a2 = Receive(ack2, "control"); if (a1 >= 0 && a2 >= 0) diff --git a/test/helper/devices/TestPull.h b/test/helper/devices/TestPull.h index 9417c7a5..93e81a78 100644 --- a/test/helper/devices/TestPull.h +++ b/test/helper/devices/TestPull.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,7 @@ namespace fair::mq::test using namespace std; -class Pull : public FairMQDevice +class Pull : public Device { protected: auto InitTask() -> void override @@ -28,7 +28,7 @@ class Pull : public FairMQDevice auto Run() -> void override { - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); if (Receive(msg, "data") >= 0) { diff --git a/test/helper/devices/TestPush.h b/test/helper/devices/TestPush.h index aac30a1b..5352360f 100644 --- a/test/helper/devices/TestPush.h +++ b/test/helper/devices/TestPush.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,7 @@ namespace fair::mq::test { -class Push : public FairMQDevice +class Push : public Device { protected: auto InitTask() -> void override @@ -25,7 +25,7 @@ class Push : public FairMQDevice auto Run() -> void override { - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); Send(msg, "data"); }; }; diff --git a/test/helper/devices/TestRep.h b/test/helper/devices/TestRep.h index aebd6566..781a17f7 100644 --- a/test/helper/devices/TestRep.h +++ b/test/helper/devices/TestRep.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,7 +16,7 @@ namespace fair::mq::test { -class Rep : public FairMQDevice +class Rep : public Device { protected: auto InitTask() -> void override @@ -26,16 +26,16 @@ class Rep : public FairMQDevice auto Run() -> void override { - auto request1 = FairMQMessagePtr{NewMessage()}; + auto request1 = NewMessage(); if (Receive(request1, "data") >= 0) { LOG(info) << "Received request 1"; - auto reply = FairMQMessagePtr{NewMessage()}; + auto reply = NewMessage(); Send(reply, "data"); } - auto request2 = FairMQMessagePtr{NewMessage()}; + auto request2 = NewMessage(); if (Receive(request2, "data") >= 0) { LOG(info) << "Received request 2"; - auto reply = FairMQMessagePtr{NewMessage()}; + auto reply = NewMessage(); Send(reply, "data"); } diff --git a/test/helper/devices/TestReq.h b/test/helper/devices/TestReq.h index 9846a600..a4b9ec50 100644 --- a/test/helper/devices/TestReq.h +++ b/test/helper/devices/TestReq.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,7 +16,7 @@ namespace fair::mq::test { -class Req : public FairMQDevice +class Req : public Device { protected: auto InitTask() -> void override @@ -26,10 +26,10 @@ class Req : public FairMQDevice auto Run() -> void override { - auto request = FairMQMessagePtr{NewMessage()}; + auto request = NewMessage(); Send(request, "data"); - auto reply = FairMQMessagePtr{NewMessage()}; + auto reply = NewMessage(); if (Receive(reply, "data") >= 0) { LOG(info) << "received reply"; } diff --git a/test/helper/devices/TestSignals.h b/test/helper/devices/TestSignals.h index 4f3e7729..d951ecc6 100644 --- a/test/helper/devices/TestSignals.h +++ b/test/helper/devices/TestSignals.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2018-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,7 @@ namespace fair::mq::test { -class Signals : public FairMQDevice +class Signals : public Device { public: void Init() override diff --git a/test/helper/devices/TestSub.h b/test/helper/devices/TestSub.h index 47c395ef..4d248b3f 100644 --- a/test/helper/devices/TestSub.h +++ b/test/helper/devices/TestSub.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class Sub : public FairMQDevice +class Sub : public Device { protected: auto InitTask() -> void override @@ -27,17 +27,17 @@ class Sub : public FairMQDevice auto Run() -> void override { - auto ready = FairMQMessagePtr{NewMessage()}; + auto ready = NewMessage(); auto r1 = Send(ready, "control"); if (r1 >= 0) { LOG(info) << "Sent first control signal"; - auto msg = FairMQMessagePtr{NewMessage()}; + auto msg = NewMessage(); auto d1 = Receive(msg, "data"); if (d1 >= 0) { LOG(info) << "Received data"; - auto ack = FairMQMessagePtr{NewMessage()}; + auto ack = NewMessage(); auto a1 = Send(ack, "control"); if (a1 >= 0) { diff --git a/test/helper/devices/TestWaitFor.h b/test/helper/devices/TestWaitFor.h index 9f272c39..d4cdcc09 100644 --- a/test/helper/devices/TestWaitFor.h +++ b/test/helper/devices/TestWaitFor.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,7 +17,7 @@ namespace fair::mq::test { -class TestWaitFor : public FairMQDevice +class TestWaitFor : public Device { public: void PreRun() override diff --git a/test/helper/runTestDevice.cxx b/test/helper/runTestDevice.cxx index 067fe095..e94300b2 100644 --- a/test/helper/runTestDevice.cxx +++ b/test/helper/runTestDevice.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -22,7 +22,7 @@ #include "devices/TestErrorState.h" #include "devices/TestSignals.h" -#include +#include #include #include @@ -36,7 +36,7 @@ auto addCustomOptions(bpo::options_description& options) -> void ("poll-type", bpo::value()->default_value(0), "Poll type switch(0 - vector of (sub-)channels, 1 - vector of channel names)"); } -auto getDevice(const fair::mq::ProgOptions& config) -> FairMQDevicePtr +auto getDevice(fair::mq::ProgOptions& config) -> std::unique_ptr { using namespace std; using namespace fair::mq::test; @@ -44,35 +44,35 @@ auto getDevice(const fair::mq::ProgOptions& config) -> FairMQDevicePtr auto id = config.GetProperty("id"); if (0 == id.find("pull_")) { - return new Pull; + return std::make_unique(); } else if (0 == id.find("push_")) { - return new Push; + return std::make_unique(); } else if (0 == id.find("sub_")) { - return new Sub; + return std::make_unique(); } else if (0 == id.find("pub_")) { - return new Pub; + return std::make_unique(); } else if (0 == id.find("req_")) { - return new Req; + return std::make_unique(); } else if (0 == id.find("rep_")) { - return new Rep; + return std::make_unique(); } else if (0 == id.find("transfer_timeout_")) { - return new TransferTimeout; + return std::make_unique(); } else if (0 == id.find("pollout_")) { - return new PollOut; + return std::make_unique(); } else if (0 == id.find("pollin_")) { - return new PollIn; + return std::make_unique(); } else if (0 == id.find("pairleft_")) { - return new PairLeft; + return std::make_unique(); } else if (0 == id.find("pairright_")) { - return new PairRight; + return std::make_unique(); } else if (0 == id.find("waitfor_")) { - return new TestWaitFor; + return std::make_unique(); } else if (0 == id.find("exceptions_")) { - return new Exceptions; + return std::make_unique(); } else if (0 == id.find("error_state_")) { - return new ErrorState; + return std::make_unique(); } else if (0 == id.find("signals_")) { - return new Signals; + return std::make_unique(); } else { cerr << "Don't know id '" << id << "'" << endl; return nullptr;