cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Caller.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2023-2024 Laurent Forthomme
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef CepGen_Utils_Caller_h
20#define CepGen_Utils_Caller_h
21
22#include <iosfwd>
23#include <string>
24#include <vector>
25
26namespace cepgen {
27 namespace utils {
29 class Caller {
30 public:
31 Caller();
32 ~Caller();
35 static std::string call(const std::vector<std::string>& commands);
38 static std::string call(const std::string& command);
39
40 std::string output() const;
41 std::string error() const;
42
43 private:
44 std::stringstream os_cout_, os_cerr_;
45 std::streambuf *oldcout_{nullptr}, *oldcerr_{nullptr};
46 };
47 } // namespace utils
48} // namespace cepgen
49
50#endif
External command piping utility.
Definition Caller.h:29
static std::string call(const std::vector< std::string > &commands)
Start a logged call command.
Definition Caller.cpp:45
std::string output() const
Retrieve the (potential) output from the command.
Definition Caller.cpp:41
std::string error() const
Retrieve the (potential) error stream from the command.
Definition Caller.cpp:43
Common namespace for this Monte Carlo generator.