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

#include <List.h>

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

Classes

class  const_iterator
 
class  iterator
 

Public Types

typedef T value_type
 

Public Member Functions

 List ()
 
 List (const List< T, A > &original)
 
List< T, A > & operator= (const List< T, A > &l)
 
 ~List ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 
iterator insert (iterator pos, const T &value)
 
iterator insert (iterator pos)
 
iterator insert (size_t pos, const T &value)
 
iterator insert (size_t pos)
 
void insert (iterator pos, const_iterator first, const_iterator last)
 
void push_back (const T &value)
 
void push_front (const T &value)
 
void pop_front ()
 
void pop_back ()
 
T & push_back_once (const T &value)
 
T & add ()
 
T & add (const T &value)
 
bool remove_at (size_t i)
 
iterator erase (iterator pos)
 
iterator erase (iterator first, iterator last)
 
List< T, A > & remove (const T &value)
 
List< T, A > & remove (const T *pvalue)
 
List< T, A > & remove_if (bool(*pred)(const T &))
 
List< T, A > & unique ()
 
List< T, A > & unique (int(*pred)(const T &, const T &))
 
List< T, A > & merge (List< T, A > &original)
 
List< T, A > & merge (List< T, A > &original, int(*comp)(const T &, const T &))
 
List< T, A > & sort ()
 
List< T, A > & sort (int(*comp)(const T &, const T &))
 
List< T, A > & reverse ()
 
const_iterator get_at (size_t i) const
 
iterator get_at (size_t i)
 
bool find (const T &value) const
 
bool find (bool(*pred)(const T &)) const
 
int compare (const List< T, A > &l) const
 
bool operator== (const List< T, A > &l) const
 
bool operator< (const List< T, A > &l) const
 
bool operator> (const List< T, A > &l) const
 
List< T, A > & assign (const_iterator first, const_iterator last)
 
List< T, A > & swap (List< T, A > &original)
 
List< T, A > & splice (List< T, A > &original)
 
List< T, A > & splice (iterator pos, List< T, A > &original)
 
void clear ()
 
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)
 
- Public Member Functions inherited from commore::BaseList
 BaseList ()
 
 ~BaseList ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator insert (iterator pos, size_t size, FunctionConstructor c, const Byte *value=0)
 
iterator insert (size_t pos, size_t size, FunctionConstructor c, const Byte *value=0)
 
void insert (iterator pos, const_iterator first, const_iterator last, size_t size, FunctionConstructor c)
 
Bytepush_back_once (size_t size, FunctionConstructor ctor, FunctionComparator cmor, const Byte *value)
 
Bytepush_back (size_t size, FunctionConstructor ctor, const Byte *value=0)
 
bool find (const Byte *value, FunctionComparator cmor) const
 
bool find (FunctionFilter filter) const
 
int compare (const BaseList &l, FunctionComparator cmor) const
 
void assign (const_iterator first, const_iterator last, FunctionConstructor c, FunctionDestructor d, size_t size)
 
BaseListNodeRootallocate_root_node_ ()
 
BaseListNodeallocate_node_ (size_t size, FunctionConstructor c, const Byte *value=0)
 
void deallocate_node_ (BaseListNodeRoot *node)
 
void deallocate_node_ (BaseListNode *node, FunctionDestructor d)
 
void init_root ()
 
void clear (FunctionDestructor d)
 
iterator erase (iterator pos, FunctionDestructor d)
 
iterator erase (iterator first, iterator last, FunctionDestructor d)
 
iterator get_at (size_t i)
 
const_iterator get_at (size_t i) const
 
bool remove_at (size_t i, FunctionDestructor d)
 
BaseListswap (BaseList &original)
 
BaseListsplice (iterator pos, BaseList &original)
 
BaseListsplice (BaseList &original, FunctionDestructor d)
 
BaseListsplice (iterator pos, BaseList &original, iterator i)
 
BaseListremove (const Byte *v, FunctionComparator cmor, FunctionDestructor d)
 
BaseListmerge (BaseList &original, FunctionComparator cmor)
 
BaseListsort (FunctionComparator cmor)
 
BaseListunique (FunctionComparator cmor, FunctionDestructor d)
 
BaseListremove_ptr (const Byte *v, FunctionDestructor d)
 
BaseListremove_if (FunctionFilter filter, FunctionDestructor d)
 
BaseListreverse ()
 
size_t size () const
 
bool empty () const
 

Static Public Member Functions

static void transfer (iterator pos, iterator first, iterator last)
 
- Static Public Member Functions inherited from commore::BaseList
static void move_before (iterator pos, iterator i)
 
static void move_after (iterator pos, iterator i)
 
static void transfer (iterator pos, iterator first, iterator last)
 
static int comparator_ (const Byte *v1, const Byte *v2, size_t size)
 
static void constructor_ (Byte *data, const Byte *value, size_t size)
 
static void destructor_ (Byte *data)
 

Detailed Description

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

Examples:
/examples/coding/Logs.cpp.

Member Typedef Documentation

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

Constructor & Destructor Documentation

template<class T, class A>
commore::List< T, A >::List ( )
inline
template<class T, class A>
commore::List< T, A >::List ( const List< T, A > &  original)
inline
template<class T, class A>
commore::List< T, A >::~List ( )
inline

Member Function Documentation

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

Add a new element at the edn of the list (defaut value)

Returns
reference on new element
template<class T, class A>
T& commore::List< T, A >::add ( const T &  value)
inline

Add a new element at the edn of the list

Parameters
valueof new element
Returns
reference on new element
template<class T, class A>
List<T, A>& commore::List< T, A >::assign ( const_iterator  first,
const_iterator  last 
)
inline

Assign the list content whit a sequence of value

Parameters
firstelement of the sequence
lastelement of the sequence
Returns
reference on the list
template<class T, class A>
T& commore::List< T, A >::back ( )
inline

Get reference on last element of list

Warning
unpredictible behaviour if list is empty
template<class T, class A>
const T& commore::List< T, A >::back ( ) const
inline

Get const reference on last element of list

Warning
unpredictible behaviour if list is empty
template<class T, class A>
iterator commore::List< T, A >::begin ( )
inline

Get non const iterator on begin of list

template<class T, class A>
const_iterator commore::List< T, A >::begin ( ) const
inline

Get const iterator on begin of list

template<class T, class A>
const_iterator commore::List< 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>
const_iterator commore::List< T, A >::cend ( ) const
inline

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

template<class T, class A>
void commore::List< T, A >::clear ( )
inline

Remove all element from the list

template<class T, class A>
int commore::List< T, A >::compare ( const List< T, A > &  l) const
inline

Compare the list with an other list Use default comparison function

Returns
0 They compare equal <0 Either the value of the first element that does not match is lower in the compared element, or all compared element match but the compared element is shorter. >0 Either the value of the first element that does not match is greater in the compared element,
template<class T, class A>
iterator commore::List< T, A >::end ( )
inline

Get non const iterator on end of list

template<class T, class A>
const_iterator commore::List< T, A >::end ( ) const
inline

Get const iterator on end of list

template<class T, class A>
iterator commore::List< T, A >::erase ( iterator  pos)
inline

Remove an element from the list

Parameters
positerator on the element
Returns
iterator on next element
template<class T, class A>
iterator commore::List< T, A >::erase ( iterator  first,
iterator  last 
)
inline

Remove a sequence of element from the list

Parameters
firstiterator on the first element
lastiterator on the last element
Returns
iterator on next element
template<class T, class A>
bool commore::List< T, A >::find ( const T &  value) const
inline

Check if a value is in the list

Parameters
value
Returns
true if value found
template<class T, class A>
bool commore::List< T, A >::find ( bool(*)(const T &)  pred) const
inline

Check if a value is in the list (use a predicate function)

Parameters
predpredicate function
Returns
true if predicate is true for at least an element of the list
long commore::ListTuple::from_xml_string ( const AString s)

Buid content list froma string xml representation

Returns
number of caracter read, <0 if parse error
Remarks
not implemented
template<class T, class A>
T& commore::List< T, A >::front ( )
inline

Get reference on first element of list

Warning
unpredictible behaviour if list is empty
template<class T, class A>
const T& commore::List< T, A >::front ( ) const
inline

Get const reference on first element of list

Warning
unpredictible behaviour if list is empty
template<class T, class A>
const_iterator commore::List< T, A >::get_at ( size_t  i) const
inline

Get a const iterator at specified index

Parameters
iindex
Returns
const iterator on element at postion i. If i > list size return end()
template<class T, class A>
iterator commore::List< T, A >::get_at ( size_t  i)
inline

Get a iterator at specified index

Parameters
iindex
Returns
iterator on element at postion i. If i > list size return end()
template<class T, class A>
iterator commore::List< T, A >::insert ( iterator  pos,
const T &  value 
)
inline

Insert a new element in the list

Parameters
positerator position for new element (insert before)
valuefor new element
Returns
iterator on new inserted element
template<class T, class A>
iterator commore::List< T, A >::insert ( iterator  pos)
inline

Insert a new element in the list (default value)

Parameters
positertor position for new element (insert before)
Returns
iterator on new inserted element
template<class T, class A>
iterator commore::List< T, A >::insert ( size_t  pos,
const T &  value 
)
inline

Insert a new element in the list

Parameters
posindex position for new element (if pos > list size insert at end)
valuefor new element
Returns
iterator on new inserted element
template<class T, class A>
iterator commore::List< T, A >::insert ( size_t  pos)
inline

Insert a new element in the list (default value)

Parameters
posindex position for new element (if pos > list size insert at end)
Returns
iterator on new inserted element
template<class T, class A>
void commore::List< T, A >::insert ( iterator  pos,
const_iterator  first,
const_iterator  last 
)
inline

Insert a sequence of elements in the list

Parameters
positerator position for new elements
firstiterator on first element to be inserted (included)
lastiterator on first element to be inserted (excluded)
template<class T, class A>
List<T, A>& commore::List< T, A >::merge ( List< T, A > &  original)
inline

Merge a list (no duplicate element)

Parameters
originallist to merge
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::merge ( List< T, A > &  original,
int(*)(const T &, const T &)  comp 
)
inline

Merge a list (no duplicate element, use a comparison function)

Parameters
originallist to merge
comppredicate function
Returns
reference on the list
template<class T, class A>
bool commore::List< T, A >::operator< ( const List< T, A > &  l) const
inline

Compare <

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

Compare ==

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

Compare >

template<class T, class A>
void commore::List< T, A >::pop_back ( )
inline

Remove last element of the list

template<class T, class A>
void commore::List< T, A >::pop_front ( )
inline

Remove first element of the list

template<class T, class A>
void commore::List< T, A >::push_back ( const T &  value)
inline

Insert a new element at the end of the list

Parameters
valuefor new element
template<class T, class A>
T& commore::List< T, A >::push_back_once ( const T &  value)
inline

Add a new element only in not already in the list

Parameters
valueof new element
Returns
reference on element in the list
template<class T, class A>
void commore::List< T, A >::push_front ( const T &  value)
inline

Insert a new element at the begening of the list

Parameters
valuefor new element
template<class T, class A>
CMREXD int commore::List< T, A >::read ( const Path file)

Read a list content from a bynay file

Remarks
not implemented
CMREXD long commore::ListTuple::read_xml ( IBStream i)

Read a list content from an xml text stream

Remarks
not implemented
CMREXD int commore::ListTuple::read_xml ( const Path file)

Read a list content from an xml text file

Remarks
not implemented
template<class T, class A>
List<T, A>& commore::List< T, A >::remove ( const T &  value)
inline

Remove element equal to specified value

Parameters
valueto remove
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::remove ( const T *  pvalue)
inline

Remove element equal to specified value

Parameters
pvaluepointer to value to remove
Returns
reference on the list
template<class T, class A>
bool commore::List< T, A >::remove_at ( size_t  i)
inline

Remove an element from the list

Parameters
iindex of the element
Returns
true if element was found
template<class T, class A>
List<T, A>& commore::List< T, A >::remove_if ( bool(*)(const T &)  pred)
inline

Remove the elements on which the predicate is true

Parameters
predpredicate function
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::reverse ( )
inline

Reverse content of a list

Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::sort ( )
inline

Sort a list (using default comparison function)

Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::sort ( int(*)(const T &, const T &)  comp)
inline

Sort a list (using a comparison function)

Parameters
comppredicate function
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::splice ( List< T, A > &  original)
inline

Tranfert list content from an other list content

Parameters
originalother list (will be empty after operation)
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::splice ( iterator  pos,
List< T, A > &  original 
)
inline

Tranfert list content from an other list content

Parameters
posinsert postion
originalother list (will be empty after operation)
Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::swap ( List< T, A > &  original)
inline

Swap list content with an other list content

Parameters
originalother list
Returns
reference on the list
AString & commore::ListTuple::to_xml_string ( AString s) const

Get an xml string representation of the list

Remarks
not implemented
template<class T, class A>
static void commore::List< T, A >::transfer ( iterator  pos,
iterator  first,
iterator  last 
)
inlinestatic

Transfer list elements from first to last at pos

Parameters
posinsertion position
firstfirst element of source list
lastelement of source list
template<class T, class A>
List<T, A>& commore::List< T, A >::unique ( )
inline

Remove duplicated element

Returns
reference on the list
template<class T, class A>
List<T, A>& commore::List< T, A >::unique ( int(*)(const T &, const T &)  pred)
inline

Remove duplicated element (use comparison function)

Parameters
predpredicate function
Returns
reference on the list
template<class T, class A>
CMREXD int commore::List< T, A >::write ( const Path file) const

Write list content to a binary file

Remarks
not implemented
CMREXD long commore::ListTuple::write_xml ( OBStream o) const

Write list content to an xml text stream

Remarks
not implemented
CMREXD int commore::ListTuple::write_xml ( const Path file) const

Write list content to an xml text file

Remarks
not implemented

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