blob: e6615d7873b96316445499289e935c2d2118e354 [file] [log] [blame]
Ruben Rodriguez Buchillon5cd4a9c2017-04-26 13:03:04 -07001// Copyright 2017 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef THD_SOURCE_FILE_SOURCE_H_
6#define THD_SOURCE_FILE_SOURCE_H_
7
8#include "thd/source/source.h"
9
10#include <cstdint>
11
12#include <base/files/file_path.h>
13#include <base/macros.h>
14
15namespace thd {
16
17// Source to read files.
18//
19// Assumes that the file only contains one integer value.
20class FileSource : public Source {
21 public:
22 explicit FileSource(const base::FilePath& file_path);
Qijiang Fan6bc59e12020-11-11 02:51:06 +090023 FileSource(const FileSource&) = delete;
24 FileSource& operator=(const FileSource&) = delete;
25
Ruben Rodriguez Buchillon5cd4a9c2017-04-26 13:03:04 -070026 ~FileSource() override;
27
28 // Source:
29 bool ReadValue(int64_t* value_out) override;
30
31 private:
32 const base::FilePath file_path_;
Ruben Rodriguez Buchillon5cd4a9c2017-04-26 13:03:04 -070033};
34
35} // namespace thd
36
37#endif // THD_SOURCE_FILE_SOURCE_H_