#include <FTList.h>
Public Member Functions | |
FTList (int length_to_alloc=100) | |
default constructor | |
FTList (const FTList< T > &) | |
copy constructor | |
~FTList () | |
destructor | |
int | append (const T &x) |
append an object into the end of the list | |
int | append (const FTList< T > &) |
append objects into the end of the list | |
int | remove (int &) |
remove objects by index and returns decremented index and length | |
void | remove2 (int) |
remove objects by index | |
void | replace (int i, T src) |
replace index-th object by the object src | |
int | deleteObj (int &) |
delete objects by index and returns decremented index and length | |
void | removeLast (void) |
remove just last objects of the list | |
void | clear (void) |
clear lists but the allocated memory remains same | |
void | removeAll (void) |
clear lists and free memory | |
void | deleteAll (void) |
delete all object and clear(allocated memory remains same) | |
void | resize (void) |
re-allocate memory to reduce size | |
T & | operator[] (unsigned i) const |
returns a object by index | |
T & | operator() (unsigned i) const |
returns the reference of a object by index | |
T & | first (void) const |
returns the first object in the list | |
T * | firstPtr (void) const |
returns the pointer of first object | |
T * | lastPtr (void) const |
returns the pointer of last object | |
int | length (void) const |
returns the length of the list | |
Private Attributes | |
int | _length |
int | _remain |
int | _length_to_alloc |
T * | _obj |
Definition at line 16 of file FTList.h.
copy constructor
Definition at line 106 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, FTList< T >::_remain, genRecEmupikp::i, and T.
00107 : _length(src._length), 00108 _remain(src._remain), 00109 _length_to_alloc(src._length_to_alloc) 00110 { 00111 _obj = (T *) malloc((_length + _remain) * sizeof(T)); 00112 T * srcObj = src._obj; 00113 for (int i = 0; i < _length; i++){ 00114 *(_obj+i) = *(srcObj+i); 00115 } 00116 }
destructor
Definition at line 120 of file FTList.h.
References FTList< T >::_obj.
00120 { 00121 free(_obj); 00122 }
append objects into the end of the list
Definition at line 250 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, FTList< T >::_remain, genRecEmupikp::i, and T.
00251 { 00252 int srcLength = src._length; 00253 T * srcObj = src._obj; 00254 int i = 0; 00255 if (_remain < srcLength){ 00256 _obj = (T *) realloc(_obj,(_length + _remain + srcLength) * sizeof(T)); 00257 while(i^srcLength) *(_obj+(_length++)) = *(srcObj+(i++)); 00258 }else{ 00259 while(i^srcLength) *(_obj+(_length++)) = *(srcObj+(i++)); 00260 _remain -= srcLength; 00261 } 00262 return _length; 00263 }
int FTList< T >::append | ( | const T & | x | ) | [inline] |
append an object into the end of the list
Definition at line 127 of file FTList.h.
References FTList< T >::_length, FTList< T >::_length_to_alloc, FTList< T >::_obj, FTList< T >::_remain, and T.
Referenced by FTTrack::append_stereo(), FTTrack::append_stereo_cache(), FTSuperLayer::appendHit(), FTSuperLayer::clustering(), FTSegment::connect_inner(), FTSegment::connect_outer(), FTSuperLayer::connect_short_segments(), FTSuperLayer::connect_singleHit(), FTSegment::examine(), FTFinder::linkAxialSegments(), FTFinder::linkAxialSegments_step(), FTFinder::linkAxialSuperLayer234(), FTFinder::linkAxialSuperLayer910(), FTTrack::linkStereoSegments(), FTSuperLayer::mkSegmentList(), FTFinder::mkTrack3D(), FTFinder::mkTrackList(), FTTrack::r_phiFit(), FTSuperLayer::reAppendSalvage(), FTSuperLayer::reduce_noise(), FTTrack::s_zFit(), FTSegment::update3D(), FTTrack::updateSZ(), FTFinder::VertexFit(), and FTFinder::VertexFit2D().
00127 { 00128 if (!_remain){ 00129 _obj = (T *) realloc(_obj,(_length+_length_to_alloc) * sizeof(T)); 00130 _remain = _length_to_alloc; 00131 } 00132 *(_obj+(_length++)) = src; 00133 _remain--; 00134 return _length; 00135 }
void FTList< T >::clear | ( | void | ) | [inline] |
clear lists but the allocated memory remains same
Definition at line 182 of file FTList.h.
References FTList< T >::_length, and FTList< T >::_remain.
Referenced by FTSuperLayer::clear(), FTSuperLayer::clustering(), FTSegment::connect_inner(), FTSegment::connect_outer(), FTList< T >::deleteAll(), FTFinder::linkAxialSegments(), FTFinder::linkAxialSuperLayer234(), FTFinder::linkAxialSuperLayer910(), and FTTrack::updateSZ().
void FTList< T >::deleteAll | ( | void | ) |
delete all object and clear(allocated memory remains same)
Definition at line 266 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, FTList< T >::clear(), and genRecEmupikp::i.
Referenced by FTSuperLayer::clear(), FTFinder::clear(), and FTTrack::linkStereoSegments().
int FTList< T >::deleteObj | ( | int & | ) | [inline] |
delete objects by index and returns decremented index and length
Definition at line 164 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, and FTList< T >::_remain.
00164 { 00165 delete *(_obj+iterator); 00166 *(_obj+(iterator--)) = *(_obj+(--_length)); 00167 _remain++; 00168 return _length; 00169 }
T & FTList< T >::first | ( | void | ) | const [inline] |
returns the first object in the list
Definition at line 224 of file FTList.h.
References FTList< T >::_obj.
Referenced by FTFinder::linkAxialSegments_step(), FTSegment::s(), FTSegment::update(), FTSegment::update3D(), FTTrack::updateSZ(), and FTSegment::z().
00224 { 00225 return *_obj; 00226 }
T * FTList< T >::firstPtr | ( | void | ) | const [inline] |
returns the pointer of first object
Definition at line 231 of file FTList.h.
References FTList< T >::_obj.
Referenced by FTSuperLayer::clear(), FTSuperLayer::clustering(), and FTSegment::examine().
00231 { 00232 return _obj; 00233 }
T * FTList< T >::lastPtr | ( | void | ) | const [inline] |
returns the pointer of last object
Definition at line 238 of file FTList.h.
References FTList< T >::_length, and FTList< T >::_obj.
Referenced by FTSuperLayer::clear(), FTSuperLayer::clustering(), and FTSegment::examine().
int FTList< T >::length | ( | void | ) | const [inline] |
returns the length of the list
Definition at line 245 of file FTList.h.
References FTList< T >::_length.
Referenced by FTSuperLayer::clear(), FTSuperLayer::clustering(), FTSuperLayer::connect_short_segments(), FTSuperLayer::connect_singleHit(), FTFinder::CorrectEvtTiming(), FTTrack::d_z(), FTFinder::event(), FTFinder::findBestVertex(), FTTrack::get_nhits(), FTFinder::getTestime(), FTSegment::incomingPhi(), FTFinder::linkAxialSegments_step(), FTFinder::linkAxialSuperLayer234(), FTTrack::linkStereoSegments(), FTSegment::linkStereoSegments(), FTFinder::makeMdst(), FTFinder::makeTds(), FTSuperLayer::mkSegmentList(), FTFinder::mkTrack3D(), FTFinder::mkTrackList(), FTSegment::outgoingPhi(), FTTrack::printout(), FTSegment::printout(), FTTrack::r_phi2Fit(), FTTrack::r_phi3Fit(), FTTrack::r_phi4Fit(), FTTrack::r_phiFit(), FTTrack::r_phiReFit(), FTSuperLayer::reAppendSalvage(), FTSuperLayer::reduce_noise(), FTTrack::s_zFit(), FTSegment::update(), FTSegment::update3D(), FTTrack::updateSZ(), FTFinder::VertexFit(), and FTFinder::VertexFit2D().
00245 { 00246 return _length; 00247 }
T & FTList< T >::operator() | ( | unsigned | i | ) | const [inline] |
returns the reference of a object by index
Definition at line 217 of file FTList.h.
References FTList< T >::_obj.
T & FTList< T >::operator[] | ( | unsigned | i | ) | const [inline] |
int FTList< T >::remove | ( | int & | ) | [inline] |
remove objects by index and returns decremented index and length
Definition at line 140 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, and FTList< T >::_remain.
Referenced by FTSuperLayer::connect_short_segments(), FTSuperLayer::connect_singleHit(), FTFinder::event(), FTFinder::linkAxialSegments_step(), FTFinder::linkAxialSuperLayer234(), FTSuperLayer::mkSegmentList(), FTSuperLayer::reAppendSalvage(), FTSuperLayer::reduce_noise(), and FTTrack::s_zFit().
00140 { 00141 *(_obj+(iterator--)) = *(_obj+(--_length)); 00142 _remain++; 00143 return _length; 00144 }
void FTList< T >::remove2 | ( | int | ) | [inline] |
remove objects by index
Definition at line 149 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, and FTList< T >::_remain.
Referenced by FTTrack::s_zFit().
void FTList< T >::removeAll | ( | void | ) | [inline] |
clear lists and free memory
Definition at line 190 of file FTList.h.
References FTList< T >::_length, FTList< T >::_obj, and FTList< T >::_remain.
void FTList< T >::removeLast | ( | void | ) | [inline] |
remove just last objects of the list
Definition at line 174 of file FTList.h.
References FTList< T >::_length, and FTList< T >::_remain.
void FTList< T >::replace | ( | int | i, | |
T | src | |||
) | [inline] |
replace index-th object by the object src
Definition at line 157 of file FTList.h.
References FTList< T >::_obj.
Referenced by FTFinder::mkTrackList().
void FTList< T >::resize | ( | void | ) | [inline] |
re-allocate memory to reduce size
Definition at line 201 of file FTList.h.
References FTList< T >::_length, FTList< T >::_length_to_alloc, FTList< T >::_obj, FTList< T >::_remain, and T.
00201 { 00202 _obj = (T *) realloc(_obj,_length * sizeof(T)); 00203 _remain = 0; 00204 _length_to_alloc = _length; 00205 }
Definition at line 80 of file FTList.h.
Referenced by FTList< T >::append(), FTList< T >::clear(), FTList< T >::deleteAll(), FTList< T >::deleteObj(), FTList< T >::FTList(), FTList< T >::lastPtr(), FTList< T >::length(), FTList< T >::remove(), FTList< T >::remove2(), FTList< T >::removeAll(), FTList< T >::removeLast(), and FTList< T >::resize().
int FTList< T >::_length_to_alloc [private] |
Definition at line 82 of file FTList.h.
Referenced by FTList< T >::append(), and FTList< T >::resize().
Definition at line 83 of file FTList.h.
Referenced by FTList< T >::append(), FTList< T >::deleteAll(), FTList< T >::deleteObj(), FTList< T >::first(), FTList< T >::firstPtr(), FTList< T >::FTList(), FTList< T >::lastPtr(), FTList< T >::operator()(), FTList< T >::operator[](), FTList< T >::remove(), FTList< T >::remove2(), FTList< T >::removeAll(), FTList< T >::replace(), FTList< T >::resize(), and FTList< T >::~FTList().
Definition at line 81 of file FTList.h.
Referenced by FTList< T >::append(), FTList< T >::clear(), FTList< T >::deleteObj(), FTList< T >::FTList(), FTList< T >::remove(), FTList< T >::remove2(), FTList< T >::removeAll(), FTList< T >::removeLast(), and FTList< T >::resize().