datamap object passed around while loading
[laserbrain_demo] / src / datamap.h
index 47e7d49..137fdca 100644 (file)
@@ -1,13 +1,25 @@
 #ifndef DATAMAP_H_
 #define DATAMAP_H_
 
-void datamap_reset();
-void datamap_set_path(const char *path);
+#include <vector>
+#include <map>
+#include <string>
 
-bool datamap_load_map(const char *fname);
-void datamap_map(const char *re, const char *path);
+class DataMap {
+       std::vector<std::pair<std::string, std::string>> dmap;
+       mutable std::map<std::string, std::string> cache;
+       std::string root;
 
-int datamap_lookup(const char *in, char *buf, int bsz);
-int datamap_path_size(const char *in);
+public:
+       void clear();
+
+       void set_path(const char *path);
+
+       bool load_map(const char *fname);
+       void map(const char *match, const char *path);
+
+       int lookup(const char *in, char *buf, int bsz) const;
+       int path_size(const char *in) const;
+};
 
 #endif // DATAMAP_H_