21#ifndef HEDGEHOG_COPYABLE_H
22#define HEDGEHOG_COPYABLE_H
26#include "../core/abstractions/base/any_groupable_abstraction.h"
36template<
class NodeType>
55 std::vector<NodeType const *>
group()
const {
56 std::vector<NodeType const *> ret;
57 std::shared_ptr<hh::core::abstraction::NodeAbstraction> core =
dynamic_cast<Node const *
>(
this)->core();
59 auto groupableNode = std::dynamic_pointer_cast<core::abstraction::AnyGroupableAbstraction>(core);
61 auto group = groupableNode->groupAsNodes();
62 for (
auto &coresInGroup : *
group) {
63 if (coresInGroup){ ret.push_back(
dynamic_cast<NodeType *
>(coresInGroup->node())); }
67 std::ostringstream oss;
68 oss <<
"The core attached to the node " <<
this <<
" does not derives from hh::core::abstraction::AnyGroupableAbstraction.";
69 throw(std::runtime_error(oss.str()));
73 std::ostringstream oss;
74 oss <<
"The core attached to the node " <<
this <<
" is ill-formed.";
75 throw std::runtime_error(oss.str());
82 virtual std::shared_ptr<NodeType>
copy() {
return nullptr; }
Copy interface used to copy a node when either a group of nodes is created or a node is duplicated wh...
virtual ~Copyable()=default
Default destructor.
size_t numberThreads() const
Number of threads accessor.
size_t const numberThreads_
Number of threads.
std::vector< NodeType const * > group() const
Get the group of nodes that hold the current nodes.
virtual std::shared_ptr< NodeType > copy()
Copy method called to either create a group of node or duplicate a node when an execution pipeline is...
Copyable(size_t const numberThreads)
Copyable constructor, set the number of threads for a node.
Behavior abstraction for the base node.