mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
fix: Use namespaced typenames/headers
This commit is contained in:
parent
0959095a39
commit
12a85c6fb1
|
@ -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 `<runFairMQDevice.h>`)) |
|
||||
| `file-severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<runFairMQDevice.h>`)) |
|
||||
| `verbosity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<runFairMQDevice.h>`)) |
|
||||
| `color` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<runFairMQDevice.h>`)) |
|
||||
| `log-to-file` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<runFairMQDevice.h>`)) |
|
||||
| `severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<fairmq/runDevice.h>`)) |
|
||||
| `file-severity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<fairmq/runDevice.h>`)) |
|
||||
| `verbosity` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<fairmq/runDevice.h>`)) |
|
||||
| `color` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<fairmq/runDevice.h>`)) |
|
||||
| `log-to-file` | immidiately (if `fair::mq::DeviceRunner` is used (also the case when using `<fairmq/runDevice.h>`)) |
|
||||
| `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` |
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <fairmq/runDevice.h> header.
|
||||
*/
|
||||
class DeviceRunner
|
||||
{
|
||||
|
|
|
@ -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 <fairmq/FairMQTransportFactory.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/MemoryResources.h>
|
||||
|
||||
void *fair::mq::ChannelResource::do_allocate(std::size_t bytes, std::size_t alignment)
|
||||
|
|
|
@ -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 <fairmq/ProgOptions.h>
|
||||
|
||||
#include <fairmq/tools/Strings.h>
|
||||
|
||||
#include <boost/any.hpp>
|
||||
|
@ -22,6 +20,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<std::thread> fThreadPool;
|
||||
FairMQTransportFactory& fReceiveFactory;
|
||||
FairMQTransportFactory& fSendFactory;
|
||||
mq::TransportFactory& fReceiveFactory;
|
||||
mq::TransportFactory& fSendFactory;
|
||||
size_t fSizeHint;
|
||||
|
||||
auto InitThreadPool(int numberIoThreads) -> void;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 <FairMQSocket.h>
|
||||
#include <FairMQMessage.h>
|
||||
#include <fairmq/Message.h>
|
||||
#include <fairmq/Socket.h>
|
||||
#include <fairmq/ofi/Context.h>
|
||||
#include <fairmq/ofi/ControlMessages.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 <fairmq/ofi/Context.h>
|
||||
#include <fairmq/ofi/Message.h>
|
||||
#include <fairmq/ofi/Socket.h>
|
||||
#include <fairmq/ofi/TransportFactory.h>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
@ -84,7 +83,7 @@ struct TransportFactory final : mq::TransportFactory
|
|||
return std::make_unique<Message>(&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<mq::Message> override
|
||||
{
|
||||
return std::make_unique<Message>(&fMemoryResource, data, size, ffn, hint);
|
||||
|
@ -117,7 +116,7 @@ struct TransportFactory final : mq::TransportFactory
|
|||
}
|
||||
|
||||
auto CreatePoller(
|
||||
std::unordered_map<std::string, std::vector<FairMQChannel>> const& /*channelsMap*/,
|
||||
std::unordered_map<std::string, std::vector<Channel>> const& /*channelsMap*/,
|
||||
std::vector<std::string> const& /*channelList*/) const
|
||||
-> std::unique_ptr<mq::Poller> override
|
||||
{
|
||||
|
|
|
@ -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 <boost/program_options.hpp>
|
||||
#include <memory>
|
||||
|
||||
// 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<fair::mq::Device> getDevice(fair::mq::ProgOptions& config);
|
||||
|
||||
// to be implemented by the user to add custom command line options (or just with empty body)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <runFairMQDevice.h>
|
||||
#include <fairmq/runDevice.h>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
|
@ -36,7 +36,7 @@ auto addCustomOptions(bpo::options_description& options) -> void
|
|||
("poll-type", bpo::value<int>()->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<fair::mq::Device>
|
||||
{
|
||||
using namespace std;
|
||||
using namespace fair::mq::test;
|
||||
|
@ -44,35 +44,35 @@ auto getDevice(const fair::mq::ProgOptions& config) -> FairMQDevicePtr
|
|||
auto id = config.GetProperty<std::string>("id");
|
||||
|
||||
if (0 == id.find("pull_")) {
|
||||
return new Pull;
|
||||
return std::make_unique<Pull>();
|
||||
} else if (0 == id.find("push_")) {
|
||||
return new Push;
|
||||
return std::make_unique<Push>();
|
||||
} else if (0 == id.find("sub_")) {
|
||||
return new Sub;
|
||||
return std::make_unique<Sub>();
|
||||
} else if (0 == id.find("pub_")) {
|
||||
return new Pub;
|
||||
return std::make_unique<Pub>();
|
||||
} else if (0 == id.find("req_")) {
|
||||
return new Req;
|
||||
return std::make_unique<Req>();
|
||||
} else if (0 == id.find("rep_")) {
|
||||
return new Rep;
|
||||
return std::make_unique<Rep>();
|
||||
} else if (0 == id.find("transfer_timeout_")) {
|
||||
return new TransferTimeout;
|
||||
return std::make_unique<TransferTimeout>();
|
||||
} else if (0 == id.find("pollout_")) {
|
||||
return new PollOut;
|
||||
return std::make_unique<PollOut>();
|
||||
} else if (0 == id.find("pollin_")) {
|
||||
return new PollIn;
|
||||
return std::make_unique<PollIn>();
|
||||
} else if (0 == id.find("pairleft_")) {
|
||||
return new PairLeft;
|
||||
return std::make_unique<PairLeft>();
|
||||
} else if (0 == id.find("pairright_")) {
|
||||
return new PairRight;
|
||||
return std::make_unique<PairRight>();
|
||||
} else if (0 == id.find("waitfor_")) {
|
||||
return new TestWaitFor;
|
||||
return std::make_unique<TestWaitFor>();
|
||||
} else if (0 == id.find("exceptions_")) {
|
||||
return new Exceptions;
|
||||
return std::make_unique<Exceptions>();
|
||||
} else if (0 == id.find("error_state_")) {
|
||||
return new ErrorState;
|
||||
return std::make_unique<ErrorState>();
|
||||
} else if (0 == id.find("signals_")) {
|
||||
return new Signals;
|
||||
return std::make_unique<Signals>();
|
||||
} else {
|
||||
cerr << "Don't know id '" << id << "'" << endl;
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user