FlowEngine 7.530
Photogrammetry Software Development Kit
Loading...
Searching...
No Matches
FlowEngine::Buffer< T > Struct Template Reference

Holds a (mutable) non_owning pointer and a size Used to marshal memory buffers as arguments in a safely manner. More...

#include <CommonDef.h>

Public Member Functions

 Buffer ()=default
 Represents an empty buffer.
 
 Buffer (T *d, Size s)
 Construct a buffer from a (mutable) pointer and a size.
 
template<std::size_t N>
 Buffer (T(&fixedSizeArray)[N])
 Implicit conversion from a fixed-size array.
 
 Buffer (std::vector< T > &v)
 Implicit conversion from a std::vector.
 
 Buffer (std::vector< T > &&v)=delete
 Prohibits implicit conversion from a temporary std::vector.
 
 operator bool () const
 Evaluates to true if this buffer holds valid data, false otherwise.
 
T * begin ()
 Iteration support.
 
T * end ()
 Iteration support.
 
T & operator[] (std::size_t index)
 Indexed access.
 
const T & operator[] (std::size_t index) const
 Indexed access.
 

Public Attributes

T * data = nullptr
 Pointer to the (mutable) data.
 
Size count = 0
 Number of elements the pointer points to.
 

Detailed Description

template<typename T>
struct FlowEngine::Buffer< T >

Holds a (mutable) non_owning pointer and a size Used to marshal memory buffers as arguments in a safely manner.

Constructor & Destructor Documentation

◆ Buffer() [1/5]

template<typename T >
FlowEngine::Buffer< T >::Buffer ( )
default

Represents an empty buffer.

◆ Buffer() [2/5]

template<typename T >
FlowEngine::Buffer< T >::Buffer ( T *  d,
Size  s 
)
inline

Construct a buffer from a (mutable) pointer and a size.

◆ Buffer() [3/5]

template<typename T >
template<std::size_t N>
FlowEngine::Buffer< T >::Buffer ( T(&)  fixedSizeArray[N])
inline

Implicit conversion from a fixed-size array.

◆ Buffer() [4/5]

template<typename T >
FlowEngine::Buffer< T >::Buffer ( std::vector< T > &  v)
inline

Implicit conversion from a std::vector.

◆ Buffer() [5/5]

template<typename T >
FlowEngine::Buffer< T >::Buffer ( std::vector< T > &&  v)
delete

Prohibits implicit conversion from a temporary std::vector.

Member Function Documentation

◆ begin()

template<typename T >
T * FlowEngine::Buffer< T >::begin ( )
inline

Iteration support.

◆ end()

template<typename T >
T * FlowEngine::Buffer< T >::end ( )
inline

Iteration support.

◆ operator bool()

template<typename T >
FlowEngine::Buffer< T >::operator bool ( ) const
inlineexplicit

Evaluates to true if this buffer holds valid data, false otherwise.

◆ operator[]() [1/2]

template<typename T >
T & FlowEngine::Buffer< T >::operator[] ( std::size_t  index)
inline

Indexed access.

◆ operator[]() [2/2]

template<typename T >
const T & FlowEngine::Buffer< T >::operator[] ( std::size_t  index) const
inline

Indexed access.

Member Data Documentation

◆ count

template<typename T >
Size FlowEngine::Buffer< T >::count = 0

Number of elements the pointer points to.

◆ data

template<typename T >
T* FlowEngine::Buffer< T >::data = nullptr

Pointer to the (mutable) data.