21#ifndef HEDGEHOG_ABSTRACT_TASK_H 
   22#define HEDGEHOG_ABSTRACT_TASK_H 
   29#include "../../behavior/copyable.h" 
   30#include "../../behavior/cleanable.h" 
   31#include "../../behavior/task_node.h" 
   32#include "../../behavior/multi_execute.h" 
   33#include "../../behavior/input_output/multi_receivers.h" 
   34#include "../../behavior/input_output/task_multi_senders.h" 
   36#include "../../core/nodes/core_task.h" 
  107template<
size_t Separator, 
class ...AllTypes>
 
  113      public tool::BehaviorMultiReceiversTypeDeducer_t<tool::Inputs<Separator, AllTypes...>>,
 
  114      public tool::BehaviorMultiExecuteTypeDeducer_t<tool::Inputs<Separator, AllTypes...>>,
 
  115      public tool::BehaviorTaskMultiSendersTypeDeducer_t<tool::Outputs<Separator, AllTypes...>> {
 
  131      : behavior::
TaskNode(std::make_shared<
core::CoreTask<Separator, AllTypes...>>(this,
 
  136        tool::BehaviorTaskMultiSendersTypeDeducer_t<tool::Outputs<Separator, AllTypes...>>(
 
  137            (std::dynamic_pointer_cast<
hh::
core::CoreTask<Separator, AllTypes...>>(this->
core()))),
 
  138        coreTask_(std::dynamic_pointer_cast<
core::CoreTask<Separator, AllTypes...>>(this->
core())) {
 
  139    if (
numberThreads == 0) { 
throw std::runtime_error(
"A task needs at least one thread."); }
 
  140    if (
coreTask_ == 
nullptr) { 
throw std::runtime_error(
"The core used by the task should be a CoreTask."); }
 
  151        tool::BehaviorTaskMultiSendersTypeDeducer_t<tool::Outputs<Separator, AllTypes...>>(
 
  152            std::dynamic_pointer_cast<
hh::
core::CoreTask<Separator, AllTypes...>>(this->
core())),
 
  153        coreTask_(std::dynamic_pointer_cast<
core::CoreTask<Separator, AllTypes...>>(this->
core())) {
 
Base node for computation.
bool canTerminate() const override
Default termination rule, it terminates if there is no predecessor connection and there is no input d...
AbstractTask()
Default constructor (Task with one thread named "Task")
AbstractTask(std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > coreTask)
Construct a task from a user-defined core.
std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > const & coreTask() const
Accessor to the core task.
std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > const coreTask_
Task core.
int deviceId()
Accessor to device id linked to the task (default 0 for CPU task)
AbstractTask(std::string const &name, size_t const numberThreads=1, bool const automaticStart=false)
AbstractTask main constructor.
size_t graphId() const
Belonging graph id accessor.
~AbstractTask() override=default
Default task destructor.
Behavior abstraction for nodes that expose termination condition.
Copy interface used to copy a node when either a group of nodes is created or a node is duplicated wh...
size_t numberThreads() const
Number of threads accessor.
Copyable(size_t const numberThreads)
Copyable constructor, set the number of threads for a 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.
TaskNode(std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > core)
Constructor using a core.