BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
GmsList Class Reference

#include <GmsList.h>

Public Member Functions

 GmsList ()
 
virtual ~GmsList ()
 
GmsListLinklast () const
 
GmsListLinkfirst () const
 
unsigned int count () const
 
GmsListappend (GmsListLink *)
 
GmsListprepend (GmsListLink *)
 
GmsListremove (GmsListLink *)
 
GmsListinsertAfter (GmsListLink *link, GmsListLink *insertHere)
 
GmsListmoveAfter (GmsListLink *link, GmsListLink *insertHere)
 
void reset ()
 
 GmsList ()
 
virtual ~GmsList ()
 
GmsListLinklast () const
 
GmsListLinkfirst () const
 
unsigned int count () const
 
GmsListappend (GmsListLink *)
 
GmsListprepend (GmsListLink *)
 
GmsListremove (GmsListLink *)
 
GmsListinsertAfter (GmsListLink *link, GmsListLink *insertHere)
 
GmsListmoveAfter (GmsListLink *link, GmsListLink *insertHere)
 
void reset ()
 

Protected Attributes

GmsListLink_first
 
GmsListLink_last
 
unsigned int _count
 

Detailed Description

Constructor & Destructor Documentation

◆ GmsList() [1/2]

◆ ~GmsList() [1/2]

GmsList::~GmsList ( )
virtual

Definition at line 18 of file GmsList.cxx.

18{}

◆ GmsList() [2/2]

GmsList::GmsList ( )
inline

◆ ~GmsList() [2/2]

virtual GmsList::~GmsList ( )
virtual

Member Function Documentation

◆ append() [1/2]

GmsList & GmsList::append ( GmsListLink l)

Definition at line 20 of file GmsList.cxx.

21{ // add an item to the end of a list
22 if ( _last ) {
23 _last->_next = l;
24 l->_prev = _last;
25 }
26 else
27 _first = l;
28
29 _last = l;
30
31 _count++;
32
33 return *this;
34}

Referenced by MdcSegList::append().

◆ append() [2/2]

GmsList & GmsList::append ( GmsListLink )

◆ count() [1/2]

unsigned int GmsList::count ( ) const
inline

◆ count() [2/2]

unsigned int GmsList::count ( ) const
inline

◆ first() [1/2]

◆ first() [2/2]

GmsListLink * GmsList::first ( ) const
inline

◆ insertAfter() [1/2]

GmsList & GmsList::insertAfter ( GmsListLink link,
GmsListLink insertHere 
)

Definition at line 51 of file GmsList.cxx.

52{ // add an item to the middle of a list
53 GmsListLink *after = 0;
54 if ( here != 0 ) {
55 after = here->_next;
56 here->_next = l;
57 l->_prev = here;
58 }
59 else {
60 after = _first;
61 l->_prev = 0;
62 _first = l;
63 }
64 l->_next = after;
65
66 if (after == 0) {
67 _last = l;
68 }
69 else {
70 after->_prev = l;
71 }
72
73 _count++;
74
75 return *this;
76}

◆ insertAfter() [2/2]

GmsList & GmsList::insertAfter ( GmsListLink link,
GmsListLink insertHere 
)

◆ last() [1/2]

GmsListLink * GmsList::last ( ) const
inline

Definition at line 41 of file InstallArea/include/MdcTrkRecon/MdcTrkRecon/GmsList.h.

41{ return _last; }

◆ last() [2/2]

GmsListLink * GmsList::last ( ) const
inline

◆ moveAfter() [1/2]

GmsList & GmsList::moveAfter ( GmsListLink link,
GmsListLink insertHere 
)

Definition at line 77 of file GmsList.cxx.

78{ // add an item from one place in list to another
79
80 // First remove it from its current position
81 if ( l == _first )
83 if ( l == _last )
84 _last = _last->_prev;
85
86 if ( l->_next ) {
87 l->_next->_prev = l->_prev;
88 }
89 if ( l->_prev ) {
90 l->_prev->_next = l->_next;
91 }
92
93
94 GmsListLink *after = 0;
95 if ( here != 0 ) {
96 after = here->_next;
97 here->_next = l;
98 l->_prev = here;
99 }
100 else {
101 after = _first;
102 l->_prev = 0;
103 _first = l;
104 }
105 l->_next = after;
106
107 if (after == 0) {
108 _last = l;
109 }
110 else {
111 after->_prev = l;
112 }
113
114
115 return *this;
116}

◆ moveAfter() [2/2]

GmsList & GmsList::moveAfter ( GmsListLink link,
GmsListLink insertHere 
)

◆ prepend() [1/2]

GmsList & GmsList::prepend ( GmsListLink l)

Definition at line 36 of file GmsList.cxx.

37{ // add an item to the beginning of a list
38 if ( _first ) {
39 _first->_prev = l;
40 l->_next = _first;
41 }
42 else
43 _last = l;
44
45 _first = l;
46
47 _count++;
48
49 return *this;
50}

◆ prepend() [2/2]

GmsList & GmsList::prepend ( GmsListLink )

◆ remove() [1/2]

GmsList & GmsList::remove ( GmsListLink l)

Definition at line 118 of file GmsList.cxx.

119{ // remove an item from the list
120 if ( l == _first )
122 if ( l == _last )
123 _last = _last->_prev;
124
125 if ( l->_next ) {
126 l->_next->_prev = l->_prev;
127 }
128 if ( l->_prev ) {
129 l->_prev->_next = l->_next;
130 }
131 l->_next = 0;
132 l->_prev = 0;
133
134 _count--;
135
136 return *this;
137}

Referenced by MdcSegList::destroySegs().

◆ remove() [2/2]

GmsList & GmsList::remove ( GmsListLink )

◆ reset() [1/2]

void GmsList::reset ( )
inline

Definition at line 51 of file InstallArea/include/MdcTrkRecon/MdcTrkRecon/GmsList.h.

51{ _first = _last = 0; _count = 0;}

◆ reset() [2/2]

void GmsList::reset ( )
inline

Member Data Documentation

◆ _count

unsigned int GmsList::_count
protected

◆ _first

GmsListLink * GmsList::_first
protected

◆ _last

GmsListLink * GmsList::_last
protected

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