|
| stable_interprocess_map (const std::string &unique_identifier, std::size_t size) |
| Constructs a stable_interprocess_map with a unique identifier and fixed size.
|
|
stable_interprocess_map & | operator= (const std::initializer_list< std::pair< const Key, Value > > &list) |
| Assigns key-value pairs to the map from an initializer list.
|
|
Value | at (const Key &key) const |
| Retrieves the value associated with a specific key.
|
|
Value | at_or_default (const Key &key, const Value &default_value) const |
| Retrieves the value associated with a key, or a default value if the key is not found.
|
|
void | insert (const Key &key, const Value &value) |
| Inserts a key-value pair into the map.
|
|
void | erase (const Key &key) |
| Erases the element associated with a specific key.
|
|
std::size_t | count (const Key &key) const |
| Counts the number of elements with a specific key.
|
|
void | update_or_insert (const Key &key, std::function< void(Value &)> updater, const Value &default_value) |
|
const Value | update (const Key &key, std::function< void(Value &)> updater, const std::string &error_string={"cbeam::stable_interprocess_map::update: key not found"}) |
|
| stable_interprocess_container (const std::string &unique_identifier, std::size_t size) |
| Constructs a stable_interprocess_container with a specific size and unique identifier.
|
|
| stable_interprocess_container (const stable_interprocess_container &)=delete |
|
| stable_interprocess_container (stable_interprocess_container &&)=delete |
|
stable_interprocess_container & | operator= (const stable_interprocess_container &)=delete |
|
stable_interprocess_container & | operator= (stable_interprocess_container &&)=delete |
|
virtual void | clear () |
| Clears the contents of the container.
|
|
virtual bool | empty () const |
| Checks if the container is empty.
|
|
virtual size_t | size () const |
| Retrieves the size of the container.
|
|
void | foreach (Func func) |
| Iterates over the elements of the container and performs an action.
|
|
| interprocess_shared_memory (const std::string &unique_identifier, std::size_t size) |
| Constructor that initializes the shared memory segment.
|
|
virtual | ~interprocess_shared_memory () noexcept |
|
void * | data () const |
| Retrieves the starting address of the shared memory region.
|
|
size_t | capacity () const noexcept |
| Returns the size of the shared memory region.
|
|
lock_guard | get_lock_guard () const |
| Acquires a lock_guard for mutex synchronization.
|
|
| interprocess_shared_memory (const interprocess_shared_memory &)=delete |
|
interprocess_shared_memory & | operator= (const interprocess_shared_memory &)=delete |
|
| interprocess_shared_memory (interprocess_shared_memory &&)=delete |
|
interprocess_shared_memory & | operator= (interprocess_shared_memory &&)=delete |
|
template<typename Key, typename Value>
class stable_interprocess_map< Key, Value >
Provides a type-safe, interprocess map with stable serialization.
This template class extends the stable_interprocess_container
to provide a map-like container that can be safely used across different processes and shared library boundaries. It inherits the stability and consistency features of stable_interprocess_container
, making it suitable for interprocess communication and data sharing in a multi-library environment.
Serialization and deserialization of the map are automatically handled to ensure data integrity and consistency when shared across different compilers or compiler versions.
- Template Parameters
-
Key | The type of the keys in the map. |
Value | The type of the values in the map. |
- Examples
- cbeam/container/stable_interprocess_map.hpp.