--- a/include/serialize.h Tue May 06 09:39:58 2008 +0200
+++ b/include/serialize.h Thu May 08 09:21:25 2008 +0200
@@ -1,5 +1,6 @@
-/*
- * serialize.h: object serialization functions
+/**
+ * @file serialize.h
+ * @brief Object serialization functions
*
* This file is part of Pyrit Ray Tracer.
*
@@ -33,6 +34,12 @@
#include "container.h"
#include "kdtree.h"
+/**
+ * Maps pointers to indices
+ *
+ * This helps when we are saving objects from random memory places
+ * to file stream
+ */
class Indexer
{
map <void *, int> indexmap;
@@ -40,7 +47,16 @@
public:
Indexer(): indexmap(), index(0) {};
void reset() { indexmap.clear(); index = 0; };
+
+ /**
+ * Make new index or return number of already indexed object
+ * @param[in] o object for indexation
+ * @param[out] retidx returned index
+ * @retval true if object was found
+ * @retval false if new index was made for the object
+ */
bool get(void *o, int &retidx);
+
const int &operator[](void *o) { return indexmap[o]; };
};