HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
Heph::ArithmeticBuffer< Tself, Tdata > Class Template Reference

base class for buffers that store arithmetic types. Provides operations and methods for arithmetic data. More...

#include <ArithmeticBuffer.h>

Inheritance diagram for Heph::ArithmeticBuffer< Tself, Tdata >:
Heph::BufferBase< Tself, Tdata > Heph::BufferArithmeticOperators< Tself, Tdata > Heph::BufferArithmeticOperators< Tself, Tdata, Tself, Tdata > Heph::BufferDivisionOperator< Tself, Tdata, Tself, Tdata > Heph::BufferMultiplicationOperator< Tself, Tdata, Tself, Tdata > Heph::BufferSubtractionOperator< Tself, Tdata, Tself, Tdata > Heph::BufferAdditionOperator< Tself, Tdata, Tself, Tdata > Heph::BufferDivisionOperator< Tself, Tdata, Tdata, Tdata > Heph::BufferMultiplicationOperator< Tself, Tdata, Tdata, Tdata > Heph::BufferSubtractionOperator< Tself, Tdata, Tdata, Tdata > Heph::BufferAdditionOperator< Tself, Tdata, Tdata, Tdata > Heph::SignedArithmeticBuffer< Tself, Tdata >

Public Member Functions

virtual ~ArithmeticBuffer ()=default
 
Tdata Min () const
 
Tdata Max () const
 
double Rms () const
 
- Public Member Functions inherited from Heph::BufferBase< Tself, Tdata >
virtual ~BufferBase ()
 
virtual Tself operator<< (size_t rhs) const
 
virtual Tself & operator<<= (size_t rhs)
 
virtual Tself operator>> (size_t rhs) const
 
virtual Tself & operator>>= (size_t rhs)
 
virtual bool operator== (const Tself &rhs) const
 
virtual bool operator!= (const Tself &rhs) const
 
Tdata & operator[] (size_t index) const
 
size_t Size () const
 
size_t SizeAsByte () const
 
Tdata & At (size_t index) const
 
virtual bool IsEmpty () const
 
virtual void Reset ()
 
virtual void Release ()
 
virtual Tself SubBuffer (size_t index, size_t size) const
 
virtual void Prepend (const Tself &rhs)
 
virtual void Append (const Tself &rhs)
 
virtual void Insert (const Tself &rhs, size_t index)
 
virtual void Cut (size_t index, size_t size)
 
virtual void Replace (const Tself &rhs, size_t index)
 
virtual void Replace (const Tself &rhs, size_t index, size_t size)
 
virtual void Resize (size_t newSize)
 
virtual void Reverse ()
 
Tdata * begin () const
 
Tdata * end () const
 
- Public Member Functions inherited from Heph::BufferArithmeticOperators< Tself, Tdata >
 BufferArithmeticOperators (const BufferArithmeticOperators &)=delete
 
BufferArithmeticOperatorsoperator= (const BufferArithmeticOperators &)=delete
 
- Public Member Functions inherited from Heph::BufferAdditionOperator< Tself, Tdata, Tdata, Tdata >
 BufferAdditionOperator (const BufferAdditionOperator &)=delete
 
BufferAdditionOperatoroperator= (const BufferAdditionOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferSubtractionOperator< Tself, Tdata, Tdata, Tdata >
 BufferSubtractionOperator (const BufferSubtractionOperator &)=delete
 
BufferSubtractionOperatoroperator= (const BufferSubtractionOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferMultiplicationOperator< Tself, Tdata, Tdata, Tdata >
 BufferMultiplicationOperator (const BufferMultiplicationOperator &)=delete
 
BufferMultiplicationOperatoroperator= (const BufferMultiplicationOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferDivisionOperator< Tself, Tdata, Tdata, Tdata >
 BufferDivisionOperator (const BufferDivisionOperator &)=delete
 
BufferDivisionOperatoroperator= (const BufferDivisionOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferArithmeticOperators< Tself, Tdata, Tself, Tdata >
 BufferArithmeticOperators (const BufferArithmeticOperators &)=delete
 
BufferArithmeticOperatorsoperator= (const BufferArithmeticOperators &)=delete
 
- Public Member Functions inherited from Heph::BufferAdditionOperator< Tself, Tdata, Tself, Tdata >
 BufferAdditionOperator (const BufferAdditionOperator &)=delete
 
BufferAdditionOperatoroperator= (const BufferAdditionOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferSubtractionOperator< Tself, Tdata, Tself, Tdata >
 BufferSubtractionOperator (const BufferSubtractionOperator &)=delete
 
BufferSubtractionOperatoroperator= (const BufferSubtractionOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferMultiplicationOperator< Tself, Tdata, Tself, Tdata >
 BufferMultiplicationOperator (const BufferMultiplicationOperator &)=delete
 
BufferMultiplicationOperatoroperator= (const BufferMultiplicationOperator &)=delete
 
- Public Member Functions inherited from Heph::BufferDivisionOperator< Tself, Tdata, Tself, Tdata >
 BufferDivisionOperator (const BufferDivisionOperator &)=delete
 
BufferDivisionOperatoroperator= (const BufferDivisionOperator &)=delete
 

Protected Member Functions

 ArithmeticBuffer ()
 
 ArithmeticBuffer (size_t size)
 
 ArithmeticBuffer (size_t size, BufferFlags flags)
 
 ArithmeticBuffer (const std::initializer_list< Tdata > &rhs)
 
 ArithmeticBuffer (const ArithmeticBuffer &rhs)
 
 ArithmeticBuffer (ArithmeticBuffer &&rhs) noexcept
 
- Protected Member Functions inherited from Heph::BufferBase< Tself, Tdata >
 BufferBase ()
 
 BufferBase (size_t size)
 
 BufferBase (size_t size, BufferFlags flags)
 
 BufferBase (const std::initializer_list< Tdata > &rhs)
 
 BufferBase (const BufferBase &rhs)
 
 BufferBase (BufferBase &&rhs) noexcept
 
Tself & operator= (const std::initializer_list< Tdata > &rhs)
 
Tself & operator= (const Tself &rhs)
 
Tself & operator= (Tself &&rhs) noexcept
 

Static Protected Attributes

static constexpr Tdata MIN_ELEMENT = std::numeric_limits<Tdata>::lowest()
 
static constexpr Tdata MAX_ELEMENT = std::numeric_limits<Tdata>::max()
 

Additional Inherited Members

- Static Protected Member Functions inherited from Heph::BufferBase< Tself, Tdata >
static size_t SizeAsByte (size_t size)
 
template<typename U = Tdata>
static std::enable_if< std::is_class< U >::value >::type Initialize (U *pData, U *pDataEnd)
 
template<typename U = Tdata>
static std::enable_if<!std::is_class< U >::value >::type Initialize (U *pData, U *pDataEnd)
 
static Tdata * Allocate (size_t size_byte)
 
static Tdata * AllocateUninitialized (size_t size_byte)
 
static Tdata * SubBuffer (Tdata *pThisData, size_t thisSize_byte, size_t index_byte, size_t subBufferSize_byte)
 
static Tdata * Prepend (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte)
 
static Tdata * Append (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte)
 
static Tdata * Insert (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte, size_t index_byte)
 
static Tdata * Cut (Tdata *pThisData, size_t thisSize_byte, size_t index_byte, size_t &cutSize_byte)
 
static void Replace (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte, size_t index_byte)
 
- Protected Attributes inherited from Heph::BufferBase< Tself, Tdata >
Tdata * pData
 
size_t size
 

Detailed Description

template<class Tself, typename Tdata>
class Heph::ArithmeticBuffer< Tself, Tdata >

base class for buffers that store arithmetic types. Provides operations and methods for arithmetic data.

Template Parameters
TselfType of the final buffer that inherits from this class (CRTP).
TdataType of the data the buffer stores, must be arithmetic type.

Constructor & Destructor Documentation

◆ ArithmeticBuffer() [1/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( )
inlineprotected

creates a new instance and initializes it with default values.

◆ ArithmeticBuffer() [2/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( size_t size)
inlineexplicitprotected

creates a new instance and initializes it with the provided values.

Parameters
sizenumber of elements the buffer will store.

◆ ArithmeticBuffer() [3/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( size_t size,
BufferFlags flags )
inlineprotected

creates a new instance and initializes it with the provided values.

Parameters
sizenumber of elements the buffer will store.
flagsflags.

◆ ArithmeticBuffer() [4/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( const std::initializer_list< Tdata > & rhs)
inlineprotected

creates a new instance and initializes it with the provided values.

Parameters
rhsa list of elements the buffer will store.

◆ ArithmeticBuffer() [5/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( const ArithmeticBuffer< Tself, Tdata > & rhs)
inlineprotected

creates a new instance and copies the rhs's data to it.

Parameters
rhsinstance whose data will be copied.

◆ ArithmeticBuffer() [6/6]

template<class Tself , typename Tdata >
Heph::ArithmeticBuffer< Tself, Tdata >::ArithmeticBuffer ( ArithmeticBuffer< Tself, Tdata > && rhs)
inlineprotectednoexcept

creates a new instance and moves the rhs's data to it.

Parameters
rhsinstance whose data will be moved.

◆ ~ArithmeticBuffer()

template<class Tself , typename Tdata >
virtual Heph::ArithmeticBuffer< Tself, Tdata >::~ArithmeticBuffer ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ Min()

template<class Tself , typename Tdata >
Tdata Heph::ArithmeticBuffer< Tself, Tdata >::Min ( ) const
inline

gets the minimum value stored in the buffer.

◆ Max()

template<class Tself , typename Tdata >
Tdata Heph::ArithmeticBuffer< Tself, Tdata >::Max ( ) const
inline

gets the maximum value stored in the buffer.

◆ Rms()

template<class Tself , typename Tdata >
double Heph::ArithmeticBuffer< Tself, Tdata >::Rms ( ) const
inline

calculates the root mean square.

Member Data Documentation

◆ MIN_ELEMENT

template<class Tself , typename Tdata >
Tdata Heph::ArithmeticBuffer< Tself, Tdata >::MIN_ELEMENT = std::numeric_limits<Tdata>::lowest()
staticconstexprprotected

element with the minimum value.

◆ MAX_ELEMENT

template<class Tself , typename Tdata >
Tdata Heph::ArithmeticBuffer< Tself, Tdata >::MAX_ELEMENT = std::numeric_limits<Tdata>::max()
staticconstexprprotected

element with the maximum value.