src/core/config/ConfigReader.hpp
Provides a reader for configuration files. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::ConfigReader Reader of configuration files. |
Detailed Description
Provides a reader for configuration files.
Copyright: Copyright (c) 2017-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT
Source code
#ifndef ALLPIX_CONFIG_READER_H
#define ALLPIX_CONFIG_READER_H
#include <filesystem>
#include <istream>
#include <list>
#include <map>
#include <string>
#include <vector>
#include "Configuration.hpp"
namespace allpix {
class ConfigReader {
public:
ConfigReader();
explicit ConfigReader(std::istream& stream, std::filesystem::path file_name = "");
static std::pair<std::string, std::string> parseKeyValue(std::string line);
void add(std::istream&, std::filesystem::path file_name = "");
void addConfiguration(Configuration config);
ConfigReader(const ConfigReader&);
ConfigReader& operator=(const ConfigReader&);
ConfigReader(ConfigReader&&) noexcept = default;
ConfigReader& operator=(ConfigReader&&) noexcept = default;
void clear();
bool hasConfiguration(std::string name) const;
unsigned int countConfigurations(std::string name) const;
Configuration getHeaderConfiguration() const;
std::vector<Configuration> getConfigurations(std::string name) const;
std::vector<Configuration> getConfigurations() const;
private:
void copy_init_map();
std::map<std::string, std::vector<std::list<Configuration>::iterator>> conf_map_;
std::list<Configuration> conf_array_;
};
} // namespace allpix
#endif /* ALLPIX_CONFIG_MANAGER_H */
Updated on 2024-12-13 at 08:31:37 +0000