1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2010 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
132 |
return pData[iPosition]; |
return pData[iPosition]; |
133 |
} |
} |
134 |
|
|
135 |
|
/** |
136 |
|
* Copy constructor. |
137 |
|
*/ |
138 |
|
ArrayList(const ArrayList& list) { |
139 |
|
copy(list); |
140 |
|
} |
141 |
|
|
142 |
|
/** |
143 |
|
* Assignment. |
144 |
|
*/ |
145 |
|
ArrayList& operator=(const ArrayList& list) { |
146 |
|
if (this != &list) { |
147 |
|
clear(); |
148 |
|
copy(list); |
149 |
|
} |
150 |
|
return *this; |
151 |
|
} |
152 |
|
|
153 |
private: |
private: |
154 |
T* pData; |
T* pData; |
155 |
int iSize; |
int iSize; |
156 |
|
|
157 |
|
void copy(const ArrayList& list) { |
158 |
|
iSize = list.iSize; |
159 |
|
if (list.pData) { |
160 |
|
pData = new T[iSize]; |
161 |
|
for (int i = 0 ; i < iSize ; i++) { |
162 |
|
pData[i] = list.pData[i]; |
163 |
|
} |
164 |
|
} else { |
165 |
|
pData = NULL; |
166 |
|
} |
167 |
|
} |
168 |
}; |
}; |
169 |
|
|
170 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |