--- a/include/mempool.h Tue May 06 09:39:58 2008 +0200
+++ b/include/mempool.h Thu May 08 09:21:25 2008 +0200
@@ -1,5 +1,6 @@
-/*
- * mempool.h: memory pool
+/**
+ * @file mempool.h
+ * @brief Memory pool for aligned allocation
*
* This file is part of Pyrit Ray Tracer.
*
@@ -29,6 +30,9 @@
#include "common.h"
+/**
+ * Memory pool template
+ */
template <typename Type>
class MemoryPool
{
@@ -45,8 +49,18 @@
#endif
};
public:
+ /**
+ * Construct memory pool with default alignment (16)
+ * @see MemoryPool(size_t, size_t)
+ */
MemoryPool(const size_t inisize):
cur(0), size(inisize), align(16) { init(); };
+
+ /**
+ * Construct memory pool
+ * @param[in] inisize Initial capacity in Type count
+ * @param[in] inialign Set memory alignement of items
+ */
MemoryPool(const size_t inisize, const size_t inialign):
cur(0), size(inisize), align(inialign) { init(); };
~MemoryPool()
@@ -58,6 +72,10 @@
#endif
};
+ /**
+ * Allocate memory for one item of type Type
+ * @return Pointer to allocated memory
+ */
void *alloc()
{
if (cur == size)