21#ifndef HEDGEHOG_COPYABLE_ABSTRACTION_H
22#define HEDGEHOG_COPYABLE_ABSTRACTION_H
34namespace abstraction {
39template<tool::CopyableNode CopyableNode,
class CopyableCore>
72 if (copyableCore ==
nullptr) {
73 std::ostringstream oss;
75 oss <<
"A copy for the node \"" << node->name()
76 <<
"\" has a core that does not have the right structure (missing inheritance to GroupableAbstraction).";
78 oss <<
"A copy for the node has a core that does not have the right structure (missing inheritance to "
79 "GroupableAbstraction).";
81 throw (std::runtime_error(oss.str()));
85 this->
group()->insert(copyableCore);
86 copyableCore->group(this->
group());
89 if (copyAsCopyable !=
nullptr) {
92 std::ostringstream oss;
93 oss <<
"A copy for the node has a core that does not have the right structure (missing inheritance to GroupableAbstraction).";
94 throw (std::runtime_error(oss.str()));
Abstraction for cores/nodes that can form groups.
std::shared_ptr< std::set< AnyGroupableAbstraction * > > const & group() const
Group of cores accessor.
AnyGroupableAbstraction * groupRepresentative() const
Group representative accessor.
size_t numberThreads() const
Accessor to the number of threads.
Core abstraction for copyable nodes.
std::shared_ptr< CopyableNode > callCopy()
Interface to call user-defined copy method.
Typed abstraction for groupable node.
GroupableAbstraction(CopyableNode *const copyableNode, size_t const &numberThreads)
Constructor using the node abstraction to call the user-defined copy and the number of threads.
~GroupableAbstraction() override=default
Default destructor.
std::shared_ptr< CopyableNode > callCopyAndRegisterInGroup()
Call the used-defined copy and register the copy in the group.
int threadId() const
Accessor to thread id.
virtual void copyInnerStructure(CopyableCore *copyableCore)=0
Copy the inner structure of the core.
int numberThreadsCreated_
Number of thread created for the group.
Base core node abstraction.