MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / constructMemorySegment

Function constructMemorySegment

src/osvr/Common/IPCRingBuffer.cpp:207–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 /// @brief Factory function for constructing a memory segment holder.
206 template <typename ManagedMemory>
207 inline unique_ptr<SharedMemorySegmentHolder>
208 constructMemorySegment(IPCRingBuffer::Options const &opts,
209 bool doCreate) {
210 unique_ptr<SharedMemorySegmentHolder> ret;
211 if (doCreate) {
212 ret.reset(
213 new ServerSharedMemorySegmentHolder<ManagedMemory>(opts));
214 } else {
215 ret.reset(
216 new ClientSharedMemorySegmentHolder<ManagedMemory>(opts));
217 }
218 if (nullptr == ret->getBookkeeping()) {
219 ret.reset();
220 } else {
221 OSVR_SHM_VERBOSE("size: " << ret->getSize() << ", free: "
222 << ret->getFreeMemory());
223 }
224 return ret;
225 }
226 } // namespace
227
228 IPCRingBuffer::BufferWriteProxy::BufferWriteProxy(

Callers

nothing calls this directly

Calls 4

getBookkeepingMethod · 0.80
getFreeMemoryMethod · 0.80
resetMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected