Belle II Software development
EnvironmentVariables.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <string>
11#include <vector>
12
13namespace Belle2 {
20 public:
22 static bool isSet(const std::string& name);
23
25 static std::string get(const std::string& name, const std::string& fallback = "");
26
34 static std::vector<std::string> getList(const std::string& name, const std::vector<std::string>& fallback = {},
35 const std::string& separators = " \t\n\r");
36
48 static std::vector<std::string> getOrCreateList(const std::string& name, const std::string& fallback,
49 const std::string& separators = " \t\n\r");
50
55 static std::string expand(const std::string& text);
56 };
58};
Utility functions related to environment variables.
static std::string get(const std::string &name, const std::string &fallback="")
Get the value of an environment variable or the given fallback value if the variable is not set.
static bool isSet(const std::string &name)
Check if a value is set in the database.
static std::vector< std::string > getList(const std::string &name, const std::vector< std::string > &fallback={}, const std::string &separators=" \t\n\r")
Get a list of values from an environment variable or the given fallback list if the variable is not s...
static std::vector< std::string > getOrCreateList(const std::string &name, const std::string &fallback, const std::string &separators=" \t\n\r")
Get a list of values from an environment variable or the given fallback string if the variable is not...
static std::string expand(const std::string &text)
Modify the given string and replace every occurence of $NAME or ${NAME} with the value of the environ...
Abstract base class for different kinds of events.