# FairMQ: fairmq/sdk/AsioBase.h Source File

AsioBase.h
/********************************************************************************
* Copyright (C) 2019 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" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_ASIOBASE_H
#define FAIR_MQ_SDK_ASIOBASE_H
#include <asio/executor.hpp>
#include <fairmq/sdk/Traits.h>
#include <memory>
#include <utility>
namespace fair {
namespace mq {
namespace sdk {
using DefaultExecutor = asio::executor;
using DefaultAllocator = std::allocator<int>;
template<typename Executor, typename Allocator>
class AsioBase
{
public:
using ExecutorType = Executor;
auto GetExecutor() const noexcept -> ExecutorType { return fExecutor; }
using AllocatorType = Allocator;
auto GetAllocator() const noexcept -> AllocatorType { return fAllocator; }
AsioBase() = delete;
explicit AsioBase(Executor ex, Allocator alloc)
: fExecutor(std::move(ex))
, fAllocator(std::move(alloc))
{}
AsioBase(const AsioBase&) = delete;
AsioBase& operator=(const AsioBase&) = delete;
AsioBase(AsioBase&&) noexcept = default;
AsioBase& operator=(AsioBase&&) noexcept = default;
~AsioBase() = default;
private:
ExecutorType fExecutor;
AllocatorType fAllocator;
};
} /* namespace sdk */
} /* namespace mq */
} /* namespace fair */
#endif /* FAIR_MQ_SDK_ASIOBASE_H */
fair::mq::sdk::AsioBase::ExecutorType
Executor ExecutorType
Member type of associated I/O executor.
Definition: AsioBase.h:39
fair::mq::sdk::AsioBase::AllocatorType
Allocator AllocatorType
Member type of associated default allocator.
Definition: AsioBase.h:44
fair::mq::sdk::AsioBase::GetExecutor
auto GetExecutor() const noexcept -> ExecutorType
Get associated I/O executor.
Definition: AsioBase.h:41
fair::mq::sdk::AsioBase::AsioBase
AsioBase(Executor ex, Allocator alloc)
Construct with associated I/O executor.
Definition: AsioBase.h:52
fair::mq::sdk::AsioBase::GetAllocator
auto GetAllocator() const noexcept -> AllocatorType
Get associated default allocator.
Definition: AsioBase.h:46
fair::mq::sdk::AsioBase
Base for creating Asio-enabled I/O objects.
Definition: AsioBase.h:35
std
Definition: Error.h:56
fair::mq::sdk::AsioBase::AsioBase
AsioBase()=delete
NO default ctor.
fair
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy