Ruben Rodriguez Buchillon | 5cd4a9c | 2017-04-26 13:03:04 -0700 | [diff] [blame] | 1 | // 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 | |
| 15 | namespace thd { |
| 16 | |
| 17 | // Source to read files. |
| 18 | // |
| 19 | // Assumes that the file only contains one integer value. |
| 20 | class FileSource : public Source { |
| 21 | public: |
| 22 | explicit FileSource(const base::FilePath& file_path); |
Qijiang Fan | 6bc59e1 | 2020-11-11 02:51:06 +0900 | [diff] [blame] | 23 | FileSource(const FileSource&) = delete; |
| 24 | FileSource& operator=(const FileSource&) = delete; |
| 25 | |
Ruben Rodriguez Buchillon | 5cd4a9c | 2017-04-26 13:03:04 -0700 | [diff] [blame] | 26 | ~FileSource() override; |
| 27 | |
| 28 | // Source: |
| 29 | bool ReadValue(int64_t* value_out) override; |
| 30 | |
| 31 | private: |
| 32 | const base::FilePath file_path_; |
Ruben Rodriguez Buchillon | 5cd4a9c | 2017-04-26 13:03:04 -0700 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | } // namespace thd |
| 36 | |
| 37 | #endif // THD_SOURCE_FILE_SOURCE_H_ |