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< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > STLAlignedAllocator< T, N >

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< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > >
void reserve (size_type inNewSize)
 Reserve array space.
void resize (size_type inNewSize)
 Resize array to new length.
void resize (size_type inNewSize, const uint8 &inValue)
 Resize array to new length and initialize all elements with inValue.
void clear ()
 Destruct all elements and set length to zero.
void assign (Iterator inBegin, Iterator inEnd)
 Replace the contents of this array with inBegin .. inEnd.
void assign (std::initializer_list< uint8 > inList)
 Replace the contents of this array with inList.
 Array ()=default
 Default constructor.
 Array (const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > &inAllocator)
 Constructor with allocator.
 Array (size_type inLength, const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > &inAllocator={ })
 Constructor with length.
 Array (size_type inLength, const uint8 &inValue, const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > &inAllocator={ })
 Constructor with length and value.
 Array (std::initializer_list< uint8 > inList, const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > &inAllocator={ })
 Constructor from initializer list.
 Array (const_iterator inBegin, const_iterator inEnd, const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > &inAllocator={ })
 Constructor from iterator.
 Array (const Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &inRHS)
 Copy constructor.
 Array (Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &&inRHS) noexcept
 Move constructor.
 ~Array ()
 Destruct all elements.
STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > & get_allocator ()
 Get the allocator.
const STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > & get_allocator () const
void push_back (const uint8 &inValue)
 Add element to the back of the array.
void push_back (uint8 &&inValue)
uint8emplace_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< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &inRHS) noexcept
 Swap the contents of two arrays.
void insert (const_iterator inPos, Iterator inBegin, Iterator inEnd)
void insert (const_iterator inPos, const uint8 &inValue)
iterator erase (const_iterator inIter)
 Remove one element from the array.
iterator erase (const_iterator inBegin, const_iterator inEnd)
 Remove multiple element from the array.
const_iterator begin () const
 Iterators.
const_iterator end () const
crev_it rbegin () const
crev_it rend () const
const_iterator cbegin () const
const_iterator cend () const
crev_it crbegin () const
crev_it crend () const
iterator begin ()
iterator end ()
rev_it rbegin ()
rev_it rend ()
const uint8data () const
uint8data ()
uint8operator[] (size_type inIdx)
 Access element.
const uint8operator[] (size_type inIdx) const
uint8at (size_type inIdx)
 Access element.
const uint8at (size_type inIdx) const
const uint8front () const
 First element in the array.
uint8front ()
const uint8back () const
 Last element in the array.
uint8back ()
Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > & operator= (const Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &inRHS)
 Assignment operator.
Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > & operator= (Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &&inRHS) noexcept
 Assignment move operator.
Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > & operator= (std::initializer_list< uint8 > inRHS)
 Assignment operator.
bool operator== (const Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &inRHS) const
 Comparing arrays.
bool operator!= (const Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > > &inRHS) const
uint64 GetHash () const
 Get hash for this array.

Additional Inherited Members

Public Types inherited from Array< uint8, STLAlignedAllocator< uint8, JPH_CACHE_LINE_SIZE > >
using value_type
using allocator_type
using size_type
using difference_type
using pointer
using const_pointer
using reference
using const_reference
using const_iterator
using iterator
using reverse_iterator
using const_reverse_iterator

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: