#include <GmsList.h>
Public Member Functions | |
GmsList () | |
virtual | ~GmsList () |
GmsListLink * | last () const |
GmsListLink * | first () const |
unsigned int | count () const |
GmsList & | append (GmsListLink *) |
GmsList & | prepend (GmsListLink *) |
GmsList & | remove (GmsListLink *) |
GmsList & | insertAfter (GmsListLink *link, GmsListLink *insertHere) |
GmsList & | moveAfter (GmsListLink *link, GmsListLink *insertHere) |
void | reset () |
Protected Attributes | |
GmsListLink * | _first |
GmsListLink * | _last |
unsigned int | _count |
Definition at line 32 of file GmsList.h.
GmsList::GmsList | ( | ) | [inline] |
GmsList::~GmsList | ( | ) | [virtual] |
GmsList & GmsList::append | ( | GmsListLink * | ) |
Definition at line 20 of file GmsList.cxx.
References _count, _first, _last, GmsListLink::_next, and GmsListLink::_prev.
Referenced by MdcSegList::append().
00021 { // add an item to the end of a list 00022 if ( _last ) { 00023 _last->_next = l; 00024 l->_prev = _last; 00025 } 00026 else 00027 _first = l; 00028 00029 _last = l; 00030 00031 _count++; 00032 00033 return *this; 00034 }
unsigned int GmsList::count | ( | void | ) | const [inline] |
Definition at line 43 of file GmsList.h.
References _count.
Referenced by MdcSegList::deleteDups().
00043 { return _count;}
GmsListLink* GmsList::first | ( | void | ) | const [inline] |
Definition at line 42 of file GmsList.h.
References _first.
Referenced by MdcSegList::deleteDups(), MdcSegGrouperSt::fillWithSegs(), MdcSegGrouperCsmc::fillWithSegs(), MdcSegGrouperAx::fillWithSegs(), MdcSegList::getSeed(), and MdcSegList::resetSeed().
00042 { return _first; }
GmsList & GmsList::insertAfter | ( | GmsListLink * | link, | |
GmsListLink * | insertHere | |||
) |
Definition at line 51 of file GmsList.cxx.
References _count, _first, _last, GmsListLink::_next, and GmsListLink::_prev.
00052 { // add an item to the middle of a list 00053 GmsListLink *after = 0; 00054 if ( here != 0 ) { 00055 after = here->_next; 00056 here->_next = l; 00057 l->_prev = here; 00058 } 00059 else { 00060 after = _first; 00061 l->_prev = 0; 00062 _first = l; 00063 } 00064 l->_next = after; 00065 00066 if (after == 0) { 00067 _last = l; 00068 } 00069 else { 00070 after->_prev = l; 00071 } 00072 00073 _count++; 00074 00075 return *this; 00076 }
GmsListLink* GmsList::last | ( | ) | const [inline] |
GmsList & GmsList::moveAfter | ( | GmsListLink * | link, | |
GmsListLink * | insertHere | |||
) |
Definition at line 77 of file GmsList.cxx.
References _first, _last, GmsListLink::_next, and GmsListLink::_prev.
Referenced by MdcSegList::sortByPhi().
00078 { // add an item from one place in list to another 00079 00080 // First remove it from its current position 00081 if ( l == _first ) 00082 _first = _first->_next; 00083 if ( l == _last ) 00084 _last = _last->_prev; 00085 00086 if ( l->_next ) { 00087 l->_next->_prev = l->_prev; 00088 } 00089 if ( l->_prev ) { 00090 l->_prev->_next = l->_next; 00091 } 00092 00093 00094 GmsListLink *after = 0; 00095 if ( here != 0 ) { 00096 after = here->_next; 00097 here->_next = l; 00098 l->_prev = here; 00099 } 00100 else { 00101 after = _first; 00102 l->_prev = 0; 00103 _first = l; 00104 } 00105 l->_next = after; 00106 00107 if (after == 0) { 00108 _last = l; 00109 } 00110 else { 00111 after->_prev = l; 00112 } 00113 00114 00115 return *this; 00116 }
GmsList & GmsList::prepend | ( | GmsListLink * | ) |
Definition at line 36 of file GmsList.cxx.
References _count, _first, _last, GmsListLink::_next, and GmsListLink::_prev.
00037 { // add an item to the beginning of a list 00038 if ( _first ) { 00039 _first->_prev = l; 00040 l->_next = _first; 00041 } 00042 else 00043 _last = l; 00044 00045 _first = l; 00046 00047 _count++; 00048 00049 return *this; 00050 }
GmsList & GmsList::remove | ( | GmsListLink * | ) |
Definition at line 118 of file GmsList.cxx.
References _count, _first, _last, GmsListLink::_next, and GmsListLink::_prev.
Referenced by MdcSegList::deleteDups(), and MdcSegList::destroySegs().
00119 { // remove an item from the list 00120 if ( l == _first ) 00121 _first = _first->_next; 00122 if ( l == _last ) 00123 _last = _last->_prev; 00124 00125 if ( l->_next ) { 00126 l->_next->_prev = l->_prev; 00127 } 00128 if ( l->_prev ) { 00129 l->_prev->_next = l->_next; 00130 } 00131 l->_next = 0; 00132 l->_prev = 0; 00133 00134 _count--; 00135 00136 return *this; 00137 }
void GmsList::reset | ( | ) | [inline] |
unsigned int GmsList::_count [protected] |
GmsListLink* GmsList::_first [protected] |
Definition at line 35 of file GmsList.h.
Referenced by append(), first(), GmsList(), insertAfter(), moveAfter(), prepend(), remove(), and reset().
GmsListLink* GmsList::_last [protected] |
Definition at line 36 of file GmsList.h.
Referenced by append(), GmsList(), insertAfter(), last(), moveAfter(), prepend(), remove(), and reset().