Proud::CFastList< E, ETraits > Class Template Reference

Classes

class  const_iterator
 
class  iterator
 
class  value_type
 

Public Types

typedef ETraits::INARGTYPE INARGTYPE
 

Public Member Functions

intptr_t GetCount () const throw ()
 
bool IsEmpty () const throw ()
 
E & GetHead ()
 
const E & GetHead () const
 
E & GetTail ()
 
const E & GetTail () const
 
RemoveHead ()
 
RemoveTail ()
 
void RemoveHeadNoReturn () throw ()
 
void RemoveTailNoReturn () throw ()
 
Proud::Position AddHead ()
 
Proud::Position AddHead (INARGTYPE element)
 
void AddHeadList (const CFastList *plNew)
 
Proud::Position AddTail ()
 
Proud::Position AddTail (INARGTYPE element)
 
void AddTailList (const CFastList *plNew)
 
void RemoveAll () throw ()
 
void Clear ()
 
Proud::Position GetHeadPosition () const throw ()
 
Proud::Position GetTailPosition () const throw ()
 
E & GetNext (Proud::Position &pos)
 
const E & GetNext (Proud::Position &pos) const
 
E & GetPrev (Proud::Position &pos)
 
const E & GetPrev (Proud::Position &pos) const throw ()
 
E & GetAt (Proud::Position pos)
 
const E & GetAt (Proud::Position pos) const
 
void SetAt (Proud::Position pos, INARGTYPE element)
 
Proud::Position RemoveAt (Proud::Position pos) throw ()
 
Proud::Position InsertBefore (Proud::Position pos, INARGTYPE element)
 
Proud::Position InsertAfter (Proud::Position pos, INARGTYPE element)
 
Proud::Position Find (INARGTYPE element, Proud::Position posStartAfter=NULL) const throw ()
 
Proud::Position FindIndex (intptr_t iElement) const throw ()
 
void MoveToHead (Proud::Position pos)
 
void MoveToTail (Proud::Position pos)
 
void SwapElements (Proud::Position pos1, Proud::Position pos2) throw ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator erase (iterator iter)
 
bool Equals (const CFastList &rhs) const
 

Friends

class iterator
 
class const_iterator
 

Detailed Description

template<typename E, typename ETraits = CPNElementTraits< E >>
class Proud::CFastList< E, ETraits >

Linked List that can be processed with extremely fast.

  • Uses CFastHeap internally. Therefore, has little cost at adding/deleting element. However, it must correctly follow all the rules described in Fast heap.
  • In contrast with CFastArray, classes can be used with constructor, destructor and copy assignment operator.
Parameters
Eclause type of collection
ETraitscharacteristic that handles collection clause
AllocTone of the values of AllocType

Member Function Documentation

template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::AddHead ( )
inline

An empty header without data is added.

Returns
Position of the newly added node
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::AddHead ( INARGTYPE  element)
inline

Add a header

Parameters
elementData to be inserted to a new header
Returns
Position of a newly added node
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::AddHeadList ( const CFastList< E, ETraits > *  plNew)
inline

A new list is added to the header

Parameters
plNewList to be added to the header
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::AddTail ( )
inline

An empty node is added to the end of the list.

Returns
Position of the newly added node.
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::AddTail ( INARGTYPE  element)
inline

Add a node at the end of the list

Parameters
elementData to be inserted to the last node
Returns
Position of the newly added node
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::AddTailList ( const CFastList< E, ETraits > *  plNew)
inline

A new list is added to the last node of the list

Parameters
plNewList to be added
template<typename E, typename ETraits = CPNElementTraits< E >>
iterator Proud::CFastList< E, ETraits >::begin ( )
inline

Performs the same role as the same named method of STL

template<typename E, typename ETraits = CPNElementTraits< E >>
const_iterator Proud::CFastList< E, ETraits >::begin ( ) const
inline

Performs the same role as the same named method of STL

template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::Clear ( )
inline

Delete all data. Same as RemoveAll()

template<typename E, typename ETraits = CPNElementTraits< E >>
iterator Proud::CFastList< E, ETraits >::end ( )
inline

Performs the same role as the same named method of STL

template<typename E, typename ETraits = CPNElementTraits< E >>
const_iterator Proud::CFastList< E, ETraits >::end ( ) const
inline

Performs the same role as the same named method of STL

template<typename E, typename ETraits = CPNElementTraits< E >>
bool Proud::CFastList< E, ETraits >::Equals ( const CFastList< E, ETraits > &  rhs) const
inline

Compare whether the content of the current CFastList and other CFastList are the same. Directly compare the data to confirm.

Parameters
rhsCFastList to be compared
Returns
True if the same, otherwise return false.
template<typename E, typename ETraits = CPNElementTraits< E >>
iterator Proud::CFastList< E, ETraits >::erase ( iterator  iter)
inline

Performs the same role as the same named method of STL

template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::Find ( INARGTYPE  element,
Proud::Position  posStartAfter = NULL 
) const throw ()
inline

Find a node with data

Parameters
elementData of the node to be searched for
posStartAfterSearch by comparing after this position
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::FindIndex ( intptr_t  iElement) const throw ()
inline

Return the position of the next node for the number if iElement from the header

Parameters
iElementNumber of the node to be passed after iElement
Returns
Position of node
template<typename E, typename ETraits = CPNElementTraits< E >>
E& Proud::CFastList< E, ETraits >::GetAt ( Proud::Position  pos)
inline

Obtain the data of the current node

Parameters
posPosition of the current node
Returns
Data of the current node
template<typename E, typename ETraits = CPNElementTraits< E >>
const E& Proud::CFastList< E, ETraits >::GetAt ( Proud::Position  pos) const
inline

Obtain the data of the current node as a const variable

Parameters
posPosition of the current node
Returns
Return the const variable of the current node data
template<typename E, typename ETraits = CPNElementTraits< E >>
E& Proud::CFastList< E, ETraits >::GetHead ( )
inline

Return the first data in the

Returns
list.
template<typename E, typename ETraits = CPNElementTraits< E >>
const E& Proud::CFastList< E, ETraits >::GetHead ( ) const
inline
Returns
the first data in list as a const variable.
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::GetHeadPosition ( ) const throw ()
inline
Returns
the position of the header.
template<typename E, typename ETraits = CPNElementTraits< E >>
E& Proud::CFastList< E, ETraits >::GetNext ( Proud::Position pos)
inline

Obtain the next node position of the position inserted as a factor

Parameters
posCurrent position.
Returns
the data of the next node.
template<typename E, typename ETraits = CPNElementTraits< E >>
const E& Proud::CFastList< E, ETraits >::GetNext ( Proud::Position pos) const
inline

Obtain the next node position of the position inserted as a factor

Parameters
posCurrent position
Returns
Return the data of the next node
template<typename E, typename ETraits = CPNElementTraits< E >>
E& Proud::CFastList< E, ETraits >::GetPrev ( Proud::Position pos)
inline

Obtain the previous node position of the position inserted as a factor

Parameters
posCurrent position
Returns
Data of the previous node
template<typename E, typename ETraits = CPNElementTraits< E >>
const E& Proud::CFastList< E, ETraits >::GetPrev ( Proud::Position pos) const throw ()
inline

Obtain the previous node position of the position inserted as a factor

Parameters
posCurrent position
Returns
Return the data of the previous node as a const variable
template<typename E, typename ETraits = CPNElementTraits< E >>
E& Proud::CFastList< E, ETraits >::GetTail ( )
inline
Returns
the last data in list.
template<typename E, typename ETraits = CPNElementTraits< E >>
const E& Proud::CFastList< E, ETraits >::GetTail ( ) const
inline
Returns
the last data in list as a const variable.
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::GetTailPosition ( ) const throw ()
inline
Returns
the position of the last node of list.
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::InsertAfter ( Proud::Position  pos,
INARGTYPE  element 
)
inline

Add a new node behind the node pointed by the current position

Parameters
posPosition pointing the current node
elementData of the new node to be added
template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::InsertBefore ( Proud::Position  pos,
INARGTYPE  element 
)
inline

Add a new node in front of the node pointed by the current position

Parameters
posPosition pointing the current node
elementData of the new node to be added
template<typename E, typename ETraits = CPNElementTraits< E >>
bool Proud::CFastList< E, ETraits >::IsEmpty ( ) const throw ()
inline

If there is no data then true, otherwise return false.

template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::MoveToHead ( Proud::Position  pos)
inline

Send the node pointed by the current position to the beginning of the list

Parameters
posPosition of the current node
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::MoveToTail ( Proud::Position  pos)
inline

Send the node pointed by the current position to the end of the list

Parameters
posPosition of the current node
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::RemoveAll ( ) throw ()
inline

Delete all data. Same as Clear()

template<typename E, typename ETraits = CPNElementTraits< E >>
Proud::Position Proud::CFastList< E, ETraits >::RemoveAt ( Proud::Position  pos) throw ()
inline

Delete the node pointed by the current position and then return the next position

Parameters
posPosition of the node to be deleted
Returns
Next position of the deleted position
template<typename E, typename ETraits = CPNElementTraits< E >>
E Proud::CFastList< E, ETraits >::RemoveHead ( )
inline

Deletes the first data within the list and returns it.

Returns
Data deleted from
list
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::RemoveHeadNoReturn ( ) throw ()
inline

First data of the list is deleted.

template<typename E, typename ETraits = CPNElementTraits< E >>
E Proud::CFastList< E, ETraits >::RemoveTail ( )
inline

Deletes the first data within the list and returns it.

Returns
Data deleted from
list
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::RemoveTailNoReturn ( ) throw ()
inline

Last data of the list is deleted.

template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::SetAt ( Proud::Position  pos,
INARGTYPE  element 
)
inline

Configure the data of the node pointed by the current position

Parameters
posPosition of the current node
elementData to be configured
template<typename E, typename ETraits = CPNElementTraits< E >>
void Proud::CFastList< E, ETraits >::SwapElements ( Proud::Position  pos1,
Proud::Position  pos2 
) throw ()
inline

Switch the position of the two nodes. As a big waste may occur if you directly swap the elements so you change the relevant pointers of the two nodes.

Parameters
pos1Position of the first node to be changed
pos2Position of the second node to be changed