2 * Copyright 2003 Marcus Overhagen
3 * Distributed under the terms of the MIT License.
5 #ifndef _MEDIA_RT_LIST_H
6 #define _MEDIA_RT_LIST_H
9 /*! A simple list template that uses realtime
10 memory and does no error checking. Since
11 it doesn't call constructors or destructors,
12 don't use it to store objects.
14 // TODO: no error checking? Great.
18 #include <RealtimeAlloc.h>
21 template<class value
> class RtList
{
27 items((value
*)rtm_alloc(NULL
, sizeof(value
) * INIT_COUNT
))
38 if (item_count
== item_max
) {
39 item_max
+= INC_COUNT
;
40 rtm_realloc((void**)&items
, sizeof(value
) * item_max
);
42 return &items
[item_count
++];
45 value
* ItemAt(int index
)
61 RtList(const RtList
<value
>& other
);
62 RtList
<value
> &operator=(const RtList
<value
>& other
);
65 enum { INIT_COUNT
= 8, INC_COUNT
= 16 };
72 #endif // _MEDIA_RT_LIST_H