Givaro
Public Types | Public Member Functions | Protected Attributes
Array0< T > Class Template Reference

NODOC. More...

#include <givarray0.h>

+ Inheritance diagram for Array0< T >:
+ Collaboration diagram for Array0< T >:

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. More...
 
typedef Type_titerator
 
typedef const Type_tconst_iterator
 

Public Member Functions

 Array0 (size_t s=0)
 Default cstor : ctsor of s size array. More...
 
 Array0 (size_t s, const T &t)
 
 Array0 (const Self_t &p, givNoCopy)
 Recopy cstor : logical copy. More...
 
 Array0 (const Self_t &p, givWithCopy)
 Recopy cstor : physical copy. More...
 
 ~Array0 ()
 Destructor. More...
 
void destroy ()
 Destroy of the array. More...
 
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 More...
 
void reserve (size_t s)
 reserve More...
 
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. More...
 
Self_toperator= (const Self_t &p)
 assignement operator is physical copy More...
 
size_t size () const
 Return the occuped size of the array. More...
 
size_t phsize () const
 Return the physical size of the array (capacity) More...
 
Type_tbaseptr ()
 Return the base ptr to the array. More...
 
const Type_tbaseptr () const
 
const T & operator[] (Indice_t i) const
 Access to the ith Element: More...
 
T & operator[] (Indice_t i)
 
const T & front () const
 back/front More...
 
T & front ()
 
const T & back () const
 
T & back ()
 
void push_back (const T &a)
 add one element at the end More...
 
void write (Indice_t i, const Type_t &val)
 write More...
 
void read (Indice_t i, Type_t &val) const
 read More...
 
Iterator_t begin ()
 Iterators. More...
 
Iterator_t end ()
 
constIterator_t begin () const
 
constIterator_t end () const
 
int getCounter () const
 

Protected Attributes

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

Detailed Description

template<class T>
class Givaro::Array0< T >

NODOC.

Member Typedef Documentation

◆ Indice_t

typedef size_t Indice_t

◆ Type_t

typedef T Type_t

◆ Self_t

typedef Array0<T> Self_t

◆ Iterator_t

typedef Type_t* Iterator_t

◆ constIterator_t

typedef const Type_t* constIterator_t

◆ value_type

typedef Type_t value_type

STL compliance.

◆ iterator

typedef Type_t* iterator

◆ const_iterator

typedef const Type_t* const_iterator

Constructor & Destructor Documentation

◆ Array0() [1/4]

Array0 ( size_t  s = 0)
inline

Default cstor : ctsor of s size array.

◆ Array0() [2/4]

Array0 ( size_t  s,
const T &  t 
)
inline

◆ Array0() [3/4]

Array0 ( const Self_t p,
givNoCopy   
)
inline

Recopy cstor : logical copy.

◆ Array0() [4/4]

Array0 ( const Self_t p,
givWithCopy   
)
inline

Recopy cstor : physical copy.

◆ ~Array0()

~Array0
inline

Destructor.

Member Function Documentation

◆ destroy()

void destroy
inline

Destroy of the array.

◆ allocate()

void allocate ( size_t  s)
inline

Allocation of an array of s Elements.

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

◆ reallocate()

void reallocate ( size_t  s)
inline

Reallocation of an array of s Elements.

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

◆ resize()

void resize ( size_t  s)
inline

resize

◆ reserve()

void reserve ( size_t  s)
inline

reserve

◆ copy()

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

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()

Array0< T > & logcopy ( const Self_t src)
inline

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

◆ operator=()

Array0< T > & operator= ( const Self_t p)

assignement operator is physical copy

◆ size()

size_t size ( ) const
inline

Return the occuped size of the array.

◆ phsize()

size_t phsize
inline

Return the physical size of the array (capacity)

◆ baseptr() [1/2]

T * baseptr
inline

Return the base ptr to the array.

◆ baseptr() [2/2]

const T * baseptr
inline

◆ operator[]() [1/2]

const T & operator[] ( Indice_t  i) const
inline

Access to the ith Element:

◆ operator[]() [2/2]

T & operator[] ( Indice_t  i)
inline

◆ front() [1/2]

const T & front
inline

back/front

◆ front() [2/2]

T & front
inline

◆ back() [1/2]

const T & back
inline

◆ back() [2/2]

T & back
inline

◆ push_back()

void push_back ( const T &  a)
inline

add one element at the end

◆ write()

void write ( Indice_t  i,
const Type_t val 
)
inline

write

◆ read()

void read ( Indice_t  i,
Type_t val 
) const
inline

read

◆ begin() [1/2]

Array0< T >::Iterator_t begin
inline

Iterators.

◆ end() [1/2]

Array0< T >::Iterator_t end
inline

◆ begin() [2/2]

Array0< T >::constIterator_t begin
inline

◆ end() [2/2]

Array0< T >::constIterator_t end
inline

◆ getCounter()

int getCounter ( ) const
inline

get Counter

Field Documentation

◆ _cnt

int* _cnt
protected

reference counter on _d

◆ _size

size_t _size
protected

actual size of the array.

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

◆ _psz

size_t _psz
protected

physical size of the array

◆ _d

T* _d
protected

ptr to the memory


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