contur2
Loading...
Searching...
No Matches
ipc_manager.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <functional>
7#include <memory>
8#include <string>
9
11
12namespace contur {
13
18 {
19 public:
22
23 IpcManager(const IpcManager &) = delete;
24 IpcManager &operator=(const IpcManager &) = delete;
25 IpcManager(IpcManager &&) noexcept;
26 IpcManager &operator=(IpcManager &&) noexcept;
27
32 [[nodiscard]] Result<void> createPipe(const std::string &name, std::size_t capacity = 1024);
33
38 [[nodiscard]] Result<void> createSharedMemory(const std::string &name, std::size_t bytes);
39
45 [[nodiscard]] Result<void>
46 createMessageQueue(const std::string &name, std::size_t maxMessages = 64, bool priorityMode = false);
47
50 [[nodiscard]] Result<std::reference_wrapper<IIpcChannel>> getChannel(const std::string &name);
51
54 [[nodiscard]] Result<void> destroyChannel(const std::string &name);
55
57 [[nodiscard]] bool exists(const std::string &name) const noexcept;
58
60 [[nodiscard]] std::size_t channelCount() const noexcept;
61
62 private:
63 struct Impl;
64 std::unique_ptr<Impl> impl_;
65 };
66
67} // namespace contur
Common interface for IPC channels.
IpcManager & operator=(const IpcManager &)=delete
bool exists(const std::string &name) const noexcept
Checks whether a named channel exists.
Result< void > createMessageQueue(const std::string &name, std::size_t maxMessages=64, bool priorityMode=false)
Creates a message queue channel if it does not already exist.
Result< void > createPipe(const std::string &name, std::size_t capacity=1024)
Creates a pipe channel if it does not already exist.
Result< void > destroyChannel(const std::string &name)
Destroys a channel by name.
IpcManager(IpcManager &&) noexcept
Result< void > createSharedMemory(const std::string &name, std::size_t bytes)
Creates a shared-memory channel if it does not already exist.
IpcManager(const IpcManager &)=delete
Result< std::reference_wrapper< IIpcChannel > > getChannel(const std::string &name)
Looks up a channel by name.
std::unique_ptr< Impl > impl_
Definition ipc_manager.h:64
std::size_t channelCount() const noexcept
Number of registered channels.
A result type that holds either a success value of type T or an ErrorCode.
Definition error.h:104
IIpcChannel interface for inter-process communication channels.
Definition block.h:15