Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur::IpcManager Class Reference

Registry/mediator for named IPC channels. More...

#include <ipc_manager.h>

Public Member Functions

 IpcManager ()
 Constructs empty IPC channel registry.
 ~IpcManager ()
 Destroys registry and all owned channels.
 IpcManager (const IpcManager &)=delete
 Copy construction is disabled.
IpcManageroperator= (const IpcManager &)=delete
 Copy assignment is disabled.
 IpcManager (IpcManager &&) noexcept
 Move-constructs registry state.
IpcManageroperator= (IpcManager &&) noexcept
 Move-assigns registry state.
Result< void > createPipe (const std::string &name, std::size_t capacity=1024)
 Creates a pipe channel if it does not already exist.
Result< void > createSharedMemory (const std::string &name, std::size_t bytes)
 Creates a shared-memory channel if it does not already exist.
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< std::reference_wrapper< IIpcChannel > > getChannel (const std::string &name)
 Looks up a channel by name.
Result< void > destroyChannel (const std::string &name)
 Destroys a channel by name.
bool exists (const std::string &name) const noexcept
 Checks whether a named channel exists.
std::size_t channelCount () const noexcept
 Number of registered channels.

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Registry/mediator for named IPC channels.

IpcManager owns channel lifetimes and provides lookup by name.

Definition at line 17 of file ipc_manager.h.

Constructor & Destructor Documentation

◆ IpcManager() [1/3]

contur::IpcManager::IpcManager ( )

Constructs empty IPC channel registry.

Referenced by IpcManager(), IpcManager(), operator=(), and operator=().

◆ ~IpcManager()

contur::IpcManager::~IpcManager ( )

Destroys registry and all owned channels.

◆ IpcManager() [2/3]

contur::IpcManager::IpcManager ( const IpcManager & )
delete

Copy construction is disabled.

References IpcManager().

◆ IpcManager() [3/3]

contur::IpcManager::IpcManager ( IpcManager && )
noexcept

Move-constructs registry state.

References IpcManager().

Member Function Documentation

◆ channelCount()

std::size_t contur::IpcManager::channelCount ( ) const
nodiscardnoexcept

Number of registered channels.

References channelCount().

Referenced by channelCount().

◆ createMessageQueue()

Result< void > contur::IpcManager::createMessageQueue ( const std::string & name,
std::size_t maxMessages = 64,
bool priorityMode = false )
nodiscard

Creates a message queue channel if it does not already exist.

Parameters
nameChannel name.
maxMessagesMaximum queued messages.
priorityModeTrue enables priority ordering.
Returns
Ok on success, InvalidArgument on invalid input.

References createMessageQueue().

Referenced by createMessageQueue().

◆ createPipe()

Result< void > contur::IpcManager::createPipe ( const std::string & name,
std::size_t capacity = 1024 )
nodiscard

Creates a pipe channel if it does not already exist.

Parameters
nameChannel name.
capacityPipe capacity in bytes.
Returns
Ok on success, InvalidArgument on invalid input.

References createPipe().

Referenced by createPipe().

◆ createSharedMemory()

Result< void > contur::IpcManager::createSharedMemory ( const std::string & name,
std::size_t bytes )
nodiscard

Creates a shared-memory channel if it does not already exist.

Parameters
nameChannel name.
bytesShared-memory size in bytes.
Returns
Ok on success, InvalidArgument on invalid input.

References createSharedMemory().

Referenced by createSharedMemory().

◆ destroyChannel()

Result< void > contur::IpcManager::destroyChannel ( const std::string & name)
nodiscard

Destroys a channel by name.

Returns
Ok on success or NotFound.

References destroyChannel().

Referenced by destroyChannel().

◆ exists()

bool contur::IpcManager::exists ( const std::string & name) const
nodiscardnoexcept

Checks whether a named channel exists.

References exists().

Referenced by exists().

◆ getChannel()

Result< std::reference_wrapper< IIpcChannel > > contur::IpcManager::getChannel ( const std::string & name)
nodiscard

Looks up a channel by name.

Returns
Reference to channel or NotFound.

References getChannel().

Referenced by getChannel().

◆ operator=() [1/2]

IpcManager & contur::IpcManager::operator= ( const IpcManager & )
delete

Copy assignment is disabled.

References IpcManager().

◆ operator=() [2/2]

IpcManager & contur::IpcManager::operator= ( IpcManager && )
noexcept

Move-assigns registry state.

References IpcManager().

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::IpcManager::impl_
private

Definition at line 73 of file ipc_manager.h.


The documentation for this class was generated from the following file: