BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitList< T > Class Template Reference

#include <KalFitList.h>

Public Member Functions

 KalFitList (int length_to_alloc=100)
 default constructor
 KalFitList (const KalFitList< T > &)
 copy constructor
 ~KalFitList ()
 destructor
int append (T x)
 append an object into the end of the list
int append (const KalFitList< 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
operator[] (unsigned i) const
 returns a object by index
T & operator() (unsigned i) const
 returns the reference of a object by index
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
 KalFitList (int length_to_alloc=100)
 default constructor
 KalFitList (const KalFitList< T > &)
 copy constructor
 ~KalFitList ()
 destructor
int append (T x)
 append an object into the end of the list
int append (const KalFitList< 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
operator[] (unsigned i) const
 returns a object by index
T & operator() (unsigned i) const
 returns the reference of a object by index
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
 KalFitList (int length_to_alloc=100)
 default constructor
 KalFitList (const KalFitList< T > &)
 copy constructor
 ~KalFitList ()
 destructor
int append (T x)
 append an object into the end of the list
int append (const KalFitList< 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
operator[] (unsigned i) const
 returns a object by index
T & operator() (unsigned i) const
 returns the reference of a object by index
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

Detailed Description

template<class T>
class KalFitList< T >

Definition at line 10 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

Constructor & Destructor Documentation

◆ KalFitList() [1/6]

template<class T>
KalFitList< T >::KalFitList ( int length_to_alloc = 100)
inline

default constructor

Definition at line 90 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

91 : _length( 0 )
92 , _remain( length_to_alloc )
93 , _length_to_alloc( length_to_alloc )
94 , _obj( (T*)malloc( length_to_alloc * sizeof( T ) ) ) {}

Referenced by append(), and KalFitList().

◆ KalFitList() [2/6]

template<class T>
KalFitList< T >::KalFitList ( const KalFitList< T > & src)

copy constructor

Definition at line 97 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

98 : _length( src._length )
99 , _remain( src._remain )
100 , _length_to_alloc( src._length_to_alloc ) {
101 _obj = (T*)malloc( ( _length + _remain ) * sizeof( T ) );
102 T* srcObj = src._obj;
103 for ( int i = 0; i < _length; i++ ) { *( _obj + i ) = *( srcObj + i ); }
104}

◆ ~KalFitList() [1/3]

template<class T>
KalFitList< T >::~KalFitList ( )
inline

destructor

Definition at line 106 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

106{ free( _obj ); }

◆ KalFitList() [3/6]

template<class T>
KalFitList< T >::KalFitList ( int length_to_alloc = 100)

default constructor

◆ KalFitList() [4/6]

template<class T>
KalFitList< T >::KalFitList ( const KalFitList< T > & )

copy constructor

◆ ~KalFitList() [2/3]

template<class T>
KalFitList< T >::~KalFitList ( )

destructor

◆ KalFitList() [5/6]

template<class T>
KalFitList< T >::KalFitList ( int length_to_alloc = 100)

default constructor

◆ KalFitList() [6/6]

template<class T>
KalFitList< T >::KalFitList ( const KalFitList< T > & )

copy constructor

◆ ~KalFitList() [3/3]

template<class T>
KalFitList< T >::~KalFitList ( )

destructor

Member Function Documentation

◆ append() [1/6]

template<class T>
int KalFitList< T >::append ( const KalFitList< T > & src)

append objects into the end of the list

Definition at line 180 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

180 {
181 int srcLength = src._length;
182 T* srcObj = src._obj;
183 int i = 0;
184 if ( _remain < srcLength )
185 {
186 _obj = (T*)realloc( _obj, ( _length_to_alloc + srcLength ) * sizeof( T ) );
187 while ( i ^ srcLength ) *( _obj + ( _length++ ) ) = *( srcObj + ( i++ ) );
188 }
189 else
190 {
191 while ( i ^ srcLength ) *( _obj + ( _length++ ) ) = *( srcObj + ( i++ ) );
192 _remain -= srcLength;
193 }
194 return _length;
195}

◆ append() [2/6]

template<class T>
int KalFitList< T >::append ( const KalFitList< T > & )

append objects into the end of the list

◆ append() [3/6]

template<class T>
int KalFitList< T >::append ( const KalFitList< T > & )

append objects into the end of the list

◆ append() [4/6]

template<class T>
int KalFitList< T >::append ( T x)
inline

append an object into the end of the list

Definition at line 108 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

108 {
109 if ( !_remain )
110 {
111 _obj = (T*)realloc( _obj, ( _length + _length_to_alloc ) * sizeof( T ) );
112 _remain = _length_to_alloc;
113 }
114 *( _obj + ( _length++ ) ) = src;
115 _remain--;
116 return _length;
117}

Referenced by KalFitSuper_Mdc::appendHit().

◆ append() [5/6]

template<class T>
int KalFitList< T >::append ( T x)

append an object into the end of the list

◆ append() [6/6]

template<class T>
int KalFitList< T >::append ( T x)

append an object into the end of the list

◆ clear() [1/3]

template<class T>
void KalFitList< T >::clear ( void )
inline

clear lists but the allocated memory remains same

Definition at line 144 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

144 {
145 _remain += _length;
146 _length = 0;
147}

Referenced by deleteAll().

◆ clear() [2/3]

template<class T>
void KalFitList< T >::clear ( void )

clear lists but the allocated memory remains same

◆ clear() [3/3]

template<class T>
void KalFitList< T >::clear ( void )

clear lists but the allocated memory remains same

◆ deleteAll() [1/3]

template<class T>
void KalFitList< T >::deleteAll ( void )

delete all object and clear(allocated memory remains same)

Definition at line 197 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

197 {
198 int i = _length;
199 while ( i ) delete *( _obj + ( --i ) );
200 clear();
201}
void clear(void)
clear lists but the allocated memory remains same

◆ deleteAll() [2/3]

template<class T>
void KalFitList< T >::deleteAll ( void )

delete all object and clear(allocated memory remains same)

◆ deleteAll() [3/3]

template<class T>
void KalFitList< T >::deleteAll ( void )

delete all object and clear(allocated memory remains same)

◆ deleteObj() [1/3]

template<class T>
int KalFitList< T >::deleteObj ( int & iterator)
inline

delete objects by index and returns decremented index and length

Definition at line 132 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

132 {
133 delete *( _obj + iterator );
134 *( _obj + ( iterator-- ) ) = *( _obj + ( --_length ) );
135 _remain++;
136 return _length;
137}

◆ deleteObj() [2/3]

template<class T>
int KalFitList< T >::deleteObj ( int & )

delete objects by index and returns decremented index and length

◆ deleteObj() [3/3]

template<class T>
int KalFitList< T >::deleteObj ( int & )

delete objects by index and returns decremented index and length

◆ first() [1/3]

template<class T>
T KalFitList< T >::first ( void ) const
inline

returns the first object in the list

Definition at line 170 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

170{ return *_obj; }

◆ first() [2/3]

template<class T>
T KalFitList< T >::first ( void ) const

returns the first object in the list

◆ first() [3/3]

template<class T>
T KalFitList< T >::first ( void ) const

returns the first object in the list

◆ firstPtr() [1/3]

template<class T>
T * KalFitList< T >::firstPtr ( void ) const
inline

returns the pointer of first object

Definition at line 172 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

172{ return _obj; }

◆ firstPtr() [2/3]

template<class T>
T * KalFitList< T >::firstPtr ( void ) const

returns the pointer of first object

◆ firstPtr() [3/3]

template<class T>
T * KalFitList< T >::firstPtr ( void ) const

returns the pointer of first object

◆ lastPtr() [1/3]

template<class T>
T * KalFitList< T >::lastPtr ( void ) const
inline

returns the pointer of last object

Definition at line 174 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

174 {
175 return _obj + ( _length - 1 );
176}

◆ lastPtr() [2/3]

template<class T>
T * KalFitList< T >::lastPtr ( void ) const

returns the pointer of last object

◆ lastPtr() [3/3]

template<class T>
T * KalFitList< T >::lastPtr ( void ) const

returns the pointer of last object

◆ length() [1/3]

template<class T>
int KalFitList< T >::length ( void ) const
inline

returns the length of the list

Definition at line 178 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

178{ return _length; }

◆ length() [2/3]

template<class T>
int KalFitList< T >::length ( void ) const

returns the length of the list

◆ length() [3/3]

template<class T>
int KalFitList< T >::length ( void ) const

returns the length of the list

◆ operator()() [1/3]

template<class T>
T & KalFitList< T >::operator() ( unsigned i) const
inline

returns the reference of a object by index

Definition at line 166 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

166 {
167 return *( _obj + i );
168}

◆ operator()() [2/3]

template<class T>
T & KalFitList< T >::operator() ( unsigned i) const

returns the reference of a object by index

◆ operator()() [3/3]

template<class T>
T & KalFitList< T >::operator() ( unsigned i) const

returns the reference of a object by index

◆ operator[]() [1/3]

template<class T>
T KalFitList< T >::operator[] ( unsigned i) const
inline

returns a object by index

Definition at line 162 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

162 {
163 return *( _obj + i );
164}

◆ operator[]() [2/3]

template<class T>
T KalFitList< T >::operator[] ( unsigned i) const

returns a object by index

◆ operator[]() [3/3]

template<class T>
T KalFitList< T >::operator[] ( unsigned i) const

returns a object by index

◆ remove() [1/3]

template<class T>
int KalFitList< T >::remove ( int & iterator)
inline

remove objects by index and returns decremented index and length

Definition at line 119 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

119 {
120 *( _obj + ( iterator-- ) ) = *( _obj + ( --_length ) );
121 _remain++;
122 return _length;
123}

◆ remove() [2/3]

template<class T>
int KalFitList< T >::remove ( int & )

remove objects by index and returns decremented index and length

◆ remove() [3/3]

template<class T>
int KalFitList< T >::remove ( int & )

remove objects by index and returns decremented index and length

◆ remove2() [1/3]

template<class T>
void KalFitList< T >::remove2 ( int iterator)
inline

remove objects by index

Definition at line 125 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

125 {
126 *( _obj + iterator ) = *( _obj + ( --_length ) );
127 _remain++;
128}

◆ remove2() [2/3]

template<class T>
void KalFitList< T >::remove2 ( int )

remove objects by index

◆ remove2() [3/3]

template<class T>
void KalFitList< T >::remove2 ( int )

remove objects by index

◆ removeAll() [1/3]

template<class T>
void KalFitList< T >::removeAll ( void )
inline

clear lists and free memory

Definition at line 149 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

149 {
150 free( _obj );
151 _remain = 0;
152 _length = 0;
153 _obj = NULL;
154}

◆ removeAll() [2/3]

template<class T>
void KalFitList< T >::removeAll ( void )

clear lists and free memory

◆ removeAll() [3/3]

template<class T>
void KalFitList< T >::removeAll ( void )

clear lists and free memory

◆ removeLast() [1/3]

template<class T>
void KalFitList< T >::removeLast ( void )
inline

remove just last objects of the list

Definition at line 139 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

139 {
140 _length--;
141 _remain++;
142}

◆ removeLast() [2/3]

template<class T>
void KalFitList< T >::removeLast ( void )

remove just last objects of the list

◆ removeLast() [3/3]

template<class T>
void KalFitList< T >::removeLast ( void )

remove just last objects of the list

◆ replace() [1/3]

template<class T>
void KalFitList< T >::replace ( int i,
T src )
inline

replace index-th object by the object src

Definition at line 130 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

130{ *( _obj + i ) = src; }

◆ replace() [2/3]

template<class T>
void KalFitList< T >::replace ( int i,
T src )

replace index-th object by the object src

◆ replace() [3/3]

template<class T>
void KalFitList< T >::replace ( int i,
T src )

replace index-th object by the object src

◆ resize() [1/3]

template<class T>
void KalFitList< T >::resize ( void )
inline

re-allocate memory to reduce size

Definition at line 156 of file InstallArea/x86_64-el9-gcc13-dbg/include/KalFitAlg/KalFitList.h.

156 {
157 _obj = (T*)realloc( _obj, _length * sizeof( T ) );
158 _remain = 0;
159 _length_to_alloc = _length;
160}

◆ resize() [2/3]

template<class T>
void KalFitList< T >::resize ( void )

re-allocate memory to reduce size

◆ resize() [3/3]

template<class T>
void KalFitList< T >::resize ( void )

re-allocate memory to reduce size


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