Givaro 4.2.1
ArrayAllocatort< T, Tag > Class Template Reference

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

#include <givarrayallocator.h>

+ Inheritance diagram for ArrayAllocatort< T, Tag >:

Public Types

typedef size_t Indice_t
 
typedef T Type_t
 
typedef Array0< T > Self_t
 
typedef Type_tIterator_t
 
typedef const Type_tconstIterator_t
 
typedef Type_t value_type
 STL compliance.
 
typedef Type_titerator
 
typedef const Type_tconst_iterator
 

Public Member Functions

void destroy ()
 Destroy of the array.
 
void allocate (size_t s)
 Allocation of an array of s Elements.
 
void reallocate (size_t s)
 Reallocation of an array of s Elements.
 
void resize (size_t s)
 resize
 
void reserve (size_t s)
 reserve
 
Self_tcopy (const Self_t &src)
 Physical copy operator.
 
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)
 
Type_tbaseptr ()
 Return the base ptr to the array.
 
const Type_tbaseptr () const
 
const T & operator[] (Indice_t i) const
 Access to the ith Element:
 
T & operator[] (Indice_t i)
 
const T & front () const
 back/front
 
T & front ()
 
const T & back () const
 
T & back ()
 
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
 
Iterator_t begin ()
 Iterators.
 
constIterator_t begin () const
 
Iterator_t end ()
 
constIterator_t end () const
 
int getCounter () const
 

Protected Attributes

int * _cnt
 reference counter on _d
 
size_t _size
 actual size of the array.
 
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

  • allocate(size_n)
  • resize(size_n)
  • destroy

Member Typedef Documentation

◆ Indice_t

template<class T>
typedef size_t Indice_t
inherited

◆ Type_t

template<class T>
typedef T Type_t
inherited

◆ Self_t

template<class T>
typedef Array0<T> Self_t
inherited

◆ Iterator_t

template<class T>
typedef Type_t* Iterator_t
inherited

◆ constIterator_t

template<class T>
typedef const Type_t* constIterator_t
inherited

◆ value_type

template<class T>
typedef Type_t value_type
inherited

STL compliance.

◆ iterator

template<class T>
typedef Type_t* iterator
inherited

◆ const_iterator

template<class T>
typedef const Type_t* const_iterator
inherited

Member Function Documentation

◆ destroy()

template<class T>
void destroy ( )
inlineinherited

Destroy of the array.

◆ allocate()

template<class T>
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

◆ reallocate()

template<class T>
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

◆ resize()

template<class T>
void resize ( size_t s)
inlineinherited

resize

◆ reserve()

template<class T>
void reserve ( size_t s)
inlineinherited

reserve

◆ copy()

template<class T>
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).

◆ logcopy()

template<class T>
Array0< T > & logcopy ( const Self_t & src)
inlineinherited

Logical recopy operator: make an alias to src. Return dest.

◆ size()

template<class T>
size_t size ( ) const
inlineinherited

Return the occuped size of the array.

◆ phsize()

template<class T>
size_t phsize ( ) const
inlineinherited

Return the physical size of the array (capacity)

◆ baseptr() [1/2]

template<class T>
T * baseptr ( )
inlineinherited

Return the base ptr to the array.

◆ baseptr() [2/2]

template<class T>
const T * baseptr ( ) const
inlineinherited

◆ operator[]() [1/2]

template<class T>
const T & operator[] ( Indice_t i) const
inlineinherited

Access to the ith Element:

◆ operator[]() [2/2]

template<class T>
T & operator[] ( Indice_t i)
inlineinherited

◆ front() [1/2]

template<class T>
const T & front ( ) const
inlineinherited

back/front

◆ front() [2/2]

template<class T>
T & front ( )
inlineinherited

◆ back() [1/2]

template<class T>
const T & back ( ) const
inlineinherited

◆ back() [2/2]

template<class T>
T & back ( )
inlineinherited

◆ push_back()

template<class T>
void push_back ( const T & a)
inlineinherited

add one element at the end

◆ write()

template<class T>
void write ( Indice_t i,
const Type_t & val )
inlineinherited

write

◆ read()

template<class T>
void read ( Indice_t i,
Type_t & val ) const
inlineinherited

read

◆ begin() [1/2]

template<class T>
Array0< T >::Iterator_t begin ( )
inlineinherited

Iterators.

◆ begin() [2/2]

template<class T>
Array0< T >::constIterator_t begin ( ) const
inlineinherited

◆ end() [1/2]

template<class T>
Array0< T >::Iterator_t end ( )
inlineinherited

◆ end() [2/2]

template<class T>
Array0< T >::constIterator_t end ( ) const
inlineinherited

◆ getCounter()

template<class T>
int getCounter ( ) const
inlineinherited

get Counter

Field Documentation

◆ _cnt

template<class T>
int* _cnt
protectedinherited

reference counter on _d

◆ _size

template<class T>
size_t _size
protectedinherited

actual size of the array.

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

◆ _psz

template<class T>
size_t _psz
protectedinherited

physical size of the array

◆ _d

template<class T>
T* _d
protectedinherited

ptr to the memory


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