AGX Dynamics  2.37.2.0
agx::List< T > Class Template Reference

#include <List.h>

Classes

class  const_iterator
 
class  const_reverse_iterator
 
class  EqualPred1
 
class  EqualPred2
 
class  iterator
 
class  LessPred1
 
class  LessPred2
 
class  reverse_iterator
 

Public Types

typedef const T * const_pointer
 
typedef const T & const_reference
 
typedef List< T > my_type
 
typedef LNode< T > * node_ptr_type
 
typedef LNode< T > & node_ref_type
 
typedef LNode< T > node_type
 
typedef T * pointer
 
typedef T & reference
 
typedef size_t size_type
 
typedef T value_type
 

Public Member Functions

 List ()
 Default constructor, size zero and begin() == end(). More...
 
 List (const List &other)
 Copy constructor. More...
 
 ~List ()
 Destructor. More...
 
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 Clear this list of all elements. More...
 
bool contains (const_reference _val)
 Check if a value _val is part of this list (at least one time). More...
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (const_iterator _where)
 Erase element at _where. More...
 
const_iterator find (const_reference _val) const
 Find iterator to FIRST element with value _val. More...
 
iterator find (const_reference _val)
 Find iterator to FIRST element with value _val. More...
 
reference front ()
 
const_reference front () const
 
iterator insert (const_iterator _where, const_reference c_ref)
 Insert an element c_ref before _where. More...
 
template<typename InputIterator >
void insert (const_iterator _where, InputIterator _first, InputIterator _last)
 Insert N elements before _where. More...
 
template<typename Pred >
void merge (my_type &other, Pred pred)
 Merge in elements from other, both this and other are ordered by pred. More...
 
void merge (my_type &other)
 Merge in elements from other, both this and other are ordered by operator<. More...
 
List & operator= (const my_type &other)
 Assignment operator. More...
 
bool operator== (const my_type &other) const
 Comparison of lists of same size. More...
 
void pop_back ()
 Remove last element in this list. More...
 
void pop_front ()
 Remove first element in this list. More...
 
void push_back (const_reference c_ref)
 Add element to the back of this list. More...
 
void push_front (const_reference c_ref)
 Add element to the front of this list. More...
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
void remove (const_reference valArg)
 Erase (all) elements matching valArg. More...
 
template<typename Pred >
void remove_if (Pred pred)
 Erase (all) elements matching pred. More...
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void reverse ()
 Reverse sequence. More...
 
size_type size () const
 
template<typename Pred >
void sort (Pred pred)
 Sorts the content in this list given pred. More...
 
void sort ()
 Sorts the content in this list given operator<. More...
 
void splice (const_iterator _where, my_type &other, const_iterator first, const_iterator last, size_type count)
 Splice other [first, last) at _where. More...
 
void splice (const_iterator _where, my_type &other)
 Splice other [other.begin(), other.end()) at _where. More...
 
void splice (const_iterator _where, my_type &other, const_iterator first, const_iterator last)
 Splice other [first, last) at _where. More...
 
void swap (my_type &other)
 Swap this with other. More...
 
template<typename Pred >
void unique (Pred pred)
 Erases each element satisfying pred with previous. More...
 
void unique ()
 Erases each element satisfying operator== with previous. More...
 

Detailed Description

template<typename T>
class agx::List< T >

Definition at line 107 of file List.h.

Member Typedef Documentation

◆ const_pointer

template<typename T>
typedef const T* agx::List< T >::const_pointer

Definition at line 115 of file List.h.

◆ const_reference

template<typename T>
typedef const T& agx::List< T >::const_reference

Definition at line 113 of file List.h.

◆ my_type

template<typename T>
typedef List< T > agx::List< T >::my_type

Definition at line 110 of file List.h.

◆ node_ptr_type

template<typename T>
typedef LNode<T>* agx::List< T >::node_ptr_type

Definition at line 118 of file List.h.

◆ node_ref_type

template<typename T>
typedef LNode<T>& agx::List< T >::node_ref_type

Definition at line 119 of file List.h.

◆ node_type

template<typename T>
typedef LNode<T> agx::List< T >::node_type

Definition at line 117 of file List.h.

◆ pointer

template<typename T>
typedef T* agx::List< T >::pointer

Definition at line 114 of file List.h.

◆ reference

template<typename T>
typedef T& agx::List< T >::reference

Definition at line 112 of file List.h.

◆ size_type

template<typename T>
typedef size_t agx::List< T >::size_type

Definition at line 116 of file List.h.

◆ value_type

template<typename T>
typedef T agx::List< T >::value_type

Definition at line 111 of file List.h.

Constructor & Destructor Documentation

◆ List() [1/2]

template<typename T>
agx::List< T >::List ( )
inline

Default constructor, size zero and begin() == end().

Definition at line 479 of file List.h.

◆ List() [2/2]

template<typename T>
agx::List< T >::List ( const List< T > &  other)
inline

Copy constructor.

Definition at line 487 of file List.h.

◆ ~List()

template<typename T>
agx::List< T >::~List ( )
inline

Destructor.

Definition at line 496 of file List.h.

Member Function Documentation

◆ back() [1/2]

template<typename T>
reference agx::List< T >::back ( )
inline
Note
It's not valid to call this method if this list is empty.
Returns
the last element of this list

Definition at line 642 of file List.h.

◆ back() [2/2]

template<typename T>
const_reference agx::List< T >::back ( ) const
inline
Note
It's not valid to call this method if this list is empty.
Returns
the last element of this list

Definition at line 648 of file List.h.

◆ begin() [1/2]

◆ begin() [2/2]

template<typename T>
const_iterator agx::List< T >::begin ( ) const
inline
Returns
the begin iterator of this list (end if empty)

Definition at line 584 of file List.h.

◆ clear()

template<typename T>
void agx::List< T >::clear ( )
inline

Clear this list of all elements.

Definition at line 728 of file List.h.

◆ contains()

template<typename T>
bool agx::List< T >::contains ( const_reference  _val)
inline

Check if a value _val is part of this list (at least one time).

Parameters
_val- value to check for
Returns
true if value _val shows up at least one time in this list

Definition at line 571 of file List.h.

◆ empty()

template<typename T>
bool agx::List< T >::empty ( ) const
inline
Returns
true if this list is empty - otherwise false

Definition at line 624 of file List.h.

Referenced by agx::List< CameraDescriptionRef >::merge(), and agx::List< CameraDescriptionRef >::sort().

◆ end() [1/2]

template<typename T>
iterator agx::List< T >::end ( )
inline

◆ end() [2/2]

template<typename T>
const_iterator agx::List< T >::end ( ) const
inline
Returns
the end iterator of this list

Definition at line 594 of file List.h.

◆ erase()

template<typename T>
iterator agx::List< T >::erase ( const_iterator  _where)
inline

Erase element at _where.

Parameters
_where- iterator to element to erase
Returns
iterator to the element before the erased element

Definition at line 740 of file List.h.

◆ find() [1/2]

template<typename T>
const_iterator agx::List< T >::find ( const_reference  _val) const
inline

Find iterator to FIRST element with value _val.

Parameters
_val- value to search for
Returns
iterator to element with value _val if found - otherwise end iterator

Definition at line 541 of file List.h.

◆ find() [2/2]

template<typename T>
iterator agx::List< T >::find ( const_reference  _val)
inline

Find iterator to FIRST element with value _val.

Parameters
_val- value to search for
Returns
iterator to element with value _val if found - otherwise end iterator

Definition at line 556 of file List.h.

◆ front() [1/2]

template<typename T>
reference agx::List< T >::front ( )
inline
Note
It's not valid to call this method if this list is empty.
Returns
the front element of this list

Definition at line 630 of file List.h.

◆ front() [2/2]

template<typename T>
const_reference agx::List< T >::front ( ) const
inline
Note
It's not valid to call this method if this list is empty.
Returns
the front element of this list

Definition at line 636 of file List.h.

◆ insert() [1/2]

template<typename T>
iterator agx::List< T >::insert ( const_iterator  _where,
const_reference  c_ref 
)
inline

Insert an element c_ref before _where.

Parameters
_where- iterator to place where to insert element
c_ref- element to insert
Returns
iterator to the inserted element

Definition at line 656 of file List.h.

◆ insert() [2/2]

template<typename T>
template<typename InputIterator >
void agx::List< T >::insert ( const_iterator  _where,
InputIterator  _first,
InputIterator  _last 
)
inline

Insert N elements before _where.

Parameters
_where- where to insert the elements
_first- any compatible iterator to the first element to insert
_last- any compatible iterator, AFTER _first, to define the end (i.e., _last element will not be inserted)

Definition at line 680 of file List.h.

◆ merge() [1/2]

template<typename T>
template<typename Pred >
void agx::List< T >::merge ( my_type &  other,
Pred  pred 
)
inline

Merge in elements from other, both this and other are ordered by pred.

Note that other will be empty after the merge.

Parameters
other- the other list to merge into this
pred- operator for merge

Definition at line 802 of file List.h.

Referenced by agx::List< CameraDescriptionRef >::sort().

◆ merge() [2/2]

template<typename T>
void agx::List< T >::merge ( my_type &  other)
inline

Merge in elements from other, both this and other are ordered by operator<.

Note that other will be empty after the merge.

Parameters
other- the other list to merge into this

Definition at line 832 of file List.h.

◆ operator=()

template<typename T>
List& agx::List< T >::operator= ( const my_type &  other)
inline

Assignment operator.

Clears current state and copies nodes from other to this.

Parameters
other- list to copy from
Returns
self

Definition at line 509 of file List.h.

◆ operator==()

template<typename T>
bool agx::List< T >::operator== ( const my_type &  other) const
inline

Comparison of lists of same size.

Parameters
other- other list
Returns
true if all elements in this list are identical to the values in the other list

Definition at line 524 of file List.h.

◆ pop_back()

template<typename T>
void agx::List< T >::pop_back ( )
inline

Remove last element in this list.

Note
It's not valid to call this method if this list is empty.

Definition at line 719 of file List.h.

◆ pop_front()

template<typename T>
void agx::List< T >::pop_front ( )
inline

Remove first element in this list.

Note
It's not valid to call this method if this list is empty.

Definition at line 709 of file List.h.

◆ push_back()

template<typename T>
void agx::List< T >::push_back ( const_reference  c_ref)
inline

Add element to the back of this list.

Parameters
c_ref- element to add

Definition at line 691 of file List.h.

◆ push_front()

template<typename T>
void agx::List< T >::push_front ( const_reference  c_ref)
inline

Add element to the front of this list.

Parameters
c_ref- element to add

Definition at line 700 of file List.h.

◆ rbegin() [1/2]

template<typename T>
reverse_iterator agx::List< T >::rbegin ( )
inline
Returns
the reverse begin iterator of this list

Definition at line 599 of file List.h.

◆ rbegin() [2/2]

template<typename T>
const_reverse_iterator agx::List< T >::rbegin ( ) const
inline
Returns
the reverse begin iterator of this list

Definition at line 604 of file List.h.

◆ remove()

template<typename T>
void agx::List< T >::remove ( const_reference  valArg)
inline

Erase (all) elements matching valArg.

Parameters
valArg- value for erase

Definition at line 790 of file List.h.

◆ remove_if()

template<typename T>
template<typename Pred >
void agx::List< T >::remove_if ( Pred  pred)
inline

Erase (all) elements matching pred.

Parameters
pred- operator to trigger remove

Definition at line 774 of file List.h.

◆ rend() [1/2]

template<typename T>
reverse_iterator agx::List< T >::rend ( )
inline
Returns
the reverse end iterator of this list

Definition at line 609 of file List.h.

◆ rend() [2/2]

template<typename T>
const_reverse_iterator agx::List< T >::rend ( ) const
inline
Returns
the reverse end iterator of this list

Definition at line 614 of file List.h.

◆ reverse()

template<typename T>
void agx::List< T >::reverse ( )
inline

Reverse sequence.

Definition at line 872 of file List.h.

◆ size()

template<typename T>
size_type agx::List< T >::size ( ) const
inline
Returns
the size of this list

Definition at line 619 of file List.h.

Referenced by agx::List< CameraDescriptionRef >::operator==(), and agx::List< CameraDescriptionRef >::splice().

◆ sort() [1/2]

template<typename T>
template<typename Pred >
void agx::List< T >::sort ( Pred  pred)
inline

Sorts the content in this list given pred.

Definition at line 908 of file List.h.

◆ sort() [2/2]

template<typename T>
void agx::List< T >::sort ( )
inline

Sorts the content in this list given operator<.

Definition at line 1009 of file List.h.

◆ splice() [1/3]

template<typename T>
void agx::List< T >::splice ( const_iterator  _where,
my_type &  other,
const_iterator  first,
const_iterator  last,
size_type  count 
)
inline

Splice other [first, last) at _where.

Size of other after this operation is other.size() - count.

Parameters
_where- where at this
other- other list
first- iterator to first element in other
last- iterator to last element i other
count- number of elements [first, last)

Definition at line 949 of file List.h.

Referenced by agx::List< CameraDescriptionRef >::sort().

◆ splice() [2/3]

template<typename T>
void agx::List< T >::splice ( const_iterator  _where,
my_type &  other 
)
inline

Splice other [other.begin(), other.end()) at _where.

Parameters
_where- where at this
other- other list

Definition at line 983 of file List.h.

◆ splice() [3/3]

template<typename T>
void agx::List< T >::splice ( const_iterator  _where,
my_type &  other,
const_iterator  first,
const_iterator  last 
)
inline

Splice other [first, last) at _where.

Note
If the number of elements between first and last is known, use splice given count instead.
Parameters
_where- where at this
other- other list
first- iterator to first element in other
last- iterator to last element i other

Definition at line 996 of file List.h.

◆ swap()

template<typename T>
void agx::List< T >::swap ( my_type &  other)
inline

Swap this with other.

Definition at line 897 of file List.h.

Referenced by agx::List< CameraDescriptionRef >::sort().

◆ unique() [1/2]

template<typename T>
template<typename Pred >
void agx::List< T >::unique ( Pred  pred)
inline

Erases each element satisfying pred with previous.

Parameters
pred- operator to trigger erase

Definition at line 842 of file List.h.

◆ unique() [2/2]

template<typename T>
void agx::List< T >::unique ( )
inline

Erases each element satisfying operator== with previous.

Definition at line 864 of file List.h.


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