ofxDepthStream
Public Types | Public Member Functions | Static Public Member Functions
depth::Frame Class Reference

A read-only wrapper around a data block of a specified size. More...

#include <Frame.h>

Public Types

typedef std::function< void(const void *, size_t)> InputFunc
 

Public Member Functions

 Frame ()
 Create an uninitialized, empty Frame instance. More...
 
 Frame (size_t size)
 Allocates size bytes of owned data. More...
 
 Frame (const void *data, size_t size)
 Initializes with external data. More...
 
 ~Frame ()
 Deallocates owned data (if any) More...
 
const void * data ()
 
size_t size ()
 
template<typename ResultType >
ResultType convert (std::function< ResultType(const void *, size_t)> func)
 execute the given function with the frame's current content More...
 

Static Public Member Functions

static FrameRef ref (size_t size)
 Allocates a Frame for owned data. More...
 
static FrameRef refToExternalData (const void *data, size_t size)
 Initializes a frame with external data. More...
 
static FrameRef refWithData (void *data, size_t size)
 Initializes a Frame with owned data ("adopts" the provided data) More...
 

Detailed Description

A read-only wrapper around a data block of a specified size.

Frame is a read-only wrapper around a data block pointer and a size attribute. Frames can be initialized both with owned data (which will be deallocated by the Frame's destructor) as well as with external data (which will simply be abandoned by the Frame's destructor).

Member Typedef Documentation

◆ InputFunc

typedef std::function<void(const void*, size_t)> depth::Frame::InputFunc

Constructor & Destructor Documentation

◆ Frame() [1/3]

depth::Frame::Frame ( )
inline

Create an uninitialized, empty Frame instance.

◆ Frame() [2/3]

depth::Frame::Frame ( size_t  size)
inline

Allocates size bytes of owned data.

◆ Frame() [3/3]

depth::Frame::Frame ( const void *  data,
size_t  size 
)
inline

Initializes with external data.

◆ ~Frame()

depth::Frame::~Frame ( )
inline

Deallocates owned data (if any)

Member Function Documentation

◆ convert()

template<typename ResultType >
ResultType depth::Frame::convert ( std::function< ResultType(const void *, size_t)>  func)
inline

execute the given function with the frame's current content

This template function fascilitates specifically towards functional programming and lets the owner "convert" the data by choosing a return-value type. When converting to another Frame reference, linked notation is possible; frame->convert<FrameRef>(scaleDown)->convert<FrameRef>(blackAndWhite)->convert<FrameRef>(blur)

◆ data()

const void* depth::Frame::data ( )
inline
Returns
A pointer to the frame's data block (either owned or external), can be NULL

Referenced by depth::compress(), convert(), depth::inflate(), refToExternalData(), and refWithData().

◆ ref()

static FrameRef depth::Frame::ref ( size_t  size)
inlinestatic

Allocates a Frame for owned data.

Referenced by refWithData().

◆ refToExternalData()

static FrameRef depth::Frame::refToExternalData ( const void *  data,
size_t  size 
)
inlinestatic

Initializes a frame with external data.

Referenced by depth::compress(), depth::inflate(), and depth::Buffer::write().

◆ refWithData()

static FrameRef depth::Frame::refWithData ( void *  data,
size_t  size 
)
inlinestatic

Initializes a Frame with owned data ("adopts" the provided data)

Referenced by depth::convert_16bit_to_8bit(), depth::convert_32bit_to_8bit(), and depth::convertTo8bitGrayscaleData().

◆ size()

size_t depth::Frame::size ( )
inline
Returns
The size of the frame's data block (either owned or external) in bytes (can be zero)

Referenced by depth::compress(), convert(), Frame(), depth::inflate(), ref(), refToExternalData(), and refWithData().


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