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

Additional Inherited Members

- Public Types inherited from Array< T, Allocator >
using value_type = T
 
using allocator_type = Allocator
 
using size_type = size_t
 
using difference_type = typename Allocator::difference_type
 
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: