Belle II Software  release-05-02-19
EnvironmentVariables.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <string>
13 #include <vector>
14 
15 namespace Belle2 {
21  class EnvironmentVariables {
22  public:
24  static bool isSet(const std::string& name);
25 
27  static std::string get(const std::string& name, const std::string& fallback = "");
28 
36  static std::vector<std::string> getList(const std::string& name, const std::vector<std::string>& fallback = {},
37  const std::string& separators = " \t\n\r");
38 
50  static std::vector<std::string> getOrCreateList(const std::string& name, const std::string& fallback,
51  const std::string& separators = " \t\n\r");
52 
57  static std::string expand(const std::string& text);
58  };
60 };
Belle2::EnvironmentVariables::getList
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...
Definition: EnvironmentVariables.cc:46
Belle2::EnvironmentVariables::getOrCreateList
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...
Definition: EnvironmentVariables.cc:58
Belle2::EnvironmentVariables::get
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.
Definition: EnvironmentVariables.cc:35
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EnvironmentVariables::isSet
static bool isSet(const std::string &name)
Check if a value is set in the database.
Definition: EnvironmentVariables.cc:29
Belle2::EnvironmentVariables::expand
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...
Definition: EnvironmentVariables.cc:70