19#ifndef HEDGEHOG_TASK_NODE_H_
20#define HEDGEHOG_TASK_NODE_H_
24#include "../api/memory_manager/manager/abstract_memory_manager.h"
25#include "../core/abstractions/base/node/task_node_abstraction.h"
37 std::shared_ptr<AbstractMemoryManager>
39 std::shared_ptr<hh::core::abstraction::TaskNodeAbstraction>
const
44 explicit TaskNode(std::shared_ptr<hh::core::abstraction::TaskNodeAbstraction>
core)
53 [[nodiscard]] std::shared_ptr<AbstractMemoryManager>
const &
memoryManager()
const {
return mm_; }
65 std::ostringstream oss;
66 oss <<
"For the node:\"" << this->
name()
67 <<
"\"in order to get managed memory, you need first to connect a memory manager to the task via "
68 "\"connectMemoryManager()\""
70 throw std::runtime_error(oss.str());
72 auto start = std::chrono::system_clock::now();
74 auto data =
mm_->getManagedMemory();
76 auto finish = std::chrono::system_clock::now();
Behavior abstraction for the base node.
std::string name() const
Node's name accessor.
std::shared_ptr< hh::core::abstraction::NodeAbstraction > const & core() const
Core accessor.
Behavior abstraction for TaskNode.
std::shared_ptr< ManagedMemory > getManagedMemory()
Get a managed memory for the memory manager attached to the task, can block if none are available at ...
~TaskNode() override=default
Default destructor.
void connectMemoryManager(std::shared_ptr< AbstractMemoryManager > mm)
Connect a memory manager to a task.
virtual std::string extraPrintingInformation() const
Print extra information for the task.
virtual void initialize()
initialize step for the task
std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > const taskNodeAbstraction_
Core abstraction for the task.
TaskNode(std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > core)
Constructor using a core.
std::shared_ptr< AbstractMemoryManager > mm_
Memory manager attached to the task.
virtual void shutdown()
shutdown step for the task
std::shared_ptr< AbstractMemoryManager > const & memoryManager() const
Memory manager accessor.