added loaded callbacks to DataSet
[laserbrain_demo] / src / dataset.h
index a4736c4..5c4ca51 100644 (file)
 #ifndef DATASET_H_
 #define DATASET_H_
 
+#include <vector>
 #include <string>
 #include <map>
 #include <resman.h>
 
 template <typename T>
 class DataSet {
+public:
+       typedef void (*LoadedCallbackFunc)(T, void*);
+
 protected:
        mutable std::map<std::string, T> data;
        mutable struct resman *rman;
 
+       std::vector<std::pair<LoadedCallbackFunc, void*> > loaded_cb;
+
        T (*create)();
        bool (*load)(T, const char*);
        bool (*done)(T);
@@ -46,6 +52,9 @@ public:
        void update();
 
        T get(const char *name) const;
+
+       void add_loaded_callback(LoadedCallbackFunc func, void *cls = 0);
+       bool remove_loaded_callback(LoadedCallbackFunc func);
 };
 
 #include "dataset.inl"