NDEVR
API Documentation
Buffer< t_type, t_memory_manager >

The equivelent of std::vector but with a bit more control. More...

Inherits BufferBase.

Inherited by QueueBuffer< OverrideMatrixValue, BufferAllocator< OverrideMatrixValue, AlignmentDeterminator< OverrideMatrixValue >::Size(), true > > [protected], QueueBuffer< PositionReading, BufferAllocator< PositionReading, AlignmentDeterminator< PositionReading >::Size(), true > > [protected], QueueBuffer< IndexMatchQueue::NodeA > [protected], QueueBuffer< IndexMatchQueue::NodeB > [protected], QueueBuffer< OrientationReading > [protected], and QueueBuffer< t_type, t_memory_manager > [protected].

Collaboration diagram for Buffer< t_type, t_memory_manager >:
[legend]

Public Member Functions

constexpr Buffer () noexcept
 Creates an empty buffer.
constexpr Buffer (Buffer &&buffer) noexcept
 Optimized move constructor.
constexpr Buffer (const Buffer &buffer)
 Optimized copy consturctor.
template<class t_iterator>
 Buffer (const t_iterator &begin, const t_iterator &end)
 Constructor that allows for an iterator begin and end.
constexpr Buffer (const t_type *buffer, t_index_type size)
 Constructor that allows for an a start pointer, and size, and adds all elements to the buffer.
 Buffer (std::initializer_list< t_type > l)
 Constructor that allows for an initializer list, allowing { and } to be used.
 Buffer (t_index_type size)
 Constructor that reserves space.
constexpr Buffer (t_index_type size, const t_type &fill_object)
 Constructor that allows for a set size, and then fills the buffer with the specified object.
 ~Buffer ()
void add (const t_type &object)
 Adds object to the end of the buffer.
void add (t_index_type location, const t_type &object)
 Adds and object to a specific location.
void add (t_index_type location, t_type &&object)
 Adds an object to a specific location.
void add (t_type &&object)
 Adds object to the end of the buffer.
template<bool t_managed>
void addSpace (t_index_type space_to_add)
 Adds a space to the end of the buffer.
operator decltype auto ()
 Gets the first location of type* in the array.
operator decltype auto () const
 Gets the first location of type* in the array.
sint04 compare (const Buffer &value) const
 Compares this Buffer to another to determine their relative ordering.
template<class t_other_type, class t_other_memory_manager = t_memory_manager>
Buffer< t_other_type, t_other_memory_manager > getAs () const
 Gets a copy of this buffer, with filled objects t_other_type, where all objects are created using the contents of this buffer.
void insert (const t_index_type location, const t_type *buffer)
 Inserts data into the buffer, assumed to be null terminated.
void insert (t_index_type location, const t_type &object)
 Adds an object to a specific location.
void insert (t_index_type location, t_type &&object)
 Adds an object to a specific location.
void insert (t_index_type offset, const t_type *const buffer, t_index_type buffer_size)
 Inserts data into the buffer.
void removeAllOrdered (const t_type &object)
 Removes all instances of the object.
template<class t_functor>
void removeAllOrderedFn (const t_functor &functor)
 Removes all items based on the functor.
template<class t_functor>
void removeAllUnordered (const t_functor &functor)
 Removes all items based on the functor.
void removeAllUnordered (const t_type &object)
 Removes all unordered described by object.

Detailed Description

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
class Buffer< t_type, t_memory_manager >

The equivelent of std::vector but with a bit more control.


The basic array unit of the library.

t_type = what the buffer holds t_index_type = the index reference (default uint04 but can be made uint08 for large buffer support) t_memory_allocator = The object in charge of object allocation when creating space t_memory_manager = The thing that actually stores the memory Author: Tyler Parke

Date: 2017-11-19

See also
BufferAllocator, Dictionary, Set, BitAlignedBuffer

Definition at line 57 of file Buffer.hpp.

Constructor & Destructor Documentation

◆ Buffer()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
Buffer< t_type, t_memory_manager >::Buffer ( t_index_type size)
inlineexplicit

Constructor that reserves space.

Note that the buffer will still be empty, but allocation will be more efficient using add or inserts.

Definition at line 89 of file Buffer.hpp.

◆ ~Buffer()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
Buffer< t_type, t_memory_manager >::~Buffer ( )
inline
    Destructor.

Author: Tyler Parke

Date: 2017-11-19

Definition at line 147 of file Buffer.hpp.

Member Function Documentation

◆ add() [1/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::add ( const t_type & object)
inline

Adds object to the end of the buffer.

Parameters
[in]objectThe object to add to the end.

Definition at line 199 of file Buffer.hpp.

◆ add() [2/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::add ( t_index_type location,
const t_type & object )
inline

Adds and object to a specific location.

Equivelent to insert

Parameters
[in]locationThe index where the object should be inserted.
[in]objectThe object to add to the buffer at the specified location.

Definition at line 210 of file Buffer.hpp.

◆ add() [3/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::add ( t_index_type location,
t_type && object )
inline

Adds an object to a specific location.

Equivelent to insert.

Parameters
[in]locationThe index where the object should be inserted.
[in]objectThe object to add to the buffer at the specified location.

Definition at line 221 of file Buffer.hpp.

◆ add() [4/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::add ( t_type && object)
inline

◆ addSpace()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
template<bool t_managed>
void Buffer< t_type, t_memory_manager >::addSpace ( t_index_type space_to_add)
inline

Adds a space to the end of the buffer.

Parameters
[in]space_to_addThe number of elements to add.

Definition at line 400 of file Buffer.hpp.

Referenced by RealSenseServer::ReadNetworkPacket().

◆ auto() [1/2]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
operator decltype Buffer< t_type, t_memory_manager >::auto ( )
inlinenodiscard

Gets the first location of type* in the array.

Returns
A const pointer to the beginning of the array.

Definition at line 165 of file Buffer.hpp.

◆ auto() [2/2]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
operator decltype Buffer< t_type, t_memory_manager >::auto ( ) const
inlinenodiscard

Gets the first location of type* in the array.

Returns
A const pointer to the beginning of the array.

Definition at line 156 of file Buffer.hpp.

◆ compare()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
sint04 Buffer< t_type, t_memory_manager >::compare ( const Buffer< t_type, t_memory_manager > & value) const
inlinenodiscard

Compares this Buffer to another to determine their relative ordering.

Parameters
[in]valueThe Buffer to compare to this object.
Returns
Negative if 'value' is less than '', 0 if they are equal, or positive if it is greater.

Definition at line 476 of file Buffer.hpp.

◆ getAs()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
template<class t_other_type, class t_other_memory_manager = t_memory_manager>
Buffer< t_other_type, t_other_memory_manager > Buffer< t_type, t_memory_manager >::getAs ( ) const
inlinenodiscard

Gets a copy of this buffer, with filled objects t_other_type, where all objects are created using the contents of this buffer.

Returns
a copy of the buffer.

Definition at line 176 of file Buffer.hpp.

◆ insert() [1/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::insert ( const t_index_type location,
const t_type * buffer )
inline

Inserts data into the buffer, assumed to be null terminated.

Parameters
[in]locationThe offset where the data should be inserted.
[in]bufferThe buffer.

Definition at line 382 of file Buffer.hpp.

◆ insert() [2/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::insert ( t_index_type location,
const t_type & object )
inline

Adds an object to a specific location.

Parameters
[in]locationThe index where the object should be inserted.
[in]objectThe object to add to the buffer at the specified location.

Definition at line 233 of file Buffer.hpp.

Referenced by Buffer< t_type, t_memory_manager >< File, 64 >::insert(), and SparseBlockMatrix< MatrixType >::slice().

◆ insert() [3/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::insert ( t_index_type location,
t_type && object )
inline

Adds an object to a specific location.

Parameters
[in]locationThe index where the object should be inserted.
[in]objectThe object to add to the buffer at the specified location.

Definition at line 244 of file Buffer.hpp.

◆ insert() [4/4]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::insert ( t_index_type offset,
const t_type *const buffer,
t_index_type buffer_size )
inline

Inserts data into the buffer.

Parameters
[in]offsetThe offset where the data should be inserted.
[in]bufferThe buffer of objects to insert.
[in]buffer_sizenumber of elements of the data to insert.

Definition at line 361 of file Buffer.hpp.

◆ removeAllOrdered()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::removeAllOrdered ( const t_type & object)
inline

Removes all instances of the object.

Function is slower than removeAllUnordered but order is preserved.

Parameters
[in]objectThe object.

Definition at line 719 of file Buffer.hpp.

◆ removeAllOrderedFn()

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
template<class t_functor>
void Buffer< t_type, t_memory_manager >::removeAllOrderedFn ( const t_functor & functor)
inline

Removes all items based on the functor.

The functor should return true if the item is deleted or false if the item should stay in the array. Function is slower than removeAllUnordered but order is preserved.

Parameters
[in]functorA functor that takes a value and returns true if value is to be removed, or false otherwise.

Definition at line 739 of file Buffer.hpp.

◆ removeAllUnordered() [1/2]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
template<class t_functor>
void Buffer< t_type, t_memory_manager >::removeAllUnordered ( const t_functor & functor)
inline

Removes all items based on the functor.

The functor should return true if the item is deleted or false if the item should stay in the array. Faster function then removeAllOrdered but order is not preserved.

Warning
This function does not preserve the order of the buffer.
Parameters
[in]functorA functor that takes a value and returns true if value is to be removed, or false otherwise.

Definition at line 701 of file Buffer.hpp.

◆ removeAllUnordered() [2/2]

template<class t_type, class t_memory_manager = BufferAllocator<t_type, AlignmentDeterminator<t_type>::Size(), ObjectInfo<t_type>::Primitive, uint04, false>>
void Buffer< t_type, t_memory_manager >::removeAllUnordered ( const t_type & object)
inline

Removes all unordered described by object.

This function does not preserve the order of the buffer.

Warning
This function does not preserve the order of the buffer.
Parameters
[in]objectThe object to remove.

Definition at line 679 of file Buffer.hpp.


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