Index: include/AdblockPlus/ITimer.h |
diff --git a/include/AdblockPlus/LogSystem.h b/include/AdblockPlus/ITimer.h |
similarity index 52% |
copy from include/AdblockPlus/LogSystem.h |
copy to include/AdblockPlus/ITimer.h |
index 6a71d5cfa98daf9390825e913143bf9f5b54f436..291e56f1626418daa7dacd9ddfd0a53611137fe5 100644 |
--- a/include/AdblockPlus/LogSystem.h |
+++ b/include/AdblockPlus/ITimer.h |
@@ -15,42 +15,38 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-#ifndef ADBLOCK_PLUS_LOG_SYSTEM_H |
-#define ADBLOCK_PLUS_LOG_SYSTEM_H |
+#ifndef ADBLOCK_PLUS_TIMER_H |
+#define ADBLOCK_PLUS_TIMER_H |
Oleksandr
2017/03/28 10:39:55
The diff in this file is weird. I assume your mere
sergei
2017/03/28 11:06:59
Yes, VCS is trying to be smarter and it detects it
|
-#include <string> |
+#include <functional> |
+#include <chrono> |
#include <memory> |
namespace AdblockPlus |
{ |
/** |
- * Logging interface. |
+ * Timer manager interface. |
*/ |
- class LogSystem |
+ struct ITimer |
{ |
- public: |
/** |
- * Log level. |
- */ |
- enum LogLevel {LOG_LEVEL_TRACE, LOG_LEVEL_LOG, LOG_LEVEL_INFO, LOG_LEVEL_WARN, LOG_LEVEL_ERROR}; |
- |
- virtual ~LogSystem() {} |
+ * Callback type invoked after elapsing of timer timeout. |
+ */ |
+ typedef std::function<void()> TimerCallback; |
+ virtual ~ITimer() {}; |
/** |
- * Writes a log message. |
- * @param logLevel Log level. |
- * @param message Log message. |
- * @param source Source of the message, e.g. file name and line. |
- * Ignored when empty. |
+ * Sets a timer. |
+ * @param timeout A timer callback will be called after that interval. |
+ * @param timeCallback The callback which is called after timeout. |
*/ |
- virtual void operator()(LogLevel logLevel, const std::string& message, |
- const std::string& source) = 0; |
+ virtual void SetTimer(const std::chrono::milliseconds& timeout, const TimerCallback& timerCallback) = 0; |
}; |
/** |
- * Shared smart pointer to a `LogSystem` instance. |
+ * Unique smart pointer to an instance of `ITimer` implementation. |
*/ |
- typedef std::shared_ptr<LogSystem> LogSystemPtr; |
+ typedef std::unique_ptr<ITimer> TimerPtr; |
} |
#endif |