# FairMQ: fairmq/ofi/TransportFactory.h Source File

TransportFactory.h
/********************************************************************************
* Copyright (C) 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" *
********************************************************************************/
#ifndef FAIR_MQ_OFI_TRANSPORTFACTORY_H
#define FAIR_MQ_OFI_TRANSPORTFACTORY_H
#include <FairMQTransportFactory.h>
#include <fairmq/ProgOptions.h>
#include <fairmq/ofi/Context.h>
#include <asiofi.hpp>
namespace fair::mq::ofi
{
class TransportFactory final : public FairMQTransportFactory
{
public:
TransportFactory(const std::string& id = "", const fair::mq::ProgOptions* config = nullptr);
TransportFactory(const TransportFactory&) = delete;
TransportFactory operator=(const TransportFactory&) = delete;
auto CreateMessage() -> MessagePtr override;
auto CreateMessage(Alignment alignment) -> MessagePtr override;
auto CreateMessage(const std::size_t size) -> MessagePtr override;
auto CreateMessage(const std::size_t size, Alignment alignment) -> MessagePtr override;
auto CreateMessage(void* data, const std::size_t size, fairmq_free_fn* ffn, void* hint = nullptr) -> MessagePtr override;
auto CreateMessage(UnmanagedRegionPtr& region, void* data, const std::size_t size, void* hint = nullptr) -> MessagePtr override;
auto CreateSocket(const std::string& type, const std::string& name) -> SocketPtr override;
auto CreatePoller(const std::vector<FairMQChannel>& channels) const -> PollerPtr override;
auto CreatePoller(const std::vector<FairMQChannel*>& channels) const -> PollerPtr override;
auto CreatePoller(const std::unordered_map<std::string, std::vector<FairMQChannel>>& channelsMap, const std::vector<std::string>& channelList) const -> PollerPtr override;
auto CreateUnmanagedRegion(const size_t size, RegionCallback callback = nullptr, const std::string& path = "", int flags = 0) -> UnmanagedRegionPtr override;
auto CreateUnmanagedRegion(const size_t size, RegionBulkCallback callback = nullptr, const std::string& path = "", int flags = 0) -> UnmanagedRegionPtr override;
auto CreateUnmanagedRegion(const size_t size, int64_t userFlags, RegionCallback callback = nullptr, const std::string& path = "", int flags = 0) -> UnmanagedRegionPtr override;
auto CreateUnmanagedRegion(const size_t size, int64_t userFlags, RegionBulkCallback callback = nullptr, const std::string& path = "", int flags = 0) -> UnmanagedRegionPtr override;
void SubscribeToRegionEvents(RegionEventCallback /* callback */) override { LOG(error) << "SubscribeToRegionEvents not yet implemented for OFI"; }
bool SubscribedToRegionEvents() override { LOG(error) << "Region event subscriptions not yet implemented for OFI"; return false; }
void UnsubscribeFromRegionEvents() override { LOG(error) << "UnsubscribeFromRegionEvents not yet implemented for OFI"; }
std::vector<FairMQRegionInfo> GetRegionInfo() override { LOG(error) << "GetRegionInfo not yet implemented for OFI, returning empty vector"; return std::vector<FairMQRegionInfo>(); }
auto GetType() const -> Transport override;
void Interrupt() override { fContext.Interrupt(); }
void Resume() override { fContext.Resume(); }
void Reset() override { fContext.Reset(); }
private:
mutable Context fContext;
asiofi::allocated_pool_resource fMemoryResource;
}; /* class TransportFactory */
} // namespace fair::mq::ofi
#endif /* FAIR_MQ_OFI_TRANSPORTFACTORY_H */
fair::mq::Alignment
Definition: FairMQMessage.h:25
fair::mq::ProgOptions
Definition: ProgOptions.h:41
fair::mq::ofi::TransportFactory::CreateMessage
auto CreateMessage() -> MessagePtr override
Create empty FairMQMessage (for receiving)
Definition: TransportFactory.cxx:40
fair::mq::ofi::TransportFactory::CreateSocket
auto CreateSocket(const std::string &type, const std::string &name) -> SocketPtr override
Create a socket.
fair::mq::ofi::TransportFactory::GetType
auto GetType() const -> Transport override
Get transport type.
Definition: TransportFactory.cxx:121
fair::mq::ofi::TransportFactory::SubscribedToRegionEvents
bool SubscribedToRegionEvents() override
Check if there is an active subscription to region events.
Definition: TransportFactory.h:59
fair::mq::ofi::TransportFactory::CreateUnmanagedRegion
auto CreateUnmanagedRegion(const size_t size, RegionCallback callback=nullptr, const std::string &path="", int flags=0) -> UnmanagedRegionPtr override
Create new UnmanagedRegion.
Definition: TransportFactory.cxx:101
fair::mq::ofi::TransportFactory::UnsubscribeFromRegionEvents
void UnsubscribeFromRegionEvents() override
Unsubscribe from region events.
Definition: TransportFactory.h:60
fair::mq::ofi::TransportFactory::SubscribeToRegionEvents
void SubscribeToRegionEvents(RegionEventCallback) override
Subscribe to region events (creation, destruction, ...)
Definition: TransportFactory.h:58
fair::mq::ofi::TransportFactory::CreatePoller
auto CreatePoller(const std::vector< FairMQChannel > &channels) const -> PollerPtr override
Create a poller for a single channel (all subchannels)
FairMQTransportFactory
Definition: FairMQTransportFactory.h:30

privacy