arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Vector< T > Class Template Reference

Vector implementation which provides the most important methods as defined by std::vector. This class it is quite handy to have and most of the times quite better then dealing with raw c arrays. More...

#include <Vector.h>

Classes

class  iterator
 Iterator for the Vector class. More...
 

Public Member Functions

 Vector (Allocator &allocator)
 Constructor with only allocator.
 
 Vector (const Vector< T > &copyFrom)
 copy constructor
 
 Vector (int size, T value, Allocator &allocator=DefaultAllocator)
 Allocate size and initialize array.
 
 Vector (size_t len=0, Allocator &allocator=DefaultAllocator)
 Default constructor: size 0 with DefaultAllocator: The len defines the capacity.
 
 Vector (T *from, T *to, Allocator &allocator=DefaultAllocator)
 legacy constructor with pointer range
 
template<typename TT , int N>
 Vector (TT(&a)[N])
 convert from c array
 
 Vector (Vector< T > &&moveFrom)
 Move constructor.
 
virtual ~Vector ()
 Destructor.
 
void assign (iterator v1, iterator v2)
 
void assign (size_t number, T value)
 
T & back ()
 
iterator begin ()
 
int capacity ()
 
void clear ()
 
bool contains (T obj)
 
T * data ()
 
bool empty ()
 
iterator end ()
 
void erase (int pos)
 
void erase (iterator it)
 
int indexOf (T obj)
 
 operator bool () const
 
Vector< T > & operator= (const Vector< T > &copyFrom)
 copy operator
 
Vectoroperator= (Vector &&moveFrom)
 Move operator.
 
T & operator[] (const int index) const
 
T & operator[] (int index)
 
void pop_back ()
 
void pop_front ()
 
void push_back (T &&value)
 
void push_back (T &value)
 
void push_front (T &&value)
 
void push_front (T &value)
 
void reset ()
 
bool resize (size_t newSize)
 
bool resize (size_t newSize, T value)
 
void setAllocator (Allocator &allocator)
 
void shrink_to_fit ()
 
int size ()
 
void swap (T &other)
 
void swap (Vector< T > &in)
 

Protected Member Functions

void cleanup (T *data, int from, int to)
 
void deleteArray (T *oldData, int oldBufferLen)
 
T * newArray (int newSize)
 
void resize_internal (int newSize, bool copy, bool shrink=false)
 

Protected Attributes

int bufferLen = 0
 
int len = 0
 
Allocatorp_allocator = &DefaultAllocator
 
T * p_data = nullptr
 

Detailed Description

template<class T>
class audio_tools::Vector< T >

Vector implementation which provides the most important methods as defined by std::vector. This class it is quite handy to have and most of the times quite better then dealing with raw c arrays.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ Vector() [1/7]

template<class T >
Vector ( size_t  len = 0,
Allocator allocator = DefaultAllocator 
)
inline

Default constructor: size 0 with DefaultAllocator: The len defines the capacity.

◆ Vector() [2/7]

template<class T >
Vector ( Allocator allocator)
inline

Constructor with only allocator.

◆ Vector() [3/7]

template<class T >
Vector ( int  size,
value,
Allocator allocator = DefaultAllocator 
)
inline

Allocate size and initialize array.

◆ Vector() [4/7]

template<class T >
Vector ( Vector< T > &&  moveFrom)
inline

Move constructor.

◆ Vector() [5/7]

template<class T >
Vector ( const Vector< T > &  copyFrom)
inline

copy constructor

◆ Vector() [6/7]

template<class T >
template<typename TT , int N>
Vector ( TT(&)  a[N])
inline

convert from c array

◆ Vector() [7/7]

template<class T >
Vector ( T *  from,
T *  to,
Allocator allocator = DefaultAllocator 
)
inline

legacy constructor with pointer range

◆ ~Vector()

template<class T >
virtual ~Vector ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ assign() [1/2]

template<class T >
void assign ( iterator  v1,
iterator  v2 
)
inline

◆ assign() [2/2]

template<class T >
void assign ( size_t  number,
value 
)
inline

◆ back()

template<class T >
T & back ( )
inline

◆ begin()

template<class T >
iterator begin ( )
inline

◆ capacity()

template<class T >
int capacity ( )
inline

◆ cleanup()

template<class T >
void cleanup ( T *  data,
int  from,
int  to 
)
inlineprotected

◆ clear()

template<class T >
void clear ( )
inline

◆ contains()

template<class T >
bool contains ( obj)
inline

◆ data()

template<class T >
T * data ( )
inline

◆ deleteArray()

template<class T >
void deleteArray ( T *  oldData,
int  oldBufferLen 
)
inlineprotected

◆ empty()

template<class T >
bool empty ( )
inline

◆ end()

template<class T >
iterator end ( )
inline

◆ erase() [1/2]

template<class T >
void erase ( int  pos)
inline

◆ erase() [2/2]

template<class T >
void erase ( iterator  it)
inline

◆ indexOf()

template<class T >
int indexOf ( obj)
inline

◆ newArray()

template<class T >
T * newArray ( int  newSize)
inlineprotected

◆ operator bool()

template<class T >
operator bool ( ) const
inline

◆ operator=() [1/2]

template<class T >
Vector< T > & operator= ( const Vector< T > &  copyFrom)
inline

copy operator

◆ operator=() [2/2]

template<class T >
Vector & operator= ( Vector< T > &&  moveFrom)
inline

Move operator.

◆ operator[]() [1/2]

template<class T >
T & operator[] ( const int  index) const
inline

◆ operator[]() [2/2]

template<class T >
T & operator[] ( int  index)
inline

◆ pop_back()

template<class T >
void pop_back ( )
inline

◆ pop_front()

template<class T >
void pop_front ( )
inline

◆ push_back() [1/2]

template<class T >
void push_back ( T &&  value)
inline

◆ push_back() [2/2]

template<class T >
void push_back ( T &  value)
inline

◆ push_front() [1/2]

template<class T >
void push_front ( T &&  value)
inline

◆ push_front() [2/2]

template<class T >
void push_front ( T &  value)
inline

◆ reset()

template<class T >
void reset ( )
inline

◆ resize() [1/2]

template<class T >
bool resize ( size_t  newSize)
inline

◆ resize() [2/2]

template<class T >
bool resize ( size_t  newSize,
value 
)
inline

◆ resize_internal()

template<class T >
void resize_internal ( int  newSize,
bool  copy,
bool  shrink = false 
)
inlineprotected

◆ setAllocator()

template<class T >
void setAllocator ( Allocator allocator)
inline

◆ shrink_to_fit()

template<class T >
void shrink_to_fit ( )
inline

◆ size()

template<class T >
int size ( )
inline

◆ swap() [1/2]

template<class T >
void swap ( T &  other)
inline

◆ swap() [2/2]

template<class T >
void swap ( Vector< T > &  in)
inline

Member Data Documentation

◆ bufferLen

template<class T >
int bufferLen = 0
protected

◆ len

template<class T >
int len = 0
protected

◆ p_allocator

template<class T >
Allocator* p_allocator = &DefaultAllocator
protected

◆ p_data

template<class T >
T* p_data = nullptr
protected

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