Monado OpenXR Runtime
iobuffer.hpp
Go to the documentation of this file.
1// Copyright 2023, Shawn Wallace
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief OpenVR IVRIOBuffer interface header.
6 * @author Shawn Wallace <yungwallace@live.com>
7 * @ingroup drv_steamvr_lh
8 */
9
10#pragma once
11
12#include "openvr_driver.h"
13
14class IOBuffer : public vr::IVRIOBuffer
15{
16public:
17 /** opens an existing or creates a new IOBuffer of unSize bytes */
18 vr::EIOBufferError
19 Open(const char *pchPath,
20 vr::EIOBufferMode mode,
21 uint32_t unElementSize,
22 uint32_t unElements,
23 vr::IOBufferHandle_t *pulBuffer) override;
24
25 /** closes a previously opened or created buffer */
26 vr::EIOBufferError
27 Close(vr::IOBufferHandle_t ulBuffer) override;
28
29 /** reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead */
30 vr::EIOBufferError
31 Read(vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead) override;
32
33 /** writes unBytes of data from *pSrc into a buffer. */
34 vr::EIOBufferError
35 Write(vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes) override;
36
37 /** retrieves the property container of an buffer. */
38 vr::PropertyContainerHandle_t
39 PropertyContainer(vr::IOBufferHandle_t ulBuffer) override;
40
41 /** inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and writes. */
42 bool
43 HasReaders(vr::IOBufferHandle_t ulBuffer) override;
44};
Definition: iobuffer.hpp:15
vr::EIOBufferError Open(const char *pchPath, vr::EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, vr::IOBufferHandle_t *pulBuffer) override
opens an existing or creates a new IOBuffer of unSize bytes
Definition: iobuffer.cpp:14
vr::PropertyContainerHandle_t PropertyContainer(vr::IOBufferHandle_t ulBuffer) override
retrieves the property container of an buffer.
Definition: iobuffer.cpp:42
bool HasReaders(vr::IOBufferHandle_t ulBuffer) override
inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and write...
Definition: iobuffer.cpp:48
vr::EIOBufferError Write(vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes) override
writes unBytes of data from *pSrc into a buffer.
Definition: iobuffer.cpp:36
vr::EIOBufferError Close(vr::IOBufferHandle_t ulBuffer) override
closes a previously opened or created buffer
Definition: iobuffer.cpp:24
vr::EIOBufferError Read(vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead) override
reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead
Definition: iobuffer.cpp:30