00001
00002
00003 #include "jna/functions.hpp"
00004 #include "jna/constant_size_types.hpp"
00005
00006 using namespace aitools::value;
00007 using namespace aitools::bighashmap::core;
00008
00009 const char*
00010 bhm_build(int type_id, const char* src_dir, const char* dst_dir)
00011 {
00012 if (src_dir == NULL || dst_dir == NULL) return NULL;
00013
00014 bfs::path idx_file;
00015 switch (type_id)
00016 {
00017 case 101:
00018 idx_file = big_hash_map<mapper<101>::type>::build(src_dir, dst_dir);
00019 break;
00020 case 102:
00021 idx_file = big_hash_map<mapper<102>::type>::build(src_dir, dst_dir);
00022 break;
00023 case 103:
00024 idx_file = big_hash_map<mapper<103>::type>::build(src_dir, dst_dir);
00025 break;
00026 case 201:
00027 idx_file = big_hash_map<mapper<201>::type>::build(src_dir, dst_dir);
00028 break;
00029 case 202:
00030 idx_file = big_hash_map<mapper<202>::type>::build(src_dir, dst_dir);
00031 break;
00032 case 203:
00033 idx_file = big_hash_map<mapper<203>::type>::build(src_dir, dst_dir);
00034 break;
00035 case 204:
00036 idx_file = big_hash_map<mapper<204>::type>::build(src_dir, dst_dir);
00037 break;
00038 case 205:
00039 idx_file = big_hash_map<mapper<205>::type>::build(src_dir, dst_dir);
00040 break;
00041 case 206:
00042 idx_file = big_hash_map<mapper<206>::type>::build(src_dir, dst_dir);
00043 break;
00044 case 207:
00045 idx_file = big_hash_map<mapper<207>::type>::build(src_dir, dst_dir);
00046 break;
00047 case 208:
00048 idx_file = big_hash_map<mapper<208>::type>::build(src_dir, dst_dir);
00049 break;
00050 case 209:
00051 idx_file = big_hash_map<mapper<209>::type>::build(src_dir, dst_dir);
00052 break;
00053 case 210:
00054 idx_file = big_hash_map<mapper<210>::type>::build(src_dir, dst_dir);
00055 break;
00056
00057 case 301:
00058 idx_file = big_hash_map<mapper<301>::type>::build(src_dir, dst_dir);
00059 break;
00060 case 302:
00061 idx_file = big_hash_map<mapper<302>::type>::build(src_dir, dst_dir);
00062 break;
00063 case 303:
00064 idx_file = big_hash_map<mapper<303>::type>::build(src_dir, dst_dir);
00065 break;
00066 case 304:
00067 idx_file = big_hash_map<mapper<304>::type>::build(src_dir, dst_dir);
00068 break;
00069 case 305:
00070 idx_file = big_hash_map<mapper<305>::type>::build(src_dir, dst_dir);
00071 break;
00072 case 306:
00073 idx_file = big_hash_map<mapper<306>::type>::build(src_dir, dst_dir);
00074 break;
00075 case 307:
00076 idx_file = big_hash_map<mapper<307>::type>::build(src_dir, dst_dir);
00077 break;
00078 case 308:
00079 idx_file = big_hash_map<mapper<308>::type>::build(src_dir, dst_dir);
00080 break;
00081 case 309:
00082 idx_file = big_hash_map<mapper<309>::type>::build(src_dir, dst_dir);
00083 break;
00084 case 401:
00085 idx_file = big_hash_map<mapper<401>::type>::build(src_dir, dst_dir);
00086 break;
00087 case 402:
00088 idx_file = big_hash_map<mapper<402>::type>::build(src_dir, dst_dir);
00089 break;
00090 case 403:
00091 idx_file = big_hash_map<mapper<403>::type>::build(src_dir, dst_dir);
00092 break;
00093 case 404:
00094 idx_file = big_hash_map<mapper<404>::type>::build(src_dir, dst_dir);
00095 break;
00096 case 405:
00097 idx_file = big_hash_map<mapper<405>::type>::build(src_dir, dst_dir);
00098 break;
00099 case 406:
00100 idx_file = big_hash_map<mapper<406>::type>::build(src_dir, dst_dir);
00101 break;
00102 case 407:
00103 idx_file = big_hash_map<mapper<407>::type>::build(src_dir, dst_dir);
00104 break;
00105 case 408:
00106 idx_file = big_hash_map<mapper<408>::type>::build(src_dir, dst_dir);
00107 break;
00108 default:
00109 aitools::util::log_error("Unsupported value type id", type_id);
00110 }
00111 return idx_file.string().c_str();
00112 }
00113
00114 raw_big_hash_map*
00115 bhm_open(int type_id, const char* idx_file, aitools::util::memory_type memory)
00116 {
00117 if (idx_file == NULL) return NULL;
00118
00119 raw_big_hash_map* bhm(NULL);
00120 switch (type_id)
00121 {
00122 case 101:
00123 bhm = big_hash_map<mapper<101>::type>::open(idx_file, memory);
00124 break;
00125 case 102:
00126 bhm = big_hash_map<mapper<102>::type>::open(idx_file, memory);
00127 break;
00128 case 103:
00129 bhm = big_hash_map<mapper<103>::type>::open(idx_file, memory);
00130 break;
00131 case 201:
00132 bhm = big_hash_map<mapper<201>::type>::open(idx_file, memory);
00133 break;
00134 case 202:
00135 bhm = big_hash_map<mapper<202>::type>::open(idx_file, memory);
00136 break;
00137 case 203:
00138 bhm = big_hash_map<mapper<203>::type>::open(idx_file, memory);
00139 break;
00140 case 204:
00141 bhm = big_hash_map<mapper<204>::type>::open(idx_file, memory);
00142 break;
00143 case 205:
00144 bhm = big_hash_map<mapper<205>::type>::open(idx_file, memory);
00145 break;
00146 case 206:
00147 bhm = big_hash_map<mapper<206>::type>::open(idx_file, memory);
00148 break;
00149 case 207:
00150 bhm = big_hash_map<mapper<207>::type>::open(idx_file, memory);
00151 break;
00152 case 208:
00153 bhm = big_hash_map<mapper<208>::type>::open(idx_file, memory);
00154 break;
00155 case 209:
00156 bhm = big_hash_map<mapper<209>::type>::open(idx_file, memory);
00157 break;
00158 case 210:
00159 bhm = big_hash_map<mapper<210>::type>::open(idx_file, memory);
00160 break;
00161
00162 case 301:
00163 bhm = big_hash_map<mapper<301>::type>::open(idx_file, memory);
00164 break;
00165 case 302:
00166 bhm = big_hash_map<mapper<302>::type>::open(idx_file, memory);
00167 break;
00168 case 303:
00169 bhm = big_hash_map<mapper<303>::type>::open(idx_file, memory);
00170 break;
00171 case 304:
00172 bhm = big_hash_map<mapper<304>::type>::open(idx_file, memory);
00173 break;
00174 case 305:
00175 bhm = big_hash_map<mapper<305>::type>::open(idx_file, memory);
00176 break;
00177 case 306:
00178 bhm = big_hash_map<mapper<306>::type>::open(idx_file, memory);
00179 break;
00180 case 307:
00181 bhm = big_hash_map<mapper<307>::type>::open(idx_file, memory);
00182 break;
00183 case 308:
00184 bhm = big_hash_map<mapper<308>::type>::open(idx_file, memory);
00185 break;
00186 case 309:
00187 bhm = big_hash_map<mapper<309>::type>::open(idx_file, memory);
00188 break;
00189 case 401:
00190 bhm = big_hash_map<mapper<401>::type>::open(idx_file, memory);
00191 break;
00192 case 402:
00193 bhm = big_hash_map<mapper<402>::type>::open(idx_file, memory);
00194 break;
00195 case 403:
00196 bhm = big_hash_map<mapper<403>::type>::open(idx_file, memory);
00197 break;
00198 case 404:
00199 bhm = big_hash_map<mapper<404>::type>::open(idx_file, memory);
00200 break;
00201 case 405:
00202 bhm = big_hash_map<mapper<405>::type>::open(idx_file, memory);
00203 break;
00204 case 406:
00205 bhm = big_hash_map<mapper<406>::type>::open(idx_file, memory);
00206 break;
00207 case 407:
00208 bhm = big_hash_map<mapper<407>::type>::open(idx_file, memory);
00209 break;
00210 case 408:
00211 bhm = big_hash_map<mapper<408>::type>::open(idx_file, memory);
00212 break;
00213 default:
00214 aitools::util::log_error("Unsupported value type id", type_id);
00215 }
00216 return bhm;
00217 }
00218
00219 bool
00220 bhm_find(raw_big_hash_map* bhm, const char* key, char* value)
00221 {
00222 if (bhm == NULL || key == NULL || value == NULL) return false;
00223 return bhm->find(key, value);
00224 }
00225
00226 int64_t
00227 bhm_size(raw_big_hash_map* bhm)
00228 {
00229 if (bhm == NULL) return 0;
00230 return bhm->size();
00231 }
00232
00233 void
00234 bhm_close(raw_big_hash_map* bhm)
00235 {
00236 delete bhm;
00237 }