Rumba C++ SDK
maquina::Buffer< T > Class Template Reference

A writable buffer for basic types like floats, integers, Imath::V3f, Imath::M44f.. More...

#include <Buffer.h>

Inheritance diagram for maquina::Buffer< T >:
maquina::BufferConst< T > maquina::Value

Public Types

typedef T value_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * iterator
 
typedef const T * const_iterator
 
- Public Types inherited from maquina::BufferConst< T >
typedef T value_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * iterator
 
typedef const T * const_iterator
 

Public Member Functions

 Buffer ()
 Construct an empty buffer. More...
 
 Buffer (const Value &v)
 Cast a Value object in Buffer. More...
 
 Buffer (size_t size)
 Allocate a buffer. More...
 
void resize (size_t size, const T &d=T())
 Resize the buffer. More...
 
void grow (size_t size)
 Grow the buffer in order for it to be large enough for this size. More...
 
gsl::span< value_typewrite ()
 Return a writable accessor on the buffer data. More...
 
reference operator[] (size_t i)
 Returns the i-th array element. More...
 
iterator begin ()
 Return the beginning iterator. More...
 
iterator end ()
 Return the ending iterator. More...
 
- Public Member Functions inherited from maquina::BufferConst< T >
 BufferConst ()
 Construct an empty buffer. More...
 
 BufferConst (const Value &v)
 Cast a Value object in BufferConst. More...
 
 BufferConst (const gsl::span< const T > &content)
 Create a buffer from a content. More...
 
bool empty () const
 Returns true if the buffer is empty. More...
 
size_t size () const
 Return the number of element in the buffer. More...
 
gsl::span< const value_typeread () const
 Return the readable data. More...
 
const_reference operator[] (size_t i) const
 Returns the i-th array element. More...
 
const_iterator begin () const
 Return the beginning iterator. More...
 
const_iterator end () const
 Return the ending iterator. More...
 
- Public Member Functions inherited from maquina::Value
 Value ()
 
 Value (Value &&other)=default
 
 Value (const Value &other)=default
 
Valueoperator= (Value &&other)=default
 
Valueoperator= (const Value &other)=default
 
virtual ~Value ()=default
 
Value duplicate () const
 Duplicate the value. More...
 
bool as_bool () const
 Returns the value as a bool. More...
 
int as_int () const
 Returns the value as an integer. More...
 
float as_float () const
 Returns the value as a float. More...
 
double as_double () const
 Returns the value as a double. More...
 
const std::string & as_string () const
 Returns the value as a string. More...
 
std::wstring as_wstring () const
 Returns the value as a wstring. More...
 
Imath::V2f as_V2f () const
 Returns the value as a V2f. More...
 
Imath::V3f as_V3f () const
 Returns the value as a V3f. More...
 
Imath::V4f as_V4f () const
 Returns the value as a V4f. More...
 
const Imath::V2das_V2d () const
 Returns the value as a V2d. More...
 
const Imath::V3das_V3d () const
 Returns the value as a V3d. More...
 
const Imath::V4das_V4d () const
 Returns the value as a V4d. More...
 
const Imath::V2ias_V2i () const
 Returns the value as a V2i. More...
 
const Imath::V3ias_V3i () const
 Returns the value as a V3i. More...
 
const Imath::V4ias_V4i () const
 Returns the value as a V4i. More...
 
Imath::M44f as_M44f () const
 Returns the value as a M44f. More...
 
const Imath::M44das_M44d () const
 Returns the value as a M44d. More...
 
const Imath::Box3fas_Box3f () const
 Returns the value as a Box3f. More...
 
const Imath::Color4fas_Color4f () const
 Returns the value as a Color4f. More...
 
Imath::Quatf as_Quatf () const
 Returns the value as a Quatf. More...
 
const Imath::Quatdas_Quatd () const
 Returns the value as a Quatd. More...
 
std::shared_ptr< const UserDataas_user_data () const
 Returns the value as a user data. More...
 
StringView type_name () const
 Return the type name of the Value. More...
 
virtual bool has_node_delegate () const
 Check if this value can produces a NodeDelegate. More...
 
virtual std::shared_ptr< NodeDelegatenode_delegate (const std::shared_ptr< NodeDelegate > &parent, const StringView &name) const
 
bool operator== (const Value &o) const
 Compare the two values. More...
 
bool operator!= (const Value &o) const
 
bool is_instance (const char *value_type_name) const
 Check if this type derives from another value type. More...
 
 operator bool () const
 
 Value (bool)
 Create a boolean value. More...
 
 Value (int)
 Create an integer value. More...
 
 Value (float)
 Create a float value. More...
 
 Value (double)
 Create a double value (stored in a float right now) More...
 
 Value (const char *string)
 Create a string value. More...
 
 Value (const wchar_t *string)
 Create a string value. More...
 
 Value (const std::string &string)
 Create a string value. More...
 
 Value (const std::wstring &string)
 Create a wide string value. More...
 
 Value (const Imath::V2f &)
 Create a Imath::V2f value. More...
 
 Value (const Imath::V3f &)
 Create a Imath::V3f value. More...
 
 Value (const Imath::V4f &)
 Create a Imath::V4f value. More...
 
 Value (const Imath::V2d &)
 Create a Imath::V2d value. More...
 
 Value (const Imath::V3d &)
 Create a Imath::V3d value. More...
 
 Value (const Imath::V4d &)
 Create a Imath::V4d value. More...
 
 Value (const Imath::V2i &)
 Create a Imath::V2i value. More...
 
 Value (const Imath::V3i &)
 Create a Imath::V3i value. More...
 
 Value (const Imath::V4i &)
 Create a Imath::V4i value. More...
 
 Value (const Imath::Color4f &)
 Create a Imath::Color4f value. More...
 
 Value (const Imath::M44f &)
 Create a Imath::M44f value. More...
 
 Value (const Imath::M44d &)
 Create a Imath::M44d value. More...
 
 Value (const Imath::Box3f &)
 Create a Imath::Box3f value. More...
 
 Value (const Imath::Quatf &)
 Create a Imath::Quatf value. More...
 
 Value (const Imath::Quatd &)
 Create a Imath::Quatd value. More...
 
 Value (const std::shared_ptr< const UserData > &user_data)
 Create a user data value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from maquina::Value
static bool validate_type_name (const char *type_name)
 Return true if the name is a valid type name. More...
 
static Value get_default_value (const char *type_name)
 Return a default value for a given type. More...
 
- Static Public Attributes inherited from maquina::BufferConst< T >
static const BufferConst< T > default_value
 The default value. More...
 
- Static Public Attributes inherited from maquina::Value
static const Value default_value
 The default value. More...
 

Detailed Description

template<typename T>
class maquina::Buffer< T >

A writable buffer for basic types like floats, integers, Imath::V3f, Imath::M44f..

The predefined Buffer types:

  • BufferInt32
  • BufferUInt8
  • BufferUInt32
  • BufferFloat
  • BufferDouble
  • BufferV2f
  • BufferV3f
  • BufferV4f
  • BufferV2i
  • BufferV3i
  • BufferV4i
  • BufferM33f
  • BufferM44f
  • BufferBox3f

Member Typedef Documentation

◆ const_iterator

template<typename T>
typedef const T* maquina::Buffer< T >::const_iterator

◆ const_reference

template<typename T>
typedef const T& maquina::Buffer< T >::const_reference

◆ iterator

template<typename T>
typedef T* maquina::Buffer< T >::iterator

◆ reference

template<typename T>
typedef T& maquina::Buffer< T >::reference

◆ value_type

template<typename T>
typedef T maquina::Buffer< T >::value_type

Constructor & Destructor Documentation

◆ Buffer() [1/3]

template<typename T>
maquina::Buffer< T >::Buffer ( )

Construct an empty buffer.

◆ Buffer() [2/3]

template<typename T>
maquina::Buffer< T >::Buffer ( const Value v)

Cast a Value object in Buffer.

If v has not the good type, a default value is constructed.

◆ Buffer() [3/3]

template<typename T>
maquina::Buffer< T >::Buffer ( size_t  size)

Allocate a buffer.

Parameters
sizeThe number of element to allocate in the buffer.

Member Function Documentation

◆ begin()

template<typename T>
iterator maquina::Buffer< T >::begin ( )

Return the beginning iterator.

◆ end()

template<typename T>
iterator maquina::Buffer< T >::end ( )

Return the ending iterator.

◆ grow()

template<typename T>
void maquina::Buffer< T >::grow ( size_t  size)

Grow the buffer in order for it to be large enough for this size.

If the buffer is already large enough, does nothing.

Parameters
sizeThe minimal number of element the buffer must have

◆ operator[]()

template<typename T>
reference maquina::Buffer< T >::operator[] ( size_t  i)

Returns the i-th array element.

This method is slower than using a buffer span

Parameters
iThe buffer element to access. Expect an access violation error if i is out of bounds.

◆ resize()

template<typename T>
void maquina::Buffer< T >::resize ( size_t  size,
const T &  d = T() 
)

Resize the buffer.

The previous data are copied in the new buffer.

Parameters
sizeThe number of element.
dThe value to use to fill the new allocated elements.

◆ write()

template<typename T>
gsl::span<value_type> maquina::Buffer< T >::write ( )

Return a writable accessor on the buffer data.

Use this buffer span for the best access performances.


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