Project
Loading...
Searching...
No Matches
LHCIFfileReader.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13#include <fstream>
14
15namespace o2
16{
17namespace grp
18{
19
20void LHCIFfileReader::loadLHCIFfile(const std::string& fileName)
21{
22 // load the LHC IF file into a string
23 if (o2::utils::Str::pathExists(fileName)) {
24 std::string expandedFileName = o2::utils::Str::getFullPath(fileName);
25 std::ifstream ifs(expandedFileName.c_str());
26 if (ifs) {
27 ifs.seekg(0, std::ios::end);
28 const auto size = ifs.tellg();
29 mFileBuffStr.resize(size);
30 ifs.seekg(0);
31 ifs.read(&mFileBuffStr[0], size);
32 ifs.close();
33 }
34 } else {
35 LOG(error) << "File " << fileName << " does not exist!";
36 }
37}
38
39//_________________________________________________________________
40
41void LHCIFfileReader::loadLHCIFfile(gsl::span<const char> configBuf)
42{
43 // load the LHC IF file into a string from a buffer
44 mFileBuffStr.assign(configBuf.data());
45}
46
47//_________________________________________________________________
48
49} // end namespace grp
50} // end namespace o2
void loadLHCIFfile(const std::string &fileName)
GLsizeiptr size
Definition glcorearb.h:659
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static bool pathExists(const std::string_view p)
static std::string getFullPath(const std::string_view p)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"