diff --git a/CMakeLists.txt b/CMakeLists.txt index ab34fdf..f3caa2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/entropy_src.h b/entropy_src.h new file mode 100644 index 0000000..cdfe3ee --- /dev/null +++ b/entropy_src.h @@ -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 diff --git a/event_scheduler.h b/event_scheduler.h new file mode 100644 index 0000000..35a8743 --- /dev/null +++ b/event_scheduler.h @@ -0,0 +1,22 @@ +#ifndef FORTUNA_EVENT_SCHEDULER_H +#define FORTUNA_EVENT_SCHEDULER_H + +#include + +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 +