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

A class that wraps a shared memory mapping that can be used to create mapped regions from the mapped files. More...

#include <shared_memory_object.hpp>

Public Member Functions

 shared_memory_object ()
 Default constructor. Represents an empty shared_memory_object. More...
 
shared_memory_object (create_only_t, const char *name, mode_t mode, const permissions &perm=permissions())
 Creates a shared memory object with name "name" and mode "mode", with the access mode "mode" If the file previously exists, throws an error. More...
 
 shared_memory_object (open_or_create_t, const char *name, mode_t mode, const permissions &perm=permissions())
 Tries to create a shared memory object with name "name" and mode "mode", with the access mode "mode". More...
 
 shared_memory_object (open_only_t, const char *name, mode_t mode)
 Tries to open a shared memory object with name "name", with the access mode "mode". More...
 
 shared_memory_object (BOOST_RV_REF(shared_memory_object) moved)
 Moves the ownership of "moved"'s shared memory object to *this. More...
 
shared_memory_objectoperator= (BOOST_RV_REF(shared_memory_object) moved)
 Moves the ownership of "moved"'s shared memory to *this. More...
 
void swap (shared_memory_object &moved)
 Swaps the shared_memory_objects. Does not throw. More...
 
void truncate (offset_t length)
 Sets the size of the shared memory mapping. More...
 
 ~shared_memory_object ()
 Destroys *this and indicates that the calling process is finished using the resource. More...
 
const char * get_name () const
 Returns the name of the shared memory object. More...
 
bool get_size (offset_t &size) const
 Returns true if the size of the shared memory object can be obtained and writes the size in the passed reference. More...
 
mode_t get_mode () const
 Returns access mode. More...
 
mapping_handle_t get_mapping_handle () const
 Returns mapping handle. Never throws. More...
 

Static Public Member Functions

static bool remove (const char *name)
 Erases a shared memory object from the system. More...
 

Detailed Description

A class that wraps a shared memory mapping that can be used to create mapped regions from the mapped files.

Constructor & Destructor Documentation

boost::interprocess::shared_memory_object::shared_memory_object ( )
inline

Default constructor. Represents an empty shared_memory_object.

* boost::interprocess::shared_memory_object::shared_memory_object ( create_only_t  ,
const char *  name,
mode_t  mode,
const permissions perm = permissions() 
)
inline

Creates a shared memory object with name "name" and mode "mode", with the access mode "mode" If the file previously exists, throws an error.

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

boost::interprocess::shared_memory_object::shared_memory_object ( open_or_create_t  ,
const char *  name,
mode_t  mode,
const permissions perm = permissions() 
)
inline

Tries to create a shared memory object with name "name" and mode "mode", with the access mode "mode".

If the file previously exists, it tries to open it with mode "mode". Otherwise throws an error.

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

boost::interprocess::shared_memory_object::shared_memory_object ( open_only_t  ,
const char *  name,
mode_t  mode 
)
inline

Tries to open a shared memory object with name "name", with the access mode "mode".

If the file does not previously exist, it throws an error.

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

boost::interprocess::shared_memory_object::shared_memory_object ( BOOST_RV_REF(shared_memory_object 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::shared_memory_object::~shared_memory_object ( )
inline

Destroys *this and indicates that the calling process is finished using the resource.

All mapped regions are still valid after destruction. The destructor function will deallocate any system resources allocated by the system for use by this process for this resource. The resource can still be opened again calling the open constructor overload. To erase the resource from the system use remove().

Member Function Documentation

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

Returns mapping handle. Never throws.

mode_t boost::interprocess::shared_memory_object::get_mode ( ) const
inline

Returns access mode.

const char * boost::interprocess::shared_memory_object::get_name ( ) const
inline

Returns the name of the shared memory object.

bool boost::interprocess::shared_memory_object::get_size ( offset_t &  size) const
inline

Returns true if the size of the shared memory object can be obtained and writes the size in the passed reference.

shared_memory_object& boost::interprocess::shared_memory_object::operator= ( BOOST_RV_REF(shared_memory_object 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().

void boost::interprocess::shared_memory_object::swap ( shared_memory_object moved)
inline

Swaps the shared_memory_objects. Does not throw.

References boost::swap.

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

void boost::interprocess::shared_memory_object::truncate ( offset_t  length)
inline

Sets the size of the shared memory mapping.

References boost::interprocess::system_error_code().


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