25#ifndef SIM_TO_DUT_INTERFACE_SYSTEMCONFIG_H
26#define SIM_TO_DUT_INTERFACE_SYSTEMCONFIG_H
28#include <boost/archive/xml_oarchive.hpp>
29#include <boost/archive/xml_iarchive.hpp>
31#include "Interface_Logger/InterfaceLogger.h"
74 std::ofstream ofs(file);
75 boost::archive::xml_oarchive oa(ofs);
76 oa << BOOST_SERIALIZATION_NVP(systemConfig);
77 std::cout <<
"Successfully saved system config to <" << file <<
">" << std::endl;
79 std::cout <<
"Save system config failed." << std::endl;
93 std::ifstream ifs(file);
94 boost::archive::xml_iarchive ia(ifs);
95 ia >> BOOST_SERIALIZATION_NVP(systemConfig);
96 std::cout <<
"Successfully loaded system config from <" << file <<
">" << std::endl;
98 std::cout <<
"Load system config failed. Fallback to default values." << std::endl;
99 if (createNewIfNotFoundOrInvalid) {
106 friend class boost::serialization::access;
108 template<
class Archive>
109 void serialize(Archive &ar,
const unsigned int version) {
The logger needs a configuration before it can start logging.
Definition: InterfaceLoggerConfig.h:50
Contains the config for the SimComHandler, the SimToDuTInterface and the Logger.
Definition: SystemConfig.h:40
LoggerConfig loggerConfig
Definition: SystemConfig.h:50
std::string socketSimAddressPub
Definition: SystemConfig.h:58
std::string socketSimAddressSub
Definition: SystemConfig.h:54
static void loadFromFile(const std::string &file, SystemConfig &systemConfig, bool createNewIfNotFoundOrInvalid)
Definition: SystemConfig.h:91
static void saveToFile(const std::string &file, SystemConfig &systemConfig)
Definition: SystemConfig.h:72
std::string socketSimAddressReciverConfig
Definition: SystemConfig.h:64
void serialize(Archive &ar, sim_interface::dut_connector::ConnectorConfig &config, const unsigned int version)
Definition: ConfigSerializer.h:146
Definition: CANConnector.cpp:29