Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
DownloadSubLogger.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_LOGS_DOWNLOADSUBLOGGER_HPP_
2#define IV_SRC_LOGS_DOWNLOADSUBLOGGER_HPP_
3
6
7#include <atomic>
8#include <memory>
9#include <mutex>
10
11namespace iv::logs
12{
13
15{
16public:
17 DownloadSubLogger(const std::shared_ptr<std::atomic_bool> &isCancelled,
18 const std::shared_ptr<iv::logs::DownloadLoggerInfo> &logsContext,
19 const std::shared_ptr<std::atomic_bool> &requiresUpdate,
20 const std::shared_ptr<std::mutex> &mutex);
21
22 void addLog(std::string_view logTitle, std::string_view logMessage, iv::logs::eDownloadLogState logState) override;
23 std::shared_ptr<iv::logs::IDownloadLogger> addSubLog(std::string_view logTitle, std::string_view logMessage,
24 iv::logs::eDownloadLogState logState) override;
25
26 void start() override;
27 void end() override;
28 [[nodiscard]] bool isCancelled() const override;
29
30private:
31 DownloadSubLogger() = default;
32
33 std::shared_ptr<std::atomic_bool> m_isCancelled;// Flag to indicate if the download has been cancelled
34
35 std::shared_ptr<iv::logs::DownloadLoggerInfo> m_logerInfo;// Root log context
36 std::shared_ptr<std::atomic_bool> m_requiresUpdate; // Flag to indicate if the tree needs to be updated
37
38 std::shared_ptr<std::mutex> m_mutex;
39};
40
41}// namespace iv::logs
42
43#endif//IV_SRC_LOGS_DOWNLOADSUBLOGGER_HPP_
Definition DownloadSubLogger.hpp:15
void start() override
Definition DownloadSubLogger.cpp:42
void addLog(std::string_view logTitle, std::string_view logMessage, iv::logs::eDownloadLogState logState) override
Definition DownloadSubLogger.cpp:18
std::shared_ptr< std::mutex > m_mutex
Definition DownloadSubLogger.hpp:38
bool isCancelled() const override
Definition DownloadSubLogger.cpp:52
std::shared_ptr< iv::logs::DownloadLoggerInfo > m_logerInfo
Definition DownloadSubLogger.hpp:35
std::shared_ptr< std::atomic_bool > m_isCancelled
Definition DownloadSubLogger.hpp:33
void end() override
Definition DownloadSubLogger.cpp:47
std::shared_ptr< iv::logs::IDownloadLogger > addSubLog(std::string_view logTitle, std::string_view logMessage, iv::logs::eDownloadLogState logState) override
Definition DownloadSubLogger.cpp:26
std::shared_ptr< std::atomic_bool > m_requiresUpdate
Definition DownloadSubLogger.hpp:36
Definition IDownloadLogger.hpp:14
Definition DownloadLogger.cpp:19
eDownloadLogState
Definition enums.hpp:8