triton_cpp v1.2.1
Header-only C++ wrapper for NVIDIA Triton Inference Server clients
Loading...
Searching...
No Matches
triton_cpp::SharedMemoryRegion Class Reference

Own a POSIX shared-memory mapping used by the Triton client. More...

#include <shm.hpp>

Public Member Functions

 SharedMemoryRegion (const std::string &key, std::int64_t size)
 Create and map a system shared-memory region.
 
 SharedMemoryRegion (const SharedMemoryRegion &)=delete
 
SharedMemoryRegionoperator= (const SharedMemoryRegion &)=delete
 
 SharedMemoryRegion (SharedMemoryRegion &&) noexcept=default
 
SharedMemoryRegionoperator= (SharedMemoryRegion &&)=delete
 
 ~SharedMemoryRegion ()=default
 
uint8_t * getAddress () const
 
std::string getKey () const
 

Detailed Description

Own a POSIX shared-memory mapping used by the Triton client.

Construction creates, sizes, and maps the region. Destruction unmaps and unlinks it.

Definition at line 114 of file shm.hpp.

Constructor & Destructor Documentation

◆ SharedMemoryRegion() [1/3]

triton_cpp::SharedMemoryRegion::SharedMemoryRegion ( const std::string & key,
std::int64_t size )
inline

Create and map a system shared-memory region.

Parameters
keyPOSIX shared-memory key, including its leading slash.
sizeRegion size in bytes.
Exceptions
std::runtime_errorif the region cannot be created, mapped, or closed.

Definition at line 122 of file shm.hpp.

122: memory_{key, size} {}

◆ SharedMemoryRegion() [2/3]

triton_cpp::SharedMemoryRegion::SharedMemoryRegion ( const SharedMemoryRegion & )
delete

◆ SharedMemoryRegion() [3/3]

triton_cpp::SharedMemoryRegion::SharedMemoryRegion ( SharedMemoryRegion && )
defaultnoexcept

◆ ~SharedMemoryRegion()

triton_cpp::SharedMemoryRegion::~SharedMemoryRegion ( )
default

Member Function Documentation

◆ getAddress()

uint8_t * triton_cpp::SharedMemoryRegion::getAddress ( ) const
inline
Returns
Host address of the mapped region.

Definition at line 131 of file shm.hpp.

131{ return memory_.address(); }
std::uint8_t * address() const noexcept
Definition shm.hpp:74

References triton_cpp::detail::PosixSharedMemory::address().

◆ getKey()

std::string triton_cpp::SharedMemoryRegion::getKey ( ) const
inline
Returns
POSIX shared-memory key used for the region.

Definition at line 133 of file shm.hpp.

133{ return memory_.key(); }
const std::string & key() const noexcept
Definition shm.hpp:75

References triton_cpp::detail::PosixSharedMemory::key().

◆ operator=() [1/2]

SharedMemoryRegion & triton_cpp::SharedMemoryRegion::operator= ( const SharedMemoryRegion & )
delete

◆ operator=() [2/2]

SharedMemoryRegion & triton_cpp::SharedMemoryRegion::operator= ( SharedMemoryRegion && )
delete

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