-
Notifications
You must be signed in to change notification settings - Fork 20
/
stlmap_wrapper.cpp
42 lines (39 loc) · 1.27 KB
/
stlmap_wrapper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "stlmap_wrapper.hpp"
extern "C" tree_api* create_tree(const tree_options_t& opt)
{
if (opt.key_size == 4)
{
if (opt.value_size == 4)
return new stlmap_wrapper<uint32_t, uint32_t>();
else if (opt.value_size == 8)
return new stlmap_wrapper<uint32_t, uint64_t>();
else if (opt.value_size > 8)
return new stlmap_wrapper<uint32_t, std::string>();
else
return nullptr;// ERROR
}
else if (opt.key_size == 8)
{
if (opt.value_size == 4)
return new stlmap_wrapper<uint64_t, uint32_t>();
else if (opt.value_size == 8)
return new stlmap_wrapper<uint64_t, uint64_t>();
else if (opt.value_size > 8)
return new stlmap_wrapper<uint64_t, std::string>();
else
return nullptr;// ERROR
}
else if (opt.key_size > 8)
{
if (opt.value_size == 4)
return new stlmap_wrapper<std::string, uint32_t>();
else if (opt.value_size == 8)
return new stlmap_wrapper<std::string, uint64_t>();
else if (opt.value_size > 8)
return new stlmap_wrapper<std::string, std::string>();
else
return nullptr ;// ERROR
}
else
return nullptr; // ERROR!
}