AVIR
High-quality pro image resizing library
 All Classes Files Functions Variables Typedefs Macros
Public Member Functions | List of all members
avir::CStructArray< T > Class Template Reference

#include <avir.h>

Public Member Functions

 CStructArray (const CStructArray &Source)
 
T & add ()
 
void clear ()
 
int getItemCount () const
 
CStructArrayoperator= (const CStructArray &Source)
 
T & operator[] (const int Index)
 
const T & operator[] (const int Index) const
 
void setItemCount (const int NewCount)
 

Detailed Description

template<class T>
class avir::CStructArray< T >

Array of structured objects.

Implements allocation of a linear array of objects of class T (which are initialized), addressable via operator[]. Each object is created via the "operator new". New object insertions are quick since implementation uses prior space allocation (capacity), thus not requiring frequent memory block reallocations.

Template Parameters
TArray element's type.

Member Function Documentation

template<class T>
T& avir::CStructArray< T >::add ( )

Function creates a new object of type T with the default constructor and adds this object to the array.

Returns
Reference to a newly added object.
template<class T>
void avir::CStructArray< T >::clear ( )

Function erases all items of *this array.

template<class T>
int avir::CStructArray< T >::getItemCount ( ) const
Returns
The number of allocated items.
template<class T>
void avir::CStructArray< T >::setItemCount ( const int  NewCount)

Function changes number of allocated items. New items are created with the default constructor. If NewCount is below the current item count, items that are above NewCount range will be destructed.

Parameters
NewCountNew requested item count.