Skip to content

Commit

Permalink
fix: Use namespaced typenames/headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisklein committed Aug 11, 2022
1 parent 0959095 commit 12a85c6
Show file tree
Hide file tree
Showing 32 changed files with 114 additions and 116 deletions.
10 changes: 5 additions & 5 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
2 changes: 1 addition & 1 deletion docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/Device.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion fairmq/DeviceRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions fairmq/MemoryResources.cxx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/********************************************************************************
* 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
/// trasport layer
///
/// @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)
Expand Down
5 changes: 2 additions & 3 deletions fairmq/ProgOptions.cxx
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -12,16 +12,15 @@
* Created on March 11, 2015, 10:20 PM
*/

#include "FairMQLogger.h"
#include <fairmq/ProgOptions.h>

#include <fairmq/tools/Strings.h>

#include <boost/any.hpp>
#include <boost/regex.hpp>

#include <algorithm>
#include <exception>
#include <fairlogger/Logger.h>
#include <iomanip>
#include <iostream>
#include <sstream>
Expand Down
6 changes: 3 additions & 3 deletions fairmq/ofi/Context.cxx
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions fairmq/ofi/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions fairmq/ofi/Message.cxx
Original file line number Diff line number Diff line change
@@ -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, *
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions fairmq/ofi/Message.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions fairmq/ofi/Socket.cxx
Original file line number Diff line number Diff line change
@@ -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, *
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions fairmq/ofi/Socket.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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>

Expand Down
7 changes: 3 additions & 4 deletions fairmq/ofi/TransportFactory.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions fairmq/runDevice.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions fairmq/runFairMQDevice.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions test/device/TestReceiver.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -18,7 +18,7 @@
namespace fair::mq::test
{

class Receiver : public FairMQDevice
class Receiver : public Device
{
public:
Receiver(const std::string& channelName)
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions test/device/TestSender.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -18,7 +18,7 @@
namespace fair::mq::test
{

class Sender : public FairMQDevice
class Sender : public Device
{
public:
Sender(const std::string& channelName)
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions test/device/_version.cxx
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -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)
{}
};

Expand Down
4 changes: 2 additions & 2 deletions test/helper/devices/TestErrorState.h
Original file line number Diff line number Diff line change
@@ -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, *
Expand All @@ -17,7 +17,7 @@
namespace fair::mq::test
{

class ErrorState : public FairMQDevice
class ErrorState : public Device
{
public:
void Init() override
Expand Down
Loading

0 comments on commit 12a85c6

Please sign in to comment.