ofxDepthStream
Public Types | Public Member Functions | Protected Attributes
depth::Buffer Class Reference

Manages a reference to a Frame instance. More...

#include <Buffer.h>

Inheritance diagram for depth::Buffer:
depth::Playback depth::Receiver depth::Recorder

Public Types

typedef std::function< void(const void *, size_t)> NewDataCallback
 A new data callback takes a void pointer to the memory block and a size_t with the number of bytes in the memory block. More...
 

Public Member Functions

virtual FrameRef getRef ()
 
virtual void write (FrameRef f)
 Updates the buffer with a new frame (triggers the output callback) More...
 
virtual void write (const void *data, size_t size)
 Updates the buffer with a new frame (triggers the output callback) More...
 
void clear ()
 Clear the buffer (doesn't trigger the output callback) More...
 
void setOutputTo (Buffer *b)
 Registers an output callback that updates the given buffer with this buffer's data whenever this buffer is updated. More...
 

Protected Attributes

NewDataCallback newDataCallback =nullptr
 
FrameRef buffered =nullptr
 

Detailed Description

Manages a reference to a Frame instance.

The Buffer class only manages a reference to a Frame instance, and allows the owner register a callback to be notified when the buffer is being written to.

Member Typedef Documentation

◆ NewDataCallback

typedef std::function<void(const void*, size_t)> depth::Buffer::NewDataCallback

A new data callback takes a void pointer to the memory block and a size_t with the number of bytes in the memory block.

Member Function Documentation

◆ clear()

void depth::Buffer::clear ( )
inline

Clear the buffer (doesn't trigger the output callback)

Referenced by depth::emptyBuffer().

◆ getRef()

virtual FrameRef depth::Buffer::getRef ( )
inlinevirtual
Returns
a shared_ptr to the buffered Frame (can return a nullptr)

Referenced by depth::emptyBuffer().

◆ setOutputTo()

void depth::Buffer::setOutputTo ( Buffer b)
inline

Registers an output callback that updates the given buffer with this buffer's data whenever this buffer is updated.

◆ write() [1/2]

virtual void depth::Buffer::write ( FrameRef  f)
inlinevirtual

Updates the buffer with a new frame (triggers the output callback)

Referenced by setOutputTo(), depth::Receiver::threadFunc(), depth::Playback::update(), depth::Recorder::write(), and write().

◆ write() [2/2]

virtual void depth::Buffer::write ( const void *  data,
size_t  size 
)
inlinevirtual

Updates the buffer with a new frame (triggers the output callback)

Reimplemented in depth::Recorder.

Field Documentation

◆ buffered

FrameRef depth::Buffer::buffered =nullptr
protected

Referenced by clear(), getRef(), and write().

◆ newDataCallback

NewDataCallback depth::Buffer::newDataCallback =nullptr
protected

Referenced by setOutputTo(), and write().


The documentation for this class was generated from the following file: