Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
0df36de6
Commit
0df36de6
authored
Jan 24, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add globalConstants
parent
1785ef27
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
global.constant
conf/global.constant
+2
-0
test_constants.cc
debug/test_constants.cc
+6
-0
constants.cc
util/constants.cc
+31
-0
constants.hh
util/constants.hh
+9
-0
No files found.
conf/global.constant
0 → 100644
View file @
0df36de6
loadCount:1000000
other:1
debug/test_constants.cc
0 → 100644
View file @
0df36de6
#include "util/constants.hh"
int
main
(){
initGlobalConstants
();
return
0
;
}
util/constants.cc
View file @
0df36de6
#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
;
}
util/constants.hh
View file @
0df36de6
...
...
@@ -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
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment