// SPDX-License-Identifier: Apache-2.0 // Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest #ifndef NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP #define NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP #include #include #include #include #include #include #include #include class NamedPipeDataSource { public: NamedPipeDataSource(); explicit NamedPipeDataSource(const std::string& filename); NamedPipeDataSource(const NamedPipeDataSource&) = delete; NamedPipeDataSource(const NamedPipeDataSource&&) = delete; NamedPipeDataSource operator=(const NamedPipeDataSource&) = delete; NamedPipeDataSource operator=(const NamedPipeDataSource&&) = delete; ~NamedPipeDataSource(); void setDetectionCallback(const std::function>&)>&); void setErrorLogCallback(const std::function&); void run(); private: void getLinesForever(); std::optional>> parseInput(const std::string& input); std::string m_filename; std::function>&)> m_callback; std::function m_err_callback; std::unique_ptr m_line_reader; std::atomic stopped{false}; }; #endif // NAMED_PIPE_TOKEN_PROVIDER_IMPL_HPP