Commit 0df36de6 authored by yiwenshao's avatar yiwenshao

add globalConstants

parent 1785ef27
loadCount:1000000
other:1
#include "util/constants.hh"
int main(){
initGlobalConstants();
return 0;
}
#include "util/constants.hh"
#include <string>
#include <fstream>
const char *cryptdb_dir = getenv("CRYPTDB_DIR");
//assert(cryptdb_dir!=NULL);
const globalConstants constGlobalConstants = initGlobalConstants();
globalConstants initGlobalConstants(){
printf("%s",cryptdb_dir);
assert(cryptdb_dir != NULL);
assert(cryptdb_dir[0]=='/');
std::string prefix = std::string(cryptdb_dir);
std::string filename = prefix+"/conf/"+std::string("global.constant");
std::ifstream infile(filename);
globalConstants res;
std::string line;
while(std::getline(infile,line)){
int index = line.find(":");
std::string head = line.substr(0,index);
if(head=="loadCount"){
res.loadCount=stoi(line.substr(index+1));
}else if(head=="other"){
;
}else{
assert(0);
}
}
infile.close();
return res;
}
......@@ -9,3 +9,12 @@ added by et. all et related things.
#include <stdio.h>
extern const char* cryptdb_dir;
extern const int gtoken;
struct globalConstants{
int loadCount;/*used to limit the number of final_load*/
};
extern const globalConstants constGlobalConstants;
globalConstants initGlobalConstants();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment