25 #ifndef INCLUDED_IPCRingBuffer_h_GUID_4F33BDA7_1BEB_4E81_B96C_1ADA1CBD1997 26 #define INCLUDED_IPCRingBuffer_h_GUID_4F33BDA7_1BEB_4E81_B96C_1ADA1CBD1997 29 #include <osvr/Common/Export.h> 44 typedef shared_ptr<IPCPutResult> IPCPutResultPtr;
46 typedef shared_ptr<IPCGetResult> IPCGetResultPtr;
67 typedef uint8_t BackendType;
68 typedef uint16_t alignment_type;
69 typedef uint16_t entry_count_type;
70 typedef uint32_t entry_size_type;
71 typedef uint32_t abi_level_type;
75 OSVR_COMMON_EXPORT Options(std::string
const &name);
77 OSVR_COMMON_EXPORT Options(std::string
const &name,
80 BackendType getBackend()
const {
return m_shmBackend; }
84 Options &setName(std::string
const &name);
85 std::string
const &getName()
const {
return m_name; }
90 Options &setAlignment(alignment_type alignment);
91 alignment_type getAlignment()
const {
return m_alignment; }
95 Options &setEntries(entry_count_type entries);
96 entry_count_type getEntries()
const {
return m_entries; }
100 Options &setEntrySize(entry_size_type entrySize);
101 entry_size_type getEntrySize()
const {
return m_entrySize; }
105 BackendType m_shmBackend;
106 alignment_type m_alignment = 16;
107 entry_count_type m_entries = 16;
108 entry_size_type m_entrySize = 65536;
115 OSVR_COMMON_EXPORT
static abi_level_type getABILevel();
122 OSVR_COMMON_EXPORT
static IPCRingBufferPtr create(
Options const &
opts);
130 OSVR_COMMON_EXPORT
static IPCRingBufferPtr find(
Options const &opts);
133 OSVR_COMMON_EXPORT BackendType getBackend()
const;
137 OSVR_COMMON_EXPORT std::string
const &getName()
const;
140 OSVR_COMMON_EXPORT uint32_t getEntrySize()
const;
144 OSVR_COMMON_EXPORT uint16_t getEntries()
const;
151 typedef uint8_t value_type;
152 typedef value_type *pointer_type;
153 typedef value_type
const *pointer_to_const_type;
155 typedef shared_ptr<value_type> smart_pointer_type;
170 std::swap(m_data, other.m_data);
175 std::swap(m_data, other.m_data);
179 operator pointer_type()
const {
return get(); }
181 pointer_type
get()
const {
return m_buf; }
183 sequence_type getSequenceNumber()
const {
return m_seq; }
187 IPCRingBufferPtr &&shm);
191 detail::IPCPutResultPtr m_data;
207 explicit operator bool()
const {
return nullptr != m_buf; }
210 pointer_to_const_type
get()
const {
return m_buf; }
214 smart_pointer_type getBufferSmartPointer()
const;
219 pointer_to_const_type operator*()
const {
return m_buf; }
220 pointer_to_const_type operator->()
const {
return m_buf; }
224 IPCRingBufferPtr &&shm);
228 detail::IPCGetResultPtr m_data;
235 OSVR_COMMON_EXPORT sequence_type
236 put(pointer_to_const_type data,
size_t len);
257 static IPCRingBufferPtr m_constructorHelper(
Options const &opts,
261 unique_ptr<Impl> m_impl;
267 #endif // INCLUDED_IPCRingBuffer_h_GUID_4F33BDA7_1BEB_4E81_B96C_1ADA1CBD1997 Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
Header wrapping the C99 standard stdint header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: IPCRingBuffer.h:72
Header to bring unique_ptr into the osvr namespace.
Header to bring shared_ptr into the osvr namespace.
shared_ptr< IPCRingBuffer > IPCRingBufferPtr
Pointer type for holding a shared memory ring buffer.
Definition: IPCRingBuffer.h:49
Definition: IPCRingBuffer.cpp:289
uint32_t sequence_type
The sequence number is automatically incremented with each "put" into the buffer. ...
Definition: IPCRingBuffer.h:149
Definition: newuoa.h:1888
BufferWriteProxy & operator=(BufferWriteProxy &&other)
move-assignable
Definition: IPCRingBuffer.h:174
A ring buffer for interprocess communication, with managed occupancy.
Definition: IPCRingBuffer.h:65
BufferWriteProxy(BufferWriteProxy &&other)
move-constructible
Definition: IPCRingBuffer.h:169
sequence_type getSequenceNumber() const
Gets the sequence number associated with this entry.
Definition: IPCRingBuffer.h:217
A class providing access to an entry in the ring buffer, holding a sharable mutex lock preventing it ...
Definition: IPCRingBuffer.h:203
Definition: ProjectionMatrix.h:77
A class providing write access to the next available element in the ring buffer, owning the appropria...
Definition: IPCRingBuffer.h:160