Arduino DLNA Server
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tiny_dlna::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>

Collaboration diagram for tiny_dlna::Vector< T >:
Collaboration graph
[legend]

Classes

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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

template<class T>
class tiny_dlna::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/6]

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

Default constructor: size 0 with DefaultAllocator.

◆ Vector() [2/6]

template<class T >
tiny_dlna::Vector< T >::Vector ( Allocator allocator)
inline

Constructor with only allocator.

◆ Vector() [3/6]

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

Allocate size and initialize array.

◆ Vector() [4/6]

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

Move constructor.

◆ Vector() [5/6]

template<class T >
tiny_dlna::Vector< T >::Vector ( Vector< T > &  copyFrom)
inline

copy constructor

◆ Vector() [6/6]

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

legacy constructor with pointer range

◆ ~Vector()

template<class T >
virtual tiny_dlna::Vector< T >::~Vector ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ assign() [1/2]

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

◆ assign() [2/2]

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

◆ back()

template<class T >
T& tiny_dlna::Vector< T >::back ( )
inline

◆ begin()

template<class T >
iterator tiny_dlna::Vector< T >::begin ( )
inline

◆ capacity()

template<class T >
int tiny_dlna::Vector< T >::capacity ( )
inline

◆ cleanup()

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

◆ clear()

template<class T >
void tiny_dlna::Vector< T >::clear ( )
inline

◆ contains()

template<class T >
bool tiny_dlna::Vector< T >::contains ( obj)
inline

◆ data()

template<class T >
T* tiny_dlna::Vector< T >::data ( )
inline

◆ deleteArray()

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

◆ empty()

template<class T >
bool tiny_dlna::Vector< T >::empty ( )
inline

◆ end()

template<class T >
iterator tiny_dlna::Vector< T >::end ( )
inline

◆ erase() [1/2]

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

◆ erase() [2/2]

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

◆ indexOf()

template<class T >
int tiny_dlna::Vector< T >::indexOf ( obj)
inline

◆ newArray()

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

◆ operator bool()

template<class T >
tiny_dlna::Vector< T >::operator bool ( ) const
inline

◆ operator=() [1/2]

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

Move operator.

◆ operator=() [2/2]

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

copy operator

◆ operator[]() [1/2]

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

◆ operator[]() [2/2]

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

◆ pop_back()

template<class T >
void tiny_dlna::Vector< T >::pop_back ( )
inline

◆ pop_front()

template<class T >
void tiny_dlna::Vector< T >::pop_front ( )
inline

◆ push_back() [1/2]

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

◆ push_back() [2/2]

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

◆ push_front() [1/2]

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

◆ push_front() [2/2]

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

◆ reset()

template<class T >
void tiny_dlna::Vector< T >::reset ( )
inline

◆ resize() [1/2]

template<class T >
bool tiny_dlna::Vector< T >::resize ( int  newSize)
inline

◆ resize() [2/2]

template<class T >
bool tiny_dlna::Vector< T >::resize ( int  newSize,
value 
)
inline

◆ resize_internal()

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

◆ setAllocator()

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

◆ shrink_to_fit()

template<class T >
void tiny_dlna::Vector< T >::shrink_to_fit ( )
inline

◆ size()

template<class T >
int tiny_dlna::Vector< T >::size ( )
inline

◆ swap() [1/2]

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

◆ swap() [2/2]

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

Member Data Documentation

◆ len

template<class T >
int tiny_dlna::Vector< T >::len = 0
protected

◆ max_capacity

template<class T >
int tiny_dlna::Vector< T >::max_capacity = 0
protected

◆ p_allocator

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

◆ p_data

template<class T >
T* tiny_dlna::Vector< T >::p_data = nullptr
protected

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