commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::Array< T, A > Class Template Reference

#include <Array.h>

+ Inheritance diagram for commore::Array< T, A >:

Classes

class  const_iterator
 
class  iterator
 

Public Types

typedef T value_type
 

Public Member Functions

 Array ()
 
 Array (size_t nb)
 
 Array (const Array &v)
 
Array< T, A > & operator= (const Array< T, A > &v)
 
 ~Array ()
 
void clear (bool all=true)
 
void resize (int n)
 
T & add ()
 
T & add (const T &v)
 
const T * get_at (int pos) const
 
T * get_at (int pos)
 
T & operator[] (int pos)
 
const T & operator[] (int pos) const
 
size_t reserve (size_t nb)
 
int compare (const Array< T, A > &a) const
 
bool operator< (const Array< T, A > &a) const
 
bool operator== (const Array< T, A > &l) const
 
CMREXD AStringtoString (AString &dst) const
 
CMREXD long read_xml (IBStream &i)
 
CMREXD long write_xml (OBStream &o) const
 
CMREXD int write (const Path &file) const
 
CMREXD int read (const Path &file)
 
CMREXD int write_xml (const Path &file) const
 
CMREXD int read_xml (const Path &file)
 
CMREXD AStringto_xml_string (AString &s) const
 
CMREXD long from_xml_string (const AString &s)
 
int compare (const Array< T, A > &a, FunctionComparator cmor) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
- Public Member Functions inherited from commore::BaseArray
void splice (BaseArray &array)
 
size_t size () const
 
size_t reserved () const
 

Additional Inherited Members

- Static Public Member Functions inherited from commore::BaseArray
static bool next_ (iterator &i, size_t item_size)
 
static bool next_ (const_iterator &i, size_t item_size)
 
- Protected Member Functions inherited from commore::BaseArray
 BaseArray ()
 
Byteadd_ (size_t nb, size_t item_size, Byte *data, FunctionConstructor c, FunctionDestructor d)
 
void clear_ (size_t item_size, FunctionDestructor d, bool all)
 
void resize_ (int new_size, size_t item_size, FunctionConstructor c, FunctionDestructor d)
 
Byteat_ (size_t i, size_t item_size)
 
const Byteat_ (size_t i, size_t item_size) const
 
size_t reserve_ (size_t nb, size_t item_size, FunctionConstructor c, FunctionDestructor d)
 
Bytedata ()
 
const Bytedata () const
 
void begin_ (iterator &)
 
void begin_ (const_iterator &) const
 
- Protected Attributes inherited from commore::BaseArray
Bytedata_
 
size_t size_
 
size_t reserved_
 

Detailed Description

template<class T, class A>
class commore::Array< T, A >

Examples:
/examples/coding/Array.cpp.

Member Typedef Documentation

template<class T, class A>
typedef T commore::Array< T, A >::value_type

Constructor & Destructor Documentation

template<class T, class A>
commore::Array< T, A >::Array ( )
inline

Construct an empty Array

template<class T, class A>
commore::Array< T, A >::Array ( size_t  nb)
inline

Construct an array with reserved size

Parameters
nbnb item reserved in new array
Remarks
memory reservation is automatic. The reserve param is use only for optimisation purpose.
template<class T, class A>
commore::Array< T, A >::Array ( const Array< T, A > &  v)
inline

Copy constructor

template<class T, class A>
commore::Array< T, A >::~Array ( )
inline

Destructor

Member Function Documentation

template<class T, class A>
T& commore::Array< T, A >::add ( )
inline

Add a new item to array (default value)

Returns
reference on added item
Examples:
/examples/coding/Array.cpp.
template<class T, class A>
T& commore::Array< T, A >::add ( const T &  v)
inline

Add a new item to array

Parameters
vnew item value
Returns
reference on added item
template<class T, class A>
iterator commore::Array< T, A >::begin ( )
inline

Create a begin iterator

Examples:
/examples/coding/Array.cpp.
template<class T, class A>
const_iterator commore::Array< T, A >::begin ( ) const
inline

Create a begin const iterator

template<class T, class A>
const_iterator commore::Array< T, A >::cbegin ( ) const
inline

Get a cbegin const iterator cbegin is identical to the const version of begin() but it ensures, in any context, to be recognized by the compiler as returning a const_iterator

template<class T, class A>
void commore::Array< T, A >::clear ( bool  all = true)
inline

Clear array content

Parameters
alldelete reserved items
template<class T, class A>
int commore::Array< T, A >::compare ( const Array< T, A > &  a) const
inline

Compare two arrays

Parameters
aarray to compare with
Returns
0 if equal, negative value if smaller, positive vaue if greater
template<class T, class A>
int commore::Array< T, A >::compare ( const Array< T, A > &  a,
FunctionComparator  cmor 
) const
inline

Compare the array to an other

Parameters
aarray to compare to
cmorfuntion emplementing item comparison
Returns
0 if equal, negative if less, positive it greater
template<class T, class A>
CMREXD long commore::Array< T, A >::from_xml_string ( const AString s)

Fill array with an xml string content

Parameters
sinput string
Returns
output string reference
Remarks
NOT implemented
template<class T, class A>
const T* commore::Array< T, A >::get_at ( int  pos) const
inline

Get const pointer to item at specified position

Parameters
posposition of the item in array
Returns
pointer to found item
Remarks
return null if pos is out of range
template<class T, class A>
T* commore::Array< T, A >::get_at ( int  pos)
inline

Get pointer to item at specified position

Parameters
posposition of the item in array
Returns
pointer to found item
Remarks
return null if pos is out of range
template<class T, class A>
bool commore::Array< T, A >::operator< ( const Array< T, A > &  a) const
inline

Compare two arrays

Parameters
aarray to compare with
Returns
true if this < a
template<class T, class A>
Array<T, A>& commore::Array< T, A >::operator= ( const Array< T, A > &  v)
inline

Assignement operator

template<class T, class A>
bool commore::Array< T, A >::operator== ( const Array< T, A > &  l) const
inline

Compare two arrays

Parameters
aarray to compare with
Returns
true if this == a
template<class T, class A>
T& commore::Array< T, A >::operator[] ( int  pos)
inline

Get reference to item at specified position

Parameters
posposition of the item in array
Returns
reference to found item
Remarks
return null reference if pos is out of range
template<class T, class A>
const T& commore::Array< T, A >::operator[] ( int  pos) const
inline

Get const reference to item at specified position

Parameters
posposition of the item in array
Returns
reference to found item
Remarks
return null reference if pos is out of range
template<class T, class A>
CMREXD int commore::Array< T, A >::read ( const Path file)

Read array from file (raw format)

Parameters
fileinput file
Returns
>= 0 if succeed
Remarks
NOT implemented
long commore::ArrayDouble::read_xml ( IBStream i)

Read array content from xml stream.

Parameters
iinput text stream
Returns
nb read byte
Remarks
NOT implemented
template<class T, class A>
CMREXD int commore::Array< T, A >::read_xml ( const Path file)

Read array from file (xml format)

Parameters
fileinput file
Returns
>= 0 if succeed
Remarks
NOT implemented
template<class T, class A>
size_t commore::Array< T, A >::reserve ( size_t  nb)
inline

Reserve a capacity for array

Parameters
nbnew array reserved capacity
Returns
the effective reserved capacity size of array is not affected.
template<class T, class A>
void commore::Array< T, A >::resize ( int  n)
inline

Resize array

Parameters
nnew size
Remarks
new item value are set to default
capacity is not modified. size will be updated.
when new size is less than current size: for non-scalar types, destructor are called on each removed object
Examples:
/examples/coding/Array.cpp.
template<class T, class A>
CMREXD AString& commore::Array< T, A >::to_xml_string ( AString s) const

Convert array to xml string

Parameters
soutput string
Returns
>= 0 if succeed
Remarks
NOT implemented
template<class T, class A>
CMREXD AString& commore::Array< T, A >::toString ( AString dst) const

Convert array content to string

Parameters
dstdestination string
Remarks
not an official format
template<class T, class A>
CMREXD int commore::Array< T, A >::write ( const Path file) const

Write array to file (raw format)

Parameters
fileoutput file
Returns
>= 0 if succeed
Remarks
NOT implemented
template<class T, class A>
CMREXD long commore::Array< T, A >::write_xml ( OBStream o) const

Write array content to an xml stream

Parameters
ooutput text stream
Returns
nb write byte
Remarks
NOT implemented
template<class T, class A>
CMREXD int commore::Array< T, A >::write_xml ( const Path file) const

Write array to file (xml format)

Parameters
fileoutput file
Returns
>= 0 if succeed
Remarks
NOT implemented

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