Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
ByteBuffer Class Reference

Simple byte buffer, aligned to a cache line. More...

#include <ByteBuffer.h>

Inheritance diagram for ByteBuffer:
Array< T, Allocator > STLAllocator< T >

Public Member Functions

size_t Align (size_t inSize)
 Align the size to a multiple of inSize, returns the length after alignment. More...
 
template<class Type >
Type * Allocate (size_t inSize=1)
 Allocate block of data of inSize elements and return the pointer. More...
 
template<class Type >
void AppendVector (const Array< Type > &inData)
 Append inData to the buffer. More...
 
template<class Type >
const Type * Get (size_t inPosition) const
 Get object at inPosition (an offset in bytes) More...
 
template<class Type >
Type * Get (size_t inPosition)
 Get object at inPosition (an offset in bytes) More...
 
- Public Member Functions inherited from Array< T, Allocator >
void reserve (size_type inNewSize)
 Reserve array space. More...
 
void resize (size_type inNewSize)
 Resize array to new length. More...
 
void resize (size_type inNewSize, const T &inValue)
 Resize array to new length and initialize all elements with inValue. More...
 
void clear ()
 Destruct all elements and set length to zero. More...
 
template<class Iterator >
void assign (Iterator inBegin, Iterator inEnd)
 Replace the contents of this array with inBegin .. inEnd. More...
 
void assign (std::initializer_list< T > inList)
 Replace the contents of this array with inList. More...
 
 Array ()=default
 Default constructor. More...
 
 Array (const Allocator &inAllocator)
 Constructor with allocator. More...
 
 Array (size_type inLength, const Allocator &inAllocator={ })
 Constructor with length. More...
 
 Array (size_type inLength, const T &inValue, const Allocator &inAllocator={ })
 Constructor with length and value. More...
 
 Array (std::initializer_list< T > inList, const Allocator &inAllocator={ })
 Constructor from initializer list. More...
 
 Array (const_iterator inBegin, const_iterator inEnd, const Allocator &inAllocator={ })
 Constructor from iterator. More...
 
 Array (const Array< T, Allocator > &inRHS)
 Copy constructor. More...
 
 Array (Array< T, Allocator > &&inRHS) noexcept
 Move constructor. More...
 
 ~Array ()
 Destruct all elements. More...
 
Allocator & get_allocator ()
 Get the allocator. More...
 
const Allocator & get_allocator () const
 
void push_back (const T &inValue)
 Add element to the back of the array. More...
 
void push_back (T &&inValue)
 
template<class... A>
T & emplace_back (A &&... inValue)
 Construct element at the back of the array. More...
 
void pop_back ()
 Remove element from the back of the array. More...
 
bool empty () const
 Returns true if there are no elements in the array. More...
 
size_type size () const
 Returns amount of elements in the array. More...
 
size_type capacity () const
 Returns maximum amount of elements the array can hold. More...
 
void shrink_to_fit ()
 Reduce the capacity of the array to match its size. More...
 
void swap (Array< T, Allocator > &inRHS) noexcept
 Swap the contents of two arrays. More...
 
template<class Iterator >
void insert (const_iterator inPos, Iterator inBegin, Iterator inEnd)
 
void insert (const_iterator inPos, const T &inValue)
 
void erase (const_iterator inIter)
 Remove one element from the array. More...
 
void erase (const_iterator inBegin, const_iterator inEnd)
 Remove multiple element from the array. More...
 
const_iterator begin () const
 Iterators. More...
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator begin ()
 
iterator end ()
 
const T * data () const
 
T * data ()
 
T & operator[] (size_type inIdx)
 Access element. More...
 
const T & operator[] (size_type inIdx) const
 
T & at (size_type inIdx)
 Access element. More...
 
const T & at (size_type inIdx) const
 
const T & front () const
 First element in the array. More...
 
T & front ()
 
const T & back () const
 Last element in the array. More...
 
T & back ()
 
Array< T, Allocator > & operator= (const Array< T, Allocator > &inRHS)
 Assignment operator. More...
 
Array< T, Allocator > & operator= (Array< T, Allocator > &&inRHS) noexcept
 Assignment move operator. More...
 
Array< T, Allocator > & operator= (std::initializer_list< T > inRHS)
 Assignment operator. More...
 
bool operator== (const Array< T, Allocator > &inRHS) const
 Comparing arrays. More...
 
bool operator!= (const Array< T, Allocator > &inRHS) const
 

Additional Inherited Members

- Public Types inherited from Array< T, Allocator >
using value_type = T
 
using size_type = size_t
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using const_iterator = const T *
 
using iterator = T *
 

Detailed Description

Simple byte buffer, aligned to a cache line.

Member Function Documentation

◆ Align()

size_t ByteBuffer::Align ( size_t  inSize)
inline

Align the size to a multiple of inSize, returns the length after alignment.

◆ Allocate()

template<class Type >
Type * ByteBuffer::Allocate ( size_t  inSize = 1)
inline

Allocate block of data of inSize elements and return the pointer.

◆ AppendVector()

template<class Type >
void ByteBuffer::AppendVector ( const Array< Type > &  inData)
inline

Append inData to the buffer.

◆ Get() [1/2]

template<class Type >
Type * ByteBuffer::Get ( size_t  inPosition)
inline

Get object at inPosition (an offset in bytes)

◆ Get() [2/2]

template<class Type >
const Type * ByteBuffer::Get ( size_t  inPosition) const
inline

Get object at inPosition (an offset in bytes)


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