cepgen is hosted by Hepforge, IPPP Durham
CepGen N/A
Central exclusive processes event generator
Caller.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2023-2025 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 <sstream>
24#include <string>
25#include <vector>
26
27namespace cepgen::utils {
29 class Caller {
30 public:
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 cepgen::utils
48
49#endif
External command piping utility.
Definition Caller.h:29
static std::string call(const std::vector< std::string > &commands)
Start a logged call command.
std::string output() const
Retrieve the (potential) output from the command.
static std::string call(const std::string &command)
Start a logged call command.
std::string error() const
Retrieve the (potential) error stream from the command.
Collection of utilities.