-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.cpp
executable file
·61 lines (47 loc) · 1.96 KB
/
Config.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "Config.h"
#include "Isis.h"
#include <fstream> //for settings write & read
#include <boost/exception/all.hpp>
//------------------------------------------------------------------------------
using namespace isis;
//------------------------------------------------------------------------------
Config::Config(int argc, char**argv)
{
specifyOptions();
// Load from file first, then override w/ command-line
po::store(po::parse_command_line(argc, argv, desc_), vm_);
po::notify(vm_);
validateParams(vm_, desc_);
}
Config::~Config() {
}
void Config::validateParams(const po::variables_map& vm,
const po::options_description& desc) {
// throw exceptions for invalid config
if(vm.count("help")) {
std::cerr << std::endl << desc_ << std::endl;
exit(0); // HACK
}
}
void Config::specifyOptions(){
desc_.add_options()
("help,h","Produce this help message")
("verbose,v",po::value<size_t>(&verbose)->default_value(0),
"Verbosity level for logging")
("log-path,L",po::value<std::string>(&logPath)->default_value(DEFAULT_LOG_DIR),
"Path to log file")
("num-cams,N",po::value<size_t>(&numCams)->default_value(DEFAULT_NUM_CAMS),
"Number of cameras to look for")
("single-cam,C",po::value<int>(&singleCam)->default_value(DEFAULT_SINGLE_CAM),
"Number of cameras to look for")
("height",po::value<size_t>(&height)->default_value(DEFAULT_HEIGHT),
"Try to set camera image height")
("width",po::value<size_t>(&width)->default_value(DEFAULT_WIDTH),
"Try to set camera image width")
("save-interval,s",po::value<size_t>(&saveInterval)->default_value(DEFAULT_SAVE_INTERVAL),
"Interval to save weight matrix")
("load-weights,w",po::value<std::string>(&weightPath)->default_value(DEFAULT_WEIGHT_PATH),
"Path to our serialized weight & bias matrices. Use boost format filename structure.")
;
}
//------------------------------------------------------------------------------