diff --git a/modules/task/include/task.hpp b/modules/task/include/task.hpp index 4ad82607..4a86d8ae 100644 --- a/modules/task/include/task.hpp +++ b/modules/task/include/task.hpp @@ -310,16 +310,16 @@ class Task { /// @tparam InType Input data type. /// @tparam OutType Output data type. template -using TaskPtr = std::shared_ptr>; +using TaskPtr = std::unique_ptr>; -/// @brief Constructs and returns a shared pointer to a task with the given input. +/// @brief Constructs and returns a pointer to a task with the given input. /// @tparam TaskType Type of the task to create. /// @tparam InType Type of the input. /// @param in Input to pass to the task constructor. -/// @return Shared a pointer to the newly created task. +/// @return Unique pointer to the newly created task. template -std::shared_ptr TaskGetter(const InType &in) { - return std::make_shared(in); +std::unique_ptr TaskGetter(const InType &in) { + return std::make_unique(in); } } // namespace ppc::task diff --git a/modules/task/tests/task_tests.cpp b/modules/task/tests/task_tests.cpp index 4589a152..de15abca 100644 --- a/modules/task/tests/task_tests.cpp +++ b/modules/task/tests/task_tests.cpp @@ -399,23 +399,23 @@ TEST(TaskTest, GetDynamicTypeReturnsCorrectEnum) { } TEST(TaskTest, ValidationThrowsIfCalledTwice) { - auto task = std::make_shared(); + auto task = std::make_unique(); task->Validation(); EXPECT_THROW(task->Validation(), std::runtime_error); } TEST(TaskTest, PreProcessingThrowsIfCalledBeforeValidation) { - auto task = std::make_shared(); + auto task = std::make_unique(); EXPECT_THROW(task->PreProcessing(), std::runtime_error); } TEST(TaskTest, RunThrowsIfCalledBeforePreProcessing) { - auto task = std::make_shared(); + auto task = std::make_unique(); EXPECT_THROW(task->Run(), std::runtime_error); } TEST(TaskTest, PostProcessingThrowsIfCalledBeforeRun) { - auto task = std::make_shared(); + auto task = std::make_unique(); task->Validation(); task->PreProcessing(); EXPECT_THROW(task->PostProcessing(), std::runtime_error);