Skip to content
Yaml_Conf.h 1010 B
Newer Older
Valerio Pastore's avatar
Valerio Pastore committed
#pragma once

#include <Base_Configurator.h>
#include <yaml-cpp/yaml.h>
#include <unordered_map>

namespace inaf::oasbo::Configurators {

Valerio Pastore's avatar
Valerio Pastore committed
/**
 * @brief The YamlConfigurator class is a subclass of BaseConfigurator that provides functionality for reading and writing YAML configuration files.
 * It inherits from the BaseConfigurator class. Check Base_Configurator.h for more information.
 */
Valerio Pastore's avatar
Valerio Pastore committed
class YamlConfigurator: public BaseConfigurator {
protected:
	YAML::Node file;
	void load(std::string path);

public:
	std::string path;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Constructs a YamlConfigurator object with the specified path to the YAML configuration file.
	 * @param path The path to the YAML configuration file.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	YamlConfigurator(std::string path);

	int readConfigFromSource() override;
Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
	int readConfigFromSource(std::string target) override;
Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
	int pushConfigToSource() override;
Valerio Pastore's avatar
.  
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
	int pushConfigToSource(std::string target) override;

Valerio Pastore's avatar
Valerio Pastore committed
	int insert(std::map<std::string, std::string>, std::string target) override;
Valerio Pastore's avatar
Valerio Pastore committed
};
Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
}