00001
00012
00013 #include <stdio.h>
00014
00015
00016 #include <vmath/Base.h>
00017 #include <vmath/Error.h>
00018 #include <vmath/errorlog.h>
00019 #include <vmath/memory.h>
00020
00021
00022
00023
00024 namespace GE {
00025
00026
00027 class Entity;
00028
00029
00037 template <class T>
00038 class EntityList {
00039
00040 public:
00041 inline EntityList ();
00042 inline ~EntityList ();
00043
00044 inline ERR_type Append_Entity (const T *entity);
00045
00046 public:
00047 T **entityList;
00048 Int32 numEntities;
00049 };
00050
00051
00059 template <class T>
00060 inline EntityList<T>::EntityList (): entityList (NULL), numEntities (0) {}
00061
00062
00063 template <class T>
00064 inline EntityList<T>::~EntityList ()
00072 {
00073 if (entityList)
00074 MEM_ArrayFree ((void**)&entityList);
00075 }
00076
00077
00078 template <class T>
00079 ERR_type EntityList<T>::Append_Entity (const T *entity)
00091 {
00092 if (!MEM_ArrayEntryAppend ((void**)&entityList, numEntities++,
00093 sizeof (Entity*), &entity))
00094 return (ERR_insufficient_memory);
00095
00096 return (ERR_no_errors);
00097 }
00098
00099
00100 }