17 #ifndef IOX_UTILS_POSIX_WRAPPER_SHARED_MEMORY_OBJECT_SHARED_MEMORY_HPP
18 #define IOX_UTILS_POSIX_WRAPPER_SHARED_MEMORY_OBJECT_SHARED_MEMORY_HPP
20 #include "iceoryx_utils/cxx/optional.hpp"
21 #include "iceoryx_utils/cxx/string.hpp"
22 #include "iceoryx_utils/design_pattern/creation.hpp"
23 #include "iceoryx_utils/platform/mman.hpp"
31 class SharedMemoryObject;
32 enum class AccessMode : uint64_t
37 static constexpr
const char* ACCESS_MODE_STRING[] = {
"AccessMode::READ_ONLY",
"AccessMode::READ_WRITE"};
39 enum class OwnerShip : uint64_t
44 static constexpr
const char* OWNERSHIP_STRING[] = {
"OwnerShip::MINE",
"OwnerShip::OPEN_EXISTING"};
46 enum class SharedMemoryError
50 NAME_WITHOUT_LEADING_SLASH,
51 INSUFFICIENT_PERMISSIONS,
53 PROCESS_LIMIT_OF_OPEN_FILES_REACHED,
54 SYSTEM_LIMIT_OF_OPEN_FILES_REACHED,
56 NOT_ENOUGH_MEMORY_AVAILABLE,
57 REQUESTED_MEMORY_EXCEEDS_MAXIMUM_FILE_SIZE,
59 TOO_MANY_SYMBOLIC_LINKS,
60 NO_FILE_RESIZE_SUPPORT,
62 INVALID_FILEDESCRIPTOR,
69 static constexpr uint64_t NAME_SIZE = 128U;
78 int32_t getHandle()
const noexcept;
84 const AccessMode accessMode,
85 const OwnerShip ownerShip,
86 const mode_t permissions,
87 const uint64_t size) noexcept;
89 bool open(
const int oflags,
const mode_t permissions,
const uint64_t size) noexcept;
90 bool unlink() noexcept;
91 bool close() noexcept;
92 void destroy() noexcept;
93 void reset() noexcept;
95 SharedMemoryError errnoToEnum(
const int32_t errnum)
const noexcept;
99 OwnerShip m_ownerShip;
This pattern can be used if you write an abstraction where you have to throw an exception in the cons...
Definition: creation.hpp:99
Definition: shared_memory.hpp:67
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28