DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
okssystem
src
Environment.cpp
Go to the documentation of this file.
1
// DUNE DAQ modification notice:
2
// This file has been modified from the original ATLAS system source for the DUNE DAQ project.
3
// Fork baseline commit: system-00-00-20 (2020-09-25).
4
// Renamed since fork: yes (from src/Environment.cxx to src/Environment.cpp).
5
6
/*
7
* Environment.cxx
8
* ers
9
*
10
* Created by Matthias Wiesmann on 11.01.05.
11
* Copyright 2005 CERN. All rights reserved.
12
*
13
*/
14
15
#include <stdlib.h>
16
17
#include "
okssystem/Environment.hpp
"
18
#include "
okssystem/exceptions.hpp
"
19
20
using namespace
OksSystem
;
21
27
28
void
OksSystem::Environment::set
(
const
std::string &key,
const
std::string &value) {
29
const
char
* c_key = key.c_str();
30
const
char
* c_value = value.c_str();
31
const
int
status = ::setenv(c_key,c_value,1);
32
if
(status<0) {
33
std::string message =
"while setting "
+ key +
" to "
+ value;
34
throw
OksSystemCallIssue(
ERS_HERE
, errno,
"setenv"
, message.c_str());
35
}
36
}
// set
37
42
43
void
OksSystem::Environment::set
(
const
std::map<std::string,std::string> &values) {
44
for
(std::map<std::string,std::string>::const_iterator pos = values.begin();pos!=values.end();++pos) {
45
set
(pos->first,pos->second);
46
}
// for
47
}
// set
48
53
54
std::string
OksSystem::Environment::get
(
const
std::string &key) {
55
const
char
* c_value = ::getenv(key.c_str());
56
if
(c_value==0)
return
std::string();
57
return
std::string(c_value);
58
}
// get
59
Environment.hpp
ERS_HERE
#define ERS_HERE
Definition
LocalContext.hpp:141
OksSystem
Definition
Descriptor.hpp:22
OksSystem::Environment::get
static std::string get(const std::string &key)
get a environnement variable
Definition
Environment.cpp:54
OksSystem::Environment::set
static void set(const std::string &key, const std::string &value)
sets an environnement variable
Definition
Environment.cpp:28
exceptions.hpp
Generated on
for DUNE-DAQ by
1.17.0