| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <string> |
| 7 | |
| 8 | /// Interface of a data source. |
| 9 | /// A data source only provides data. |
| 10 | template<typename... Ts> |
| 11 | class IDataSource |
| 12 | { |
| 13 | public: |
| 14 | /// Where the data comes from. |
| 15 | /// @returns source name |
| 16 | virtual std::string source() const = 0; |
| 17 | |
| 18 | /// Read the data from the source. The readed data is stored into |
| 19 | /// this function arguments. |
| 20 | /// @return true when the operation succeed |
| 21 | virtual bool read(Ts &...args) = 0; |
| 22 | |
| 23 | virtual ~IDataSource() = default; |
| 24 | }; |