OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::common::BufferReader< ContainerType > Singleton Reference

Provides for a single reading pass over a buffer. It is important that the buffer not change while a Reader obtained from it is still in scope. More...

#include <osvr/Common/Buffer.h>

Public Types

typedef
ContainerType::const_iterator 
const_iterator
 
typedef ContainerType::value_type ElementType
 

Public Member Functions

 BufferReader (ContainerType const &buf)
 
size_t bytesRead () const
 
size_t bytesRemaining () const
 
template<typename T >
void read (T &v)
 Get the binary representation of a type from a buffer. More...
 
const_iterator readBytes (size_t const n)
 Returns an iterator into the buffer valid for n elements, and assumes you'll take care of copying them.
 
template<typename T >
void readAligned (T &v, size_t const alignment)
 Get the binary representation of a type from a buffer, after skipping the necessary number of bytes to begin the read at the given alignment.
 
const_iterator readBytesAligned (size_t const n, size_t const alignment)
 Returns an iterator into the buffer valid for n elements, after skipping the necessary number of bytes to begin the read at the given alignment, and assumes you'll take care of copying them.
 
void skipPadding (size_t const bytes)
 Skip reading the given number of bytes, assumed to be padding.
 

Detailed Description

template<typename ContainerType>
singleton osvr::common::BufferReader< ContainerType >

Provides for a single reading pass over a buffer. It is important that the buffer not change while a Reader obtained from it is still in scope.

Get one by calling Buffer::startReading()

Definition at line 117 of file Buffer.h.

Member Function Documentation

template<typename ContainerType >
template<typename T >
void osvr::common::BufferReader< ContainerType >::read ( T &  v)
inline

Get the binary representation of a type from a buffer.

Safe to do without violating strict aliasing because ElementType is a character type.

Definition at line 128 of file Buffer.h.


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