#include <FastList.h>
Public Member Functions | |
| FastList () | |
| virtual | ~FastList () |
| unsigned int | Add (const T &t) |
| void | Reset () |
| int | ExtractAndErase (std::vector< T > &vec, const unsigned int modnum=256) |
| int | Extract (std::vector< T > &vec) |
| int | AddRandomData (vecuc &vData) |
| unsigned int | Size () const |
Private Attributes | |
| ListItem< T > * | m_pHead |
| ListItem< T > * | m_pLast |
| unsigned int | m_size |
| CMclCritSec | m_critsec |
![]()
Definition at line 21 of file FastList.h.
![]()
|
|||||||||
|
Definition at line 39 of file FastList.h.
|
|
|||||||||
|
Definition at line 46 of file FastList.h.
00047 {
00048 ListItem<T>* p = m_pHead;
00049 while (p)
00050 {
00051 ListItem<T>* pNext = p->m_pNext;
00052 delete p;
00053 p = pNext;
00054 }
00055 }
|
![]()
|
||||||||||
|
Definition at line 57 of file FastList.h. Referenced by CitadelSoftwareInc::TestFastList001().
00058 {
00059 m_critsec.Enter();
00060 if (!m_pHead)
00061 {
00062 m_pHead = new ListItem<T>(t);
00063 m_pLast = m_pHead;
00064 m_size = 1;
00065 }
00066 else if(m_pLast)
00067 {
00068 if (m_pLast->m_pNext)
00069 {
00070 m_pLast->m_pNext->m_t = t;
00071 m_pLast = m_pLast->m_pNext;
00072 }
00073 else
00074 {
00075 m_pLast->m_pNext = new ListItem<T>(t);
00076 m_pLast = m_pLast->m_pNext;
00077 }
00078 ++m_size;
00079 }
00080 else
00081 {
00082 m_pLast = m_pHead;
00083 m_pLast->m_t = t;
00084 ++m_size;
00085 }
00086
00087 m_critsec.Leave();
00088
00089 return m_size;
00090 }
|
|
||||||||||
|
Definition at line 174 of file FastList.h.
00175 {
00176 int count=0;
00177 unsigned char uc=0;
00178
00179 m_critsec.Enter();
00180
00181 ListItem<T>* p = m_pHead;
00182 while(p)
00183 {
00184 const unsigned char* pData = (unsigned char*)p;
00185 for (int i=0; i<sizeof(ListItem<T>*); ++i)
00186 {
00187 uc = pData[i];
00188 if (uc)
00189 {
00190 vData.push_back(uc);
00191 ++count;
00192 }
00193 }
00194
00195 p = p->m_pNext;
00196 }
00197
00198 m_critsec.Leave();
00199
00200 return count;
00201 }
|
|
||||||||||
|
Definition at line 145 of file FastList.h. Referenced by CitadelSoftwareInc::TestFastList001().
00146 {
00147 vec.clear();
00148
00149 if (m_size == 0)
00150 return 0;
00151
00152 m_critsec.Enter();
00153
00154 vec.resize(m_size);
00155 unsigned int i=0;
00156 ListItem<T>* p = m_pHead;
00157 while(p)
00158 {
00159 assert(i<m_size);
00160 vec[i++] = p->m_t;
00161 if (p == m_pLast)
00162 break;
00163 p = p->m_pNext;
00164 }
00165
00166 assert(i == m_size);
00167
00168 m_critsec.Leave();
00169
00170 return m_size;
00171 }
|
|
||||||||||||||||
|
Definition at line 113 of file FastList.h. Referenced by CitadelSoftwareInc::TestFastList001().
00114 {
00115 vec.clear();
00116 if (m_size == 0)
00117 return 0;
00118
00119 m_critsec.Enter();
00120
00121 unsigned int i=0;
00122 vec.resize(m_size);
00123 ListItem<T>* p = m_pHead;
00124 while (p)
00125 {
00126 assert(i<m_size);
00127 vec[i++] = p->m_t;
00128 p->m_t = rand() % modnum; // overwrite the existing data with something random looking
00129 if (p == m_pLast)
00130 break;
00131
00132 p = p->m_pNext;
00133 }
00134
00135 assert(i == m_size);
00136 int retval = m_size;
00137 m_size = 0;
00138 m_pLast = NULL;
00139
00140 m_critsec.Leave();
00141
00142 return retval;
00143 }
|
|
|||||||||
|
Definition at line 92 of file FastList.h.
00093 {
00094 m_critsec.Enter();
00095
00096 if (m_pLast)
00097 {
00098 ListItem<T> *p = m_pHead;
00099 while(p)
00100 {
00101 p->m_t = rand() % 256; // overwrite the existing data with something random looking
00102 if (p == m_pLast)
00103 break;
00104 p = p->m_pNext;
00105 }
00106 m_pLast = NULL;
00107 m_size = 0;
00108 }
00109
00110 m_critsec.Leave();
00111 }
|
|
|||||||||
|
Definition at line 203 of file FastList.h. Referenced by CitadelSoftwareInc::TestFastList001().
|
![]()
|
|||||
|
Definition at line 219 of file FastList.h. |
|
|||||
|
Definition at line 215 of file FastList.h. |
|
|||||
|
Definition at line 216 of file FastList.h. |
|
|||||
|
Definition at line 218 of file FastList.h. |
![]()
| FastList.h |
![]()
![]()
1.3.5