datamap
[laserbrain_demo] / src / datamap.cc
1 #include <vector>
2 #include <map>
3 #include <string>
4 #include "datamap.h"
5
6 static std::vector<std::pair<std::string, std::string>> dmap;
7 static std::map<std::string, std::string> cache;
8 static std::string root;
9
10 void datmap_reset()
11 {
12         root.clear();
13         dmap.clear();
14         cache.clear();
15 }
16
17 void datmap_set_path(const char *path)
18 {
19         root = std::string(path);
20 }
21
22 bool datmap_load_map(const char *fname)
23 {
24         std::string path = root.empty() ? fname : root + std::string("/") + fname;
25         return false;   // TODO cont...
26 }
27
28 void datmap_map(const char *re, const char *path)
29 {
30         std::pair<std::string, std::string> mapping;
31         mapping.first = std::string(re);
32         mapping.second = std::string(path);
33         dmap.push_back(mapping);
34 }
35
36 int datmap_lookup(const char *in, char *buf, int bsz)
37 {
38         return -1;      // TODO
39 }
40
41 int datmap_path_size(const char *in)
42 {
43         return datmap_lookup(in, 0, 0);
44 }