Derecho  0.9
Distributed systems toolkit for RDMA
test.cpp
Go to the documentation of this file.
1 #include <derecho/conf/conf.hpp>
2 #include <iostream>
3 #include <spdlog/spdlog.h>
4 
5 int main(int argc, char** argv) {
6  derecho::Conf::initialize(argc, argv);
7  // spdlog::set_level(spdlog::level::trace);
8  std::cout << "list of configurations:" << std::endl;
9  // const derecho::Conf * pc = derecho::Conf::get();
10  // const std::string k("RDMA/provider");
11  // const std::string x = pc->getString(k);
12  int ind = 0;
13  while(1) {
14  if(derecho::Conf::long_options[ind].name == nullptr) {
15  break;
16  }
17  std::cout << derecho::Conf::long_options[ind].name << ":\t" << (derecho::Conf::get()->getString(derecho::Conf::long_options[ind].name)) << std::endl;
18  ind++;
19  }
20  // print undocumented keys:
21  if(derecho::hasCustomizedConfKey("UNDOCUMENTED/key")) {
22  std::cout << "UNDOCUMENTED/key"
23  << ":\t" << derecho::getConfString("UNDOCUMENTED/key") << std::endl;
24  } else {
25  std::cout << "UNDOCUMENTED/key is not found." << std::endl;
26  }
27  return 0;
28 }
const std::string & getConfString(const std::string &key)
Definition: conf.cpp:110
int argc
static struct option long_options[]
Definition: conf.hpp:97
static const Conf * get() noexcept
Definition: conf.cpp:102
static void initialize(int argc, char *argv[], const char *conf_file=nullptr)
Definition: conf.cpp:67
char ** argv
int main(int argc, char **argv)
Definition: test.cpp:5
const bool hasCustomizedConfKey(const std::string &key)
Definition: conf.cpp:150
const std::string & getString(const std::string &key) const
get configuration
Definition: conf.hpp:137