5 #ifndef LIBFORB_SHARED_MEMORY_HPP 6 #define LIBFORB_SHARED_MEMORY_HPP 10 #include <forb/stream/stream.hpp> 35 static constexpr
int PRIVILEGES = 0666;
54 bool _is_owner =
false;
78 _move_attributes(other);
89 _move_attributes(other);
122 void _get(
key_t key,
size_t size = 0,
int flags = 0);
128 void _init(
size_t size);
137 void send(
const void *buffer,
size_t size)
override;
140 void recv(
void *buffer,
size_t size)
override;
143 void close() noexcept
override;
164 #endif //LIBFORB_SHARED_MEMORY_HPP shared_memory & operator=(shared_memory &&other) noexcept
This class supports move assignment.
Definition: shared_memory.hpp:82
shared_memory(shared_memory &&other) noexcept
This class supports move construction.
Definition: shared_memory.hpp:77
bool require_marshal() const override
Returns true if the execution platform requires marshalling before sending data on the socket...
Definition: shared_memory.hpp:153
Virtual class that represents a stream.
Definition: stream.hpp:69
This function implements a memcpy abstract that is valid also for volatile data.
Definition: base_skeleton.hpp:15
Definition of the private structure that will be allocated within the shared memory area...
Definition: shared_memory.cpp:37
Implementation of the forbcc::strams::stream API that uses a Linux Shared Memory to communicate...
Definition: shared_memory.hpp:21
::key_t key_t
The type of the key associated with the shared memory area.
Definition: shared_memory.hpp:28
type
The type of the stream.
Definition: stream.hpp:78
type get_type() const noexcept override
Returns the type of the stream.
Definition: shared_memory.hpp:146
void send(const void *buffer, size_t size) override
Blocking call that fills the shared memory area with size data from the given buffer.
Definition: shared_memory.cpp:230
key_t get_key() noexcept
Returns the key of the shared memory.
Definition: shared_memory.hpp:132
std::size_t size_t
An unsigned size type.
Definition: stream.hpp:72
void close() noexcept override
Closes the socket, called by the virtual destructor.
Definition: shared_memory.cpp:354
void recv(void *buffer, size_t size) override
Blocking call that fills buffer with size data received through the shared_memory area...
Definition: shared_memory.cpp:292
shared_memory & operator=(const shared_memory &other)=delete
This class does not support copy assignment.
shared_memory()=default
Default constructor, creates an empty shared memory object, with no associated shared memory area...
stream::size_t index_t
The type of the indexes used within the shared memory area.
Definition: shared_memory.hpp:25
~shared_memory() override
Virtual destructor that closes shared memory (if open).
Definition: shared_memory.hpp:66
static shared_memory create(size_t size)
Creates a new shared memory area with the given size.
Definition: shared_memory.hpp:107
int id_t
The type of the ID of the shared memory area.
Definition: shared_memory.hpp:31