25 #ifndef INCLUDED_Imaging_h_GUID_5473F500_E901_419D_46D2_62ED5CB57412
26 #define INCLUDED_Imaging_h_GUID_5473F500_E901_419D_46D2_62ED5CB57412
37 #include <boost/shared_ptr.hpp>
38 #include <boost/noncopyable.hpp>
52 #ifndef OSVR_DOXYGEN_EXTERNAL
57 class ImagingCallbackRegistration :
public util::Deletable,
60 virtual ~ImagingCallbackRegistration() {}
68 : m_cb(cb), m_userdata(userdata),
69 m_ctx(iface.getContext().
get()) {
72 &ImagingCallbackRegistration::handleRawImagingCallback,
76 class ImagingDeleter {
90 handleRawImagingCallback(
void *userdata,
92 const struct OSVR_ImagingReport *report) {
93 ImagingCallbackRegistration *
self =
94 static_cast<ImagingCallbackRegistration *
>(userdata);
95 ImagingReport newReport;
96 newReport.sensor = report->sensor;
97 newReport.metadata = report->state.metadata;
98 newReport.buffer.reset(report->state.data,
99 ImagingDeleter(self->m_ctx));
100 self->m_cb(self->m_userdata, *timestamp, newReport);
106 friend void osvr::clientkit::registerImagingCallback(
111 #endif // OSVR_DOXYGEN_EXTERNAL
113 inline void registerImagingCallback(Interface &iface,
116 util::boost_util::DeletablePtr ptr(
117 new detail::ImagingCallbackRegistration(iface, cb, userdata));
118 iface.takeOwnership(ptr);
127 #endif // INCLUDED_Imaging_h_GUID_5473F500_E901_419D_46D2_62ED5CB57412
ref_type_at_key< Derived, Key >::type get(TypeKeyedBase< Derived > &c)
Interface handle object. Typically acquired from a ClientContext.
The main namespace for all C++ elements of the framework, internal and external.
OSVR_EXTERN_C_BEGIN OSVR_ReturnCode osvrClientFreeImage(OSVR_ClientContext ctx, OSVR_ImageBufferElement *buf)
Free an image buffer returned from a callback.
OSVR_ClientInterface get()
Get the raw OSVR_ClientInterface from this wrapper.
struct OSVR_ClientContextObject * OSVR_ClientContext
Opaque handle that should be retained by your application. You need only and exactly one...
Header providing a C++ wrapper around TimeValueC.h.
Header defining a base class for objects that just need to be generically deletable.
Header containing the inline implementation of Interface.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
unsigned char OSVR_ImageBufferElement
Type for raw buffer access to image data.
OSVR_ReturnCode osvrRegisterImagingCallback(OSVR_ClientInterface iface, OSVR_ImagingCallback cb, void *userdata)
Register a callback for Imaging reports on an interface.
void(* ImagingCallback)(void *userdata, util::time::TimeValue const ×tamp, ImagingReport report)
The user-friendly imaging callback type.