cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Filesystem.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2013-2024 Laurent Forthomme
4 * 2023 Dmitri Konstantinov
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CepGen_Utils_Filesystem_h
21#define CepGen_Utils_Filesystem_h
22
23#if defined(__has_include)
24#if __has_include(<filesystem>)
25#include <filesystem>
26namespace fs = std::filesystem;
27#elif __has_include(<experimental/filesystem>)
28#include <experimental/filesystem>
29namespace fs = std::experimental::filesystem;
30#else
31#error "*** no support for filesystem! ***"
32#endif
33#else
34#error "*** no support for __has_include! ***"
35#endif
36
37#include <string>
38
39namespace cepgen {
40 namespace utils {
41 bool fileExists(const std::string&);
42 std::string fileExtension(const std::string& file);
43 std::string readFile(const std::string&);
44
45 } //namespace utils
46} // namespace cepgen
47
48#endif
std::string readFile(const std::string &filename)
Read the content of a file into a string buffer.
bool fileExists(const std::string &path)
Check if the file exists.
std::string fileExtension(const std::string &file)
Small utility to retrieve the extension of a filename.
Common namespace for this Monte Carlo generator.