From f5cc4ae84d94eb9ca40c3489b08f07577908ef8c Mon Sep 17 00:00:00 2001 From: jr0me Date: Wed, 17 Jul 2024 02:51:11 -0300 Subject: [PATCH] feat: add ITaskManager abstract base class This class should be the starting point for a class whose responsibility is going to be dealing with creating all the Agent related tasks. We aim at supporting both multithreading and coroutines as our concurrency model, but we allow to swap coroutines implementations by templating the awaitable type. Given the current status of the repository this will be momentarily in the agent folder, but it would be wise to move it to a separate cmake directory to hide the boost dependency for the implementation here provided. --- src/agent/CMakeLists.txt | 1 + src/agent/include/itask_manager.hpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/agent/include/itask_manager.hpp diff --git a/src/agent/CMakeLists.txt b/src/agent/CMakeLists.txt index f0dae4455d..7e5c7330fc 100644 --- a/src/agent/CMakeLists.txt +++ b/src/agent/CMakeLists.txt @@ -17,6 +17,7 @@ set(SOURCES set(HEADERS include/agent.hpp + include/itask_manager.hpp ) add_library(agent ${SOURCES} ${HEADERS}) diff --git a/src/agent/include/itask_manager.hpp b/src/agent/include/itask_manager.hpp new file mode 100644 index 0000000000..c313376685 --- /dev/null +++ b/src/agent/include/itask_manager.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +template +class ITaskManager +{ +public: + virtual ~ITaskManager() = default; + + virtual void start(size_t numThreads) = 0; + virtual void stop() = 0; + + virtual void enqueueTask(std::function task) = 0; + virtual void enqueueTask(CoroutineTaskType task) = 0; +};