Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::interprocess::xsi_shared_memory Class Reference

A class that wraps XSI (System V) shared memory. More...

#include <xsi_shared_memory.hpp>

Public Member Functions

 xsi_shared_memory ()
 Default constructor. More...
 
 xsi_shared_memory (open_only_t, int shmid)
 Initializes *this with a shmid previously obtained (possibly from another process) This lower-level initializer allows shared memory mapping without having a key. More...
 
 xsi_shared_memory (create_only_t, const xsi_key &key, std::size_t size, const permissions &perm=permissions())
 Creates a new XSI shared memory from 'key', with size "size" and permissions "perm". More...
 
 xsi_shared_memory (open_or_create_t, const xsi_key &key, std::size_t size, const permissions &perm=permissions())
 Opens an existing shared memory with identifier 'key' or creates a new XSI shared memory from identifier 'key', with size "size" and permissions "perm". More...
 
 xsi_shared_memory (open_only_t, const xsi_key &key)
 Tries to open a XSI shared memory with identifier 'key' If the shared memory does not previously exist, it throws an error. More...
 
 xsi_shared_memory (BOOST_RV_REF(xsi_shared_memory) moved)
 Moves the ownership of "moved"'s shared memory object to *this. More...
 
xsi_shared_memoryoperator= (BOOST_RV_REF(xsi_shared_memory) moved)
 Moves the ownership of "moved"'s shared memory to *this. More...
 
void swap (xsi_shared_memory &other)
 Swaps two xsi_shared_memorys. Does not throw. More...
 
 ~xsi_shared_memory ()
 Destroys *this. More...
 
int get_shmid () const
 Returns the shared memory ID that identifies the shared memory. More...
 
mapping_handle_t get_mapping_handle () const
 Returns the mapping handle. More...
 

Static Public Member Functions

static bool remove (int shmid)
 Erases the XSI shared memory object identified by shmid from the system. More...
 

Detailed Description

A class that wraps XSI (System V) shared memory.

Unlike shared_memory_object, xsi_shared_memory needs a valid xsi_key to identify a shared memory object.

Warning: XSI shared memory and interprocess portable shared memory (boost::interprocess::shared_memory_object) can't communicate between them.

Constructor & Destructor Documentation

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( )
inline

Default constructor.

Represents an empty xsi_shared_memory.

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( open_only_t  ,
int  shmid 
)
inline

Initializes *this with a shmid previously obtained (possibly from another process) This lower-level initializer allows shared memory mapping without having a key.

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( create_only_t  ,
const xsi_key key,
std::size_t  size,
const permissions perm = permissions() 
)
inline

Creates a new XSI shared memory from 'key', with size "size" and permissions "perm".

If the shared memory previously exists, throws an error.

References boost::interprocess::ipcdetail::DoCreate.

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( open_or_create_t  ,
const xsi_key key,
std::size_t  size,
const permissions perm = permissions() 
)
inline

Opens an existing shared memory with identifier 'key' or creates a new XSI shared memory from identifier 'key', with size "size" and permissions "perm".

References boost::interprocess::ipcdetail::DoOpenOrCreate.

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( open_only_t  ,
const xsi_key key 
)
inline

Tries to open a XSI shared memory with identifier 'key' If the shared memory does not previously exist, it throws an error.

References boost::interprocess::ipcdetail::DoOpen, and boost::filesystem::detail::permissions().

boost::interprocess::xsi_shared_memory::xsi_shared_memory ( BOOST_RV_REF(xsi_shared_memory moved)
inline

Moves the ownership of "moved"'s shared memory object to *this.

After the call, "moved" does not represent any shared memory object. Does not throw

References swap().

boost::interprocess::xsi_shared_memory::~xsi_shared_memory ( )
inline

Destroys *this.

The shared memory won't be destroyed, just this connection to it. Use remove() to destroy the shared memory.

Member Function Documentation

mapping_handle_t boost::interprocess::xsi_shared_memory::get_mapping_handle ( ) const
inline

Returns the mapping handle.

Never throws

int boost::interprocess::xsi_shared_memory::get_shmid ( ) const
inline

Returns the shared memory ID that identifies the shared memory.

xsi_shared_memory& boost::interprocess::xsi_shared_memory::operator= ( BOOST_RV_REF(xsi_shared_memory moved)
inline

Moves the ownership of "moved"'s shared memory to *this.

After the call, "moved" does not represent any shared memory. Does not throw

References boost::move(), and swap().

bool boost::interprocess::xsi_shared_memory::remove ( int  shmid)
inlinestatic

Erases the XSI shared memory object identified by shmid from the system.

Returns false on error. Never throws

void boost::interprocess::xsi_shared_memory::swap ( xsi_shared_memory other)
inline

Swaps two xsi_shared_memorys. Does not throw.

References boost::swap.

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


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