20 template <
typename T,
bool T_autoDelete = false>
50 DtlObjPtr
getData(DtlObjPtr args,
const DtFilename& searchPath,
60 void*
remove(DtListItem* item);
61 void*
remove(T* item);
88 namespace DtBufferSerialize
92 template <
typename T,
bool T_autoDelete>
98 template <
typename T,
bool T_autoDelete>
105 template <
typename T,
bool T_autoDelete>
109 template <
typename T,
bool T_autoDelete>
112 myAutoDelete(T_autoDelete)
116 template <
typename T,
bool T_autoDelete>
119 myAutoDelete(T_autoDelete)
123 template <
typename T,
bool T_autoDelete>
126 myAutoDelete(T_autoDelete)
130 template <
typename T,
bool T_autoDelete>
133 DtRwList(name, orig, parentRegistry),
134 myAutoDelete(orig.myAutoDelete)
139 template <
typename T,
bool T_autoDelete>
142 DtRwList(name, orig, parentRegistry),
143 myAutoDelete(orig.myAutoDelete)
148 template <
typename T,
bool T_autoDelete>
151 DtRwList(orig.name(), orig, parentRegistry),
152 myAutoDelete(orig.myAutoDelete)
157 template <
typename T,
bool T_autoDelete>
162 removeAndDeleteAll();
166 template <
typename T,
bool T_autoDelete>
181 template <
typename T,
bool T_autoDelete>
184 DtListItem* listItem = itemLookup(item);
188 return remove(listItem);
194 template <
typename T,
bool T_autoDelete>
197 T* d = (T*)
DtRwList::remove(static_cast<DtReaderWriter*>(item->data()), item);
210 template <
typename T,
bool T_autoDelete>
213 std::vector<T*> toDelete;
217 for (T* info = iter.
first(); info; info = iter.
next())
219 toDelete.push_back(info);
224 int iLimit = toDelete.size();
226 for (
int i = 0; i < iLimit; i++)
232 template <
typename T,
bool T_autoDelete>
236 DtlObjPtr nameObj = DtcCar(args);
238 DtlObjPtr nextItem = DtcCdr(args);
239 if(nextItem == DtlObjPtr::nil())
244 T* value =
new T(nameObj->pname());
245 value->getSelf(args, searchPath, variableBindings);
249 return DtcCdr(DtcCdr(args));
252 template <
typename T,
bool T_autoDelete>
257 removeAndDeleteAll();
265 template <
typename T,
bool T_autoDelete>
270 for (T* info = iter.
first(); info; info = iter.
next())
276 template <
typename T,
bool T_autoDelete>
279 return ListReaderWriterType();
282 template <
typename T,
bool T_autoDelete>
285 static T theDefaultType(
"default-name");
286 static std::string* listType =
new std::string(
287 std::string(theDefaultType.readerWriterType()) +
"-templated-list");
288 return listType->c_str();
291 template <
typename T,
bool T_autoDelete>
294 if (count() == rhs.count())
296 DtListItem* thisItem = first();
297 DtListItem* thatItem = rhs.first();
299 while (thisItem && thatItem)
301 T* thisElement =
static_cast<T*
>(thisItem->data());
302 T* thatElement =
static_cast<T*
>(thatItem->data());
304 if (*thisElement != *thatElement)
309 thisItem = thisItem->next();
310 thatItem = thatItem->next();
319 template <
typename T,
bool T_autoDelete>
322 return !(*
this == rhs);
325 namespace DtBufferSerialize
327 template <
typename T,
bool T_autoDelete>
332 DtListItem* item = val.first();
335 const T* itemValue =
static_cast<const T*
>(item->data());
342 template <
typename T,
bool T_autoDelete>
345 DtU16 n = val.count();
346 buffer =
encode(n, buffer);
347 DtListItem* item = val.first();
350 const T* itemValue =
static_cast<const T*
>(item->data());
351 buffer =
encode(*itemValue, buffer);
357 template <
typename T,
bool T_autoDelete>
361 buffer =
decode(n, buffer);
363 for(
int i = 0; i < n;++i)
365 T* itemValue =
new T(
"item", &(val.
registry()));
366 buffer =
decode(*itemValue, buffer);