Debian Codegraph @

src/core/info/common/gpuinfoueventdatasource.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/info/common/gpuinfoueventdatasource.h`/
2 // Copyright 2021 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "common/fileutils.h"cxx . . $ `<file>/src/common/fileutils.h`/
7 #include "core/idatasource.h"cxx . . $ `<file>/src/core/idatasource.h`/
8 #include <filesystem>
9 #include <spdlog/spdlog.h>
10 #include <string>
11 #include <utility>
12 #include <vector>
13
14 class GPUInfoUeventDataSourcecxx . . $ GPUInfoUeventDataSource#
15 : public IDataSourcecxx . . $ IDataSource#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#>, stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const>
16 {
17 public:
18 stdcxx . . $ std/::stringcxx . . $ std/string# sourcecxx . . $ GPUInfoUeventDataSource#source(219584694fe2b248).() const override
19 {
20 return "uevent"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
21 }
22
23 bool readcxx . . $ GPUInfoUeventDataSource#read(b14c1b4ec0a23c2b).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> &data,
24 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) override
25 {
26 auto const filePath = path /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). sourcecxx . . $ std/filesystem/__cxx11/path#path(2f6c7066048c5333).();
27 auto lines = Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::readFileLinescxx . . $ Utils/File/readFileLines(951e54d16e2206f).(filePath);
28 if (!lines.emptycxx . . $ std/vector#empty(3482b152b9333168).()) {
29 stdcxx . . $ std/::swapcxx . . $ std/swap(90aec5ea4c4ede5e).(data, lines);
30 return true;
31 }
32
33 SPDLOG_WARNcxx . . $ fmt/v10/basic_format_string#basic_format_string(edcd8b2679e9bd1a).("Cannot retrieve device information from {}", filePath.c_str());
34 return false;
35 }
36 };