arduino-audio-driver
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 (int size, T value)
 allocate size and initialize array More...
 
 Vector (size_t len=20)
 default constructor More...
 
 Vector (T *from, T *to)
 legacy constructor with pointer range More...
 
 Vector (Vector< T > &&moveFrom)=default
 
 Vector (Vector< T > &copyFrom)
 copy constructor More...
 
virtual ~Vector ()
 Destructor. More...
 
void assign (iterator v1, iterator v2)
 
void assign (size_t number, T value)
 
T & back ()
 
iterator begin ()
 
int capacity ()
 
void clear ()
 
T * data ()
 
bool empty ()
 
iterator end ()
 
void erase (int pos)
 
void erase (iterator it)
 
 operator bool () const
 
Vector< T > & operator= (Vector< T > &copyFrom)
 
T & operator[] (const int index) const
 
T & operator[] (int index)
 
void pop_back ()
 
void pop_front ()
 
void push_back (T value)
 
void push_front (T value)
 
bool resize (int newSize)
 
bool resize (int newSize, T value)
 
void shrink_to_fit ()
 
int size ()
 
void swap (Vector< T > &in)
 

Protected Member Functions

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

Protected Attributes

int bufferLen =0
 
int len = 0
 
T * p_data = nullptr
 

Detailed Description

template<class T>
class audio_driver_local::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/5]

Vector ( size_t  len = 20)
inline

default constructor

◆ Vector() [2/5]

Vector ( int  size,
value 
)
inline

allocate size and initialize array

◆ Vector() [3/5]

Vector ( Vector< T > &&  moveFrom)
inlinedefault

◆ Vector() [4/5]

Vector ( Vector< T > &  copyFrom)
inline

copy constructor

◆ Vector() [5/5]

Vector ( T *  from,
T *  to 
)
inline

legacy constructor with pointer range

◆ ~Vector()

virtual ~Vector ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ assign() [1/2]

void assign ( iterator  v1,
iterator  v2 
)
inline

◆ assign() [2/2]

void assign ( size_t  number,
value 
)
inline

◆ back()

T& back ( )
inline

◆ begin()

iterator begin ( )
inline

◆ capacity()

int capacity ( )
inline

◆ cleanup()

void cleanup ( T *  data,
int  from,
int  to 
)
inlineprotected

◆ clear()

void clear ( )
inline

◆ data()

T* data ( )
inline

◆ empty()

bool empty ( )
inline

◆ end()

iterator end ( )
inline

◆ erase() [1/2]

void erase ( int  pos)
inline

◆ erase() [2/2]

void erase ( iterator  it)
inline

◆ operator bool()

operator bool ( ) const
inline

◆ operator=()

Vector<T>& operator= ( Vector< T > &  copyFrom)
inline

◆ operator[]() [1/2]

T& operator[] ( const int  index) const
inline

◆ operator[]() [2/2]

T& operator[] ( int  index)
inline

◆ pop_back()

void pop_back ( )
inline

◆ pop_front()

void pop_front ( )
inline

◆ push_back()

void push_back ( value)
inline

◆ push_front()

void push_front ( value)
inline

◆ resize() [1/2]

bool resize ( int  newSize)
inline

◆ resize() [2/2]

bool resize ( int  newSize,
value 
)
inline

◆ resize_internal()

void resize_internal ( int  newSize,
bool  copy,
bool  shrink = false 
)
inlineprotected

◆ shrink_to_fit()

void shrink_to_fit ( )
inline

◆ size()

int size ( )
inline

◆ swap()

void swap ( Vector< T > &  in)
inline

Member Data Documentation

◆ bufferLen

int bufferLen =0
protected

◆ len

int len = 0
protected

◆ p_data

T* p_data = nullptr
protected

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