[installation] Change to nightly

This commit is contained in:
2025-10-30 12:04:59 +01:00
parent 2ff097f9d1
commit a31bc45cce
1441 changed files with 60368 additions and 56360 deletions

View File

@ -18,8 +18,8 @@
***************************************************************************/
#ifndef __SEISCOMP_CONFIG_H__
#define __SEISCOMP_CONFIG_H__
#ifndef SEISCOMP_CONFIG_H
#define SEISCOMP_CONFIG_H
#include <iostream>
@ -34,13 +34,15 @@
#include <seiscomp/config/exceptions.h>
#include <seiscomp/config/symboltable.h>
namespace Seiscomp {
namespace Config {
/**
* Mapping of configuration variable to type
*/
typedef std::map<std::string, std::string> Variables;
using Variables = std::map<std::string, std::string>;
/**
@ -61,21 +63,13 @@ class SC_CONFIG_API Config {
// Public interface
// ------------------------------------------------------------------------
public:
/** When names are queried and this check is enabled, it will
* throw an exception if the same name is defined in a later stage
* with respect to case insensitive name comparison.
* This allows to check for parameter inconsistencies that are
* hard to track otherwise.
*/
void setCaseSensitivityCheck(bool);
/** Reads the given configuration file.
* @param file name of the configuration files
* @param stage Optional stage value to be set to each read symbol
* @param raw Raw mode which does not resolv references like ${var}
* @return true on success
*/
bool readConfig(const std::string& file, int stage=-1, bool raw=false);
bool readConfig(const std::string &file, int stage=-1, bool raw = false);
/** Writes the configuration to the given configuration file.
* @param file name of the configuarion files
@ -83,7 +77,7 @@ class SC_CONFIG_API Config {
* new entries
* @return true on success
*/
bool writeConfig(const std::string& file, bool localOny = true,
bool writeConfig(const std::string &file, bool localOny = true,
bool multilineLists = false);
/** Writes the configuration to the file which was given to
@ -110,70 +104,108 @@ class SC_CONFIG_API Config {
//! Gets an integer from the configuration file
//! @param name name of the element
//! @return value
int getInt(const std::string& name) const;
int getInt(const std::string& name, bool* error) const;
bool getInt(int& value, const std::string& name) const;
int getInt(const std::string &name) const;
int getInt(const std::string &name, bool *error) const;
bool getInt(int &value, const std::string &name) const;
bool setInt(const std::string& name, int value);
bool setInt(const std::string &name, int value);
/** Gets a double from the configuration file
* @param name name of the element
* @return double
*/
double getDouble(const std::string& name) const;
double getDouble(const std::string& name, bool* error) const;
bool getDouble(double& value, const std::string& name) const;
double getDouble(const std::string &name) const;
double getDouble(const std::string &name, bool *error) const;
bool getDouble(double& value, const std::string &name) const;
bool setDouble(const std::string& name, double value);
bool setDouble(const std::string &name, double value);
/** Gets an boolean from the configuration file
* @param name name of the element
* @return boolean
*/
bool getBool(const std::string& name) const;
bool getBool(const std::string& name, bool* error) const;
bool getBool(bool& value, const std::string& name) const;
bool getBool(const std::string &name) const;
bool getBool(const std::string &name, bool *error) const;
bool getBool(bool &value, const std::string &name) const;
bool setBool(const std::string& name, bool value);
bool setBool(const std::string &name, bool value);
/** Gets a string from the configuration file
* @param name name of the element
* @return string
*/
std::string getString(const std::string& name) const;
std::string getString(const std::string& name, bool* error) const;
bool getString(std::string& value, const std::string& name) const;
std::string getString(const std::string &name) const;
std::string getString(const std::string &name, bool *error) const;
bool getString(std::string &value, const std::string &name) const;
bool setString(const std::string& name, const std::string& value);
bool setString(const std::string &name, const std::string &value);
/** Removes the symbol with the given name from the symboltable.
* @param name Symbol to be removed
*/
bool remove(const std::string& name);
bool remove(const std::string &name);
std::vector<int> getInts(const std::string& name) const;
std::vector<int> getInts(const std::string &name) const;
std::vector<int> getInts(const std::string& name, bool* error) const;
std::vector<int> getInts(const std::string &name, bool *error) const;
bool setInts(const std::string& name, const std::vector<int>& values);
bool setInts(const std::string &name, const std::vector<int> &values);
std::vector<double> getDoubles(const std::string& name) const;
std::vector<double> getDoubles(const std::string &name) const;
std::vector<double> getDoubles(const std::string& name, bool* error) const;
std::vector<double> getDoubles(const std::string &name, bool *error) const;
bool setDoubles(const std::string& name, const std::vector<double>& values);
bool setDoubles(const std::string &name, const std::vector<double> &values);
std::vector<bool> getBools(const std::string& name) const;
std::vector<bool> getBools(const std::string &name) const;
std::vector<bool> getBools(const std::string& name, bool* error) const;
std::vector<bool> getBools(const std::string &name, bool *error) const;
bool setBools(const std::string& name, const std::vector<bool>& values);
bool setBools(const std::string &name, const std::vector<bool> &values);
std::vector<std::string> getStrings(const std::string& name) const;
std::vector<std::string> getStrings(const std::string& name, bool* error) const;
bool getStrings(std::vector<std::string>& value, const std::string& name) const;
std::vector<std::string> getStrings(const std::string &name) const;
std::vector<std::string> getStrings(const std::string &name, bool *error) const;
bool getStrings(std::vector<std::string> &value, const std::string &name) const;
bool setStrings(const std::string& name, const std::vector<std::string>& values);
bool setStrings(const std::string &name, const std::vector<std::string> &values);
/**
* @brief Returns a list of symbols with a name that starts with a
* given prefix.
* Alternatively a name of a symbol can be given. That symbol name must
* exist under the checked candidate. Example of configuration:
*
* @code
* profiles.A.enabled = false
* profiles.A.name = "Profile A"
* profiles.B.enabled = true
* profiles.B.name = "Profile B"
* profiles.C.name = "Profile C"
* @endcode
*
* @code
* auto symbols = cfg.findSymbols("profiles.", "enabled");
* assert(symbols.size() == 1)
* assert(symbols[0] == "profiles.B")
*
* symbols = cfg.findSymbols("profiles.");
* assert(symbols.size() == 3)
* assert(symbols[0] == "profiles.A")
* assert(symbols[1] == "profiles.B")
* assert(symbols[2] == "profiles.C")
* @endcode
*
* @param prefix The prefix of the returned symbol name
* @param enabledSymbol If not empty then a symbol is evaluated which
* holds a true boolean value. The name of the
* symbol is composed of the checked symbol name
* and this parameters joined with a dot.
* @return enabledDefault Default value for the enableSymbol.
* @return The list of matching symbols.
*/
std::vector<std::string> findSymbols(const std::string &prefix,
const std::string &enabledSymbol = {},
bool enabledDefault = true) const;
SymbolTable *symbolTable() const;
@ -268,17 +300,17 @@ class SC_CONFIG_API Config {
// ------------------------------------------------------------------------
private:
void init();
bool handleEntry(const std::string& entry, const std::string& comment);
bool handleInclude(const std::string& fileName);
void handleAssignment(const std::string& name, const std::string& content,
std::vector<std::string>& values,
const std::string& comment);
bool handleEntry(const std::string &entry, const std::string &comment);
bool handleInclude(const std::string &fileName);
void handleAssignment(const std::string &name, const std::string &content,
std::vector<std::string> &values,
const std::string &comment);
std::vector<std::string> tokenize(const std::string& entry);
static bool reference(const std::string &name,
std::vector<std::string> &value,
const SymbolTable *symtab);
static bool parseRValue(const std::string& entry,
std::vector<std::string>& parsedValues,
static bool parseRValue(const std::string &entry,
std::vector<std::string> &parsedValues,
const SymbolTable *symtab,
bool resolveReferences,
bool rawMode,
@ -289,34 +321,34 @@ class SC_CONFIG_API Config {
int stage = -1, bool raw = false);
template <typename T>
T get(const std::string& name) const;
T get(const std::string &name) const;
template <typename T>
T get(const std::string& name, bool* error) const;
T get(const std::string &name, bool *error) const;
template <typename T>
bool get(T& value, const std::string& name) const;
bool get(T &value, const std::string &name) const;
template <typename T>
std::vector<T> getVec(const std::string& name) const;
std::vector<T> getVec(const std::string &name) const;
template <typename T>
std::vector<T> getVec(const std::string& name, bool* error) const;
std::vector<T> getVec(const std::string &name, bool *error) const;
template <typename T>
void add(const std::string& name, const T& value);
void add(const std::string &name, const T &value);
template <typename T>
void add(const std::string& name, const std::vector<T>& values);
void add(const std::string &name, const std::vector<T> &values);
/** Sets an value in the configuration file
* @param element name of the element
* @param value value for the element */
template <typename T>
bool set(const std::string& name, const T& value);
bool set(const std::string &name, const T &value);
template <typename T>
bool set(const std::string& name, const std::vector<T>& values);
bool set(const std::string &name, const std::vector<T> &values);
inline void addVariable(const std::string &name, const char *type) const;
@ -327,7 +359,8 @@ class SC_CONFIG_API Config {
// Private data members
// ------------------------------------------------------------------------
private:
typedef std::deque<std::string> Namespaces;
using Namespaces = std::deque<std::string>;
int _stage;
int _line;
bool _resolveReferences;
@ -346,4 +379,5 @@ class SC_CONFIG_API Config {
} // namespace Config
} // namespace Seiscomp
#endif

View File

@ -38,7 +38,7 @@ class SC_CONFIG_API Exception : public std::exception {
Exception(const char *str) : _what(str) {}
virtual ~Exception() throw() {}
const char *what() const throw() { return _what.c_str(); }
const char *what() const throw() override { return _what.c_str(); }
private:
std::string _what;

View File

@ -23,6 +23,7 @@
#include <seiscomp/config/api.h>
#include <fmt/printf.h>
#include <cstdio>
@ -44,13 +45,10 @@ struct SC_CONFIG_API Logger {
};
extern char log_msg_buffer[1024];
#define CONFIG_LOG_CHANNEL(chan, msg, ...) \
if ( _logger ) {\
snprintf(log_msg_buffer, 1023, msg, __VA_ARGS__);\
_logger->log(chan, _fileName.c_str(), _line, log_msg_buffer);\
auto line = fmt::sprintf(msg, __VA_ARGS__);\
_logger->log(chan, _fileName.c_str(), _line, line.c_str());\
}

View File

@ -17,9 +17,11 @@
* gempa GmbH. *
***************************************************************************/
#ifndef __SEISCOMP_CONFIG_SYMBOLTABLE__
#define __SEISCOMP_CONFIG_SYMBOLTABLE__
#include <string>
#include <vector>
#include <map>
@ -28,6 +30,7 @@
#include <seiscomp/config/log.h>
namespace Seiscomp {
namespace Config {
@ -65,23 +68,22 @@ struct SC_CONFIG_API Symbol {
class SC_CONFIG_API SymbolTable {
private:
typedef std::map<std::string, Symbol> Symbols;
typedef std::vector<Symbol*> SymbolOrder;
typedef std::map<std::string, Symbols::iterator> CISymbols;
public:
typedef SymbolOrder::const_iterator iterator;
typedef std::set<std::string> IncludedFiles;
typedef IncludedFiles::iterator file_iterator;
public:
SymbolTable();
using Symbols = std::map<std::string, Symbol>;
using SymbolOrder = std::vector<Symbol*>;
public:
using iterator = SymbolOrder::const_iterator;
using IncludedFiles = std::set<std::string>;
using file_iterator = IncludedFiles::iterator;
public:
SymbolTable() = default;
public:
void setCaseSensitivityCheck(bool);
void setLogger(Logger *);
Logger *logger();
@ -114,22 +116,18 @@ class SC_CONFIG_API SymbolTable {
iterator begin();
iterator end();
private:
//! Returns true if an inconsistent definition has been found
bool checkCI(const std::string &name, const Symbol *) const;
private:
bool _csCheck;
Symbols _symbols;
CISymbols _cisymbols;
SymbolOrder _symbolOrder;
IncludedFiles _includedFiles;
int _objectCount;
Logger *_logger;
Symbols _symbols;
SymbolOrder _symbolOrder;
IncludedFiles _includedFiles;
int _objectCount{0};
Logger *_logger{nullptr};
};
} // namespace Config
} // namespace Seiscomp
#endif