Givaro
Public Member Functions | Protected Attributes
ArrayAllocatort< T, Tag > Class Template Reference

ArrayAllocator: class for allocation of arrays. More...

#include <givarrayallocator.h>

+ Inheritance diagram for ArrayAllocatort< T, Tag >:
+ Collaboration diagram for ArrayAllocatort< T, Tag >:

Public Types

typedef Type_t value_type
 STL compliance.
 
typedef Type_t * iterator
 STL compliance.
 
typedef const Type_t * const_iterator
 STL compliance.
 

Public Member Functions

void destroy ()
 Destroy of the array.
 
void allocate (size_t s)
 Allocation of an array of s Elements. More...
 
void reallocate (size_t s)
 Reallocation of an array of s Elements. More...
 
void resize (size_t s)
 resize
 
void reserve (size_t s)
 reserve
 
Self_tcopy (const Self_t &src)
 Physical copy operator. More...
 
Self_tlogcopy (const Self_t &src)
 Logical recopy operator: make an alias to src. Return dest.
 
size_t size () const
 Return the occuped size of the array.
 
size_t phsize () const
 Return the physical size of the array (capacity)
 
void push_back (const T &a)
 add one element at the end
 
void write (Indice_t i, const Type_t &val)
 write
 
void read (Indice_t i, Type_t &val) const
 read
 
Type_t * baseptr ()
 Return the base ptr to the array.
 
const Type_t * baseptr () const
 Return the base ptr to the array.
 
const T & operator[] (Indice_t i) const
 Access to the ith Element:
 
T & operator[] (Indice_t i)
 Access to the ith Element:
 
const T & front () const
 back/front
 
T & front ()
 back/front
 
const T & back () const
 back/front
 
T & back ()
 back/front
 
Iterator_t begin ()
 Iterators.
 
constIterator_t begin () const
 Iterators.
 
Iterator_t end ()
 Iterators.
 
constIterator_t end () const
 Iterators.
 

Protected Attributes

int * _cnt
 reference counter on _d
 
size_t _size
 actual size of the array. More...
 
size_t _psz
 physical size of the array
 
T * _d
 ptr to the memory
 

Detailed Description

template<class T, class Tag>
class Givaro::ArrayAllocatort< T, Tag >

ArrayAllocator: class for allocation of arrays.

Specialization: for Array0Tag.

Should have

Member Function Documentation

void allocate ( size_t  s)
inlineinherited

Allocation of an array of s Elements.

if refcount>1 then it is always a creation of new array

void reallocate ( size_t  s)
inlineinherited

Reallocation of an array of s Elements.

if refcount>1 then it is always a creation of new array + recopy

Array0< T > & copy ( const Self_t src)
inlineinherited

Physical copy operator.

reallocate dest of the same size as src (if necessary) and apply GivaroCopyItem<Array<T>,T> on each Element. This class can be specialized. Return dest (i.e, *this).

Field Documentation

size_t _size
protectedinherited

actual size of the array.

If ==0 then _psz=_d=_cnt=0


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