Fast map matching  0.1.0
network_config.cpp
1 #include "config/network_config.hpp"
2 #include "util/util.hpp"
3 #include "util/debug.hpp"
4 
6  SPDLOG_INFO("NetworkConfig");
7  SPDLOG_INFO("File name: {} ",file);
8  SPDLOG_INFO("ID name: {} ",id);
9  SPDLOG_INFO("Source name: {} ",source);
10  SPDLOG_INFO("Target name: {} ",target);
11 };
12 
14  const boost::property_tree::ptree &xml_data){
15  std::string file = xml_data.get<std::string>("config.input.network.file");
16  std::string id = xml_data.get("config.input.network.id", "id");
17  std::string source = xml_data.get("config.input.network.source","source");
18  std::string target = xml_data.get("config.input.network.target","target");
19  return FMM::CONFIG::NetworkConfig{file, id, source, target};
20 };
21 
23  const cxxopts::ParseResult &arg_data){
24  std::string file = arg_data["network"].as<std::string>();
25  std::string id = arg_data["network_id"].as<std::string>();
26  std::string source = arg_data["source"].as<std::string>();
27  std::string target = arg_data["target"].as<std::string>();
28  return FMM::CONFIG::NetworkConfig{file, id, source, target};
29 };
30 
32  if (!UTIL::file_exists(file)){
33  SPDLOG_CRITICAL("Network file not found {}",file);
34  return false;
35  }
36  return true;
37 }
FMM::CONFIG::NetworkConfig::file
std::string file
filename
Definition: network_config.hpp:24
FMM::CONFIG::NetworkConfig::print
void print() const
Print informaiton.
Definition: network_config.cpp:5
FMM::CONFIG::NetworkConfig::target
std::string target
target field/column name
Definition: network_config.hpp:27
FMM::CONFIG::NetworkConfig
Network configuration class for reading network from a file.
Definition: network_config.hpp:23
FMM::CONFIG::NetworkConfig::validate
bool validate() const
Validate the GPS configuration for file existence.
Definition: network_config.cpp:31
FMM::CONFIG::NetworkConfig::load_from_arg
static NetworkConfig load_from_arg(const cxxopts::ParseResult &arg_data)
Load NetworkConfig from argument parsed data.
Definition: network_config.cpp:22
FMM::CONFIG::NetworkConfig::load_from_xml
static NetworkConfig load_from_xml(const boost::property_tree::ptree &xml_data)
Load NetworkConfig from xml data.
Definition: network_config.cpp:13
FMM::CONFIG::NetworkConfig::source
std::string source
source field/column name
Definition: network_config.hpp:26
FMM::UTIL::file_exists
bool file_exists(const char *filename)
Check if file exist or not.
Definition: util.cpp:61