datamap
[laserbrain_demo] / src / datamap.cc
diff --git a/src/datamap.cc b/src/datamap.cc
new file mode 100644 (file)
index 0000000..bf8854c
--- /dev/null
@@ -0,0 +1,44 @@
+#include <vector>
+#include <map>
+#include <string>
+#include "datamap.h"
+
+static std::vector<std::pair<std::string, std::string>> dmap;
+static std::map<std::string, std::string> cache;
+static std::string root;
+
+void datmap_reset()
+{
+       root.clear();
+       dmap.clear();
+       cache.clear();
+}
+
+void datmap_set_path(const char *path)
+{
+       root = std::string(path);
+}
+
+bool datmap_load_map(const char *fname)
+{
+       std::string path = root.empty() ? fname : root + std::string("/") + fname;
+       return false;   // TODO cont...
+}
+
+void datmap_map(const char *re, const char *path)
+{
+       std::pair<std::string, std::string> mapping;
+       mapping.first = std::string(re);
+       mapping.second = std::string(path);
+       dmap.push_back(mapping);
+}
+
+int datmap_lookup(const char *in, char *buf, int bsz)
+{
+       return -1;      // TODO
+}
+
+int datmap_path_size(const char *in)
+{
+       return datmap_lookup(in, 0, 0);
+}