|
forb
|
Implementation of the forbcc::strams::stream API that uses a Linux Shared Memory to communicate. More...
#include <shared_memory.hpp>
Classes | |
| struct | shmem_data |
| Definition of the private structure that will be allocated within the shared memory area. More... | |
Public Types | |
| using | index_t = stream::size_t |
| The type of the indexes used within the shared memory area. | |
| using | key_t = ::key_t |
| The type of the key associated with the shared memory area. | |
| using | id_t = int |
| The type of the ID of the shared memory area. | |
Public Types inherited from forb::streams::stream | |
| enum | type : call_id_t { SOCKET = 0, SHMEM = 1 << (std::numeric_limits<call_id_t>::digits - 1) } |
| The type of the stream. More... | |
| using | size_t = std::size_t |
| An unsigned size type. | |
Public Member Functions | |
| shared_memory ()=default | |
| Default constructor, creates an empty shared memory object, with no associated shared memory area. More... | |
| ~shared_memory () override | |
| Virtual destructor that closes shared memory (if open). | |
| shared_memory (const shared_memory &other)=delete | |
| This class does not support copy construction. | |
| shared_memory & | operator= (const shared_memory &other)=delete |
| This class does not support copy assignment. | |
| shared_memory (shared_memory &&other) noexcept | |
| This class supports move construction. | |
| shared_memory & | operator= (shared_memory &&other) noexcept |
| This class supports move assignment. | |
| key_t | get_key () noexcept |
| Returns the key of the shared memory. | |
| void | send (const void *buffer, size_t size) override |
| Blocking call that fills the shared memory area with size data from the given buffer. | |
| void | recv (void *buffer, size_t size) override |
| Blocking call that fills buffer with size data received through the shared_memory area. | |
| void | close () noexcept override |
| Closes the socket, called by the virtual destructor. | |
| type | get_type () const noexcept override |
| Returns the type of the stream. | |
| bool | require_marshal () const override |
| Returns true if the execution platform requires marshalling before sending data on the socket, false otherwise. More... | |
Public Member Functions inherited from forb::streams::stream | |
| virtual | ~stream () noexcept=default |
| This class is virtual, so it requires a virtual destructor. More... | |
Static Public Member Functions | |
| static shared_memory | get (key_t key) |
| Retrieves a shared memory area from the given key. | |
| static shared_memory | create (size_t size) |
| Creates a new shared memory area with the given size. | |
Implementation of the forbcc::strams::stream API that uses a Linux Shared Memory to communicate.
NOTICE: this is an unidirectional stream, it can be used as a bidirectional stream only if you are extremely sure there can be no overlap between various phases of each program; in each phase, the stream shall be used only in one direction.
|
default |
Default constructor, creates an empty shared memory object, with no associated shared memory area.
It can be used in variable declarations that will then be overwritten with actual shared memory objects.
|
inlineoverridevirtual |
Returns true if the execution platform requires marshalling before sending data on the socket, false otherwise.
In this stream implementation, this method returns always false.
Reimplemented from forb::streams::stream.
1.8.12