accumulator: add event_scheduler,entropy_src ifces
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2021-12-11 02:12:49 +01:00
parent 2fbf5464a0
commit a5b988ba71
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 45 additions and 1 deletions

View File

@ -183,7 +183,7 @@ add_subdirectory(lib/fmt EXCLUDE_FROM_ALL)
endif(NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-fuse-ld=lld")
endif()
add_executable(fortuna main.cpp generator.cpp generator.h fortuna.cpp fortuna.h accumulator.cpp accumulator.h pool.cpp pool.h event_adder.h event_adder_impl.h)
add_executable(fortuna main.cpp generator.cpp generator.h fortuna.cpp fortuna.h accumulator.cpp accumulator.h pool.cpp pool.h event_adder.h event_adder_impl.h event_scheduler.h entropy_src.h)
# ref: https://cmake.org/pipermail/cmake/2016-May/063400.html
target_link_libraries(fortuna
PRIVATE cryptopp

22
entropy_src.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef FORTUNA_ENTROPY_SRC_H
#define FORTUNA_ENTROPY_SRC_H
#include "event_adder_impl.h"
#include "event_scheduler.h"
namespace fortuna {
namespace accumulator {
class EntropySrc {
public:
virtual void schedule(accumulator::EventScheduler scheduler) = 0;
virtual void event(accumulator::EventAdderImpl adder) = 0;
EntropySrc(const EntropySrc&) = delete;
EntropySrc& operator=(const EntropySrc&) = delete;
~EntropySrc() noexcept;
};
} //namespace accumulator
} //namespace fortuna
#endif//FORTUNA_ENTROPY_SRC_H

22
event_scheduler.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef FORTUNA_EVENT_SCHEDULER_H
#define FORTUNA_EVENT_SCHEDULER_H
#include <chrono>
namespace fortuna {
namespace accumulator {
class EventScheduler {
public:
virtual void schedule(std::chrono::milliseconds delay_ms) = 0;
EventScheduler(const EventScheduler&) = delete;
EventScheduler& operator=(const EventScheduler&) = delete;
~EventScheduler() noexcept;
};
} //namespace accumulator
} //namespace fortuna
#endif//FORTUNA_EVENT_SCHEDULER_H