Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::core::CoreSwitch< Inputs > Class Template Reference

Switch core. More...

#include "core_switch.h"

Inheritance diagram for hh::core::CoreSwitch< Inputs >:
Inheritance graph
Collaboration diagram for hh::core::CoreSwitch< Inputs >:
Collaboration graph

Public Member Functions

template<class Switch >
requires std::is_base_of_v<behavior::MultiSwitchRules<Inputs...>, Switch>
 CoreSwitch (Switch *const multiSwitchRules)
 Construct a CoreSwitch with a user-defined abstraction with switch rules.
 
 ~CoreSwitch () override=default
 Default destructor.
 
template<tool::ContainsConcept< Inputs... > Input>
bool callSendToGraph (std::shared_ptr< Input > &data, size_t const &graphId)
 Interface to user-defined switch rules.
 
std::vector< std::pair< std::string const, std::string const > > ids () const override
 Node ids [nodeId, nodeGroupId] accessor.
 
behavior::Nodenode () const override
 Getter to the node counterpart.
 
- Public Member Functions inherited from hh::core::abstraction::NodeAbstraction
 NodeAbstraction (std::string name)
 Core node constructor using the core's name.
 
virtual ~NodeAbstraction ()=default
 DEfault destructor.
 
std::string const & name () const
 Accessor to the core's name.
 
virtual std::string id () const
 Core's id ('x' + address of abstraction) as string.
 
bool isRegistered () const
 Accessor to registration flag.
 
GraphNodeAbstractionbelongingGraph () const
 Belonging graph accessor.
 
virtual int deviceId () const
 Get the device identifier (got from belonging graph)
 
virtual size_t graphId () const
 Get the graph identifier (got from belonging graph)
 
std::chrono::nanoseconds const & executionDuration () const
 Execution duration.
 
std::chrono::time_point< std::chrono::system_clock > const & startExecutionTimeStamp () const
 Accessor to the starting execution timestamp.
 
void startExecutionTimeStamp (std::chrono::time_point< std::chrono::system_clock > const &startExecutionTimeStamp)
 Setter to the starting execution timestamp.
 
void incrementExecutionDuration (std::chrono::nanoseconds const &exec)
 Increment execution duration.
 
virtual void registerNode (GraphNodeAbstraction *belongingGraph)
 Register node to the given graph.
 
virtual std::vector< std::pair< std::string const, std::string const > > ids () const =0
 Node ids [nodeId, nodeGroupId] accessor.
 
virtual behavior::Nodenode () const =0
 Node accessor.
 
- Public Member Functions inherited from hh::core::abstraction::TaskOutputsManagementAbstraction< Inputs... >
 TaskOutputsManagementAbstraction ()
 Default constructor.
 
 TaskOutputsManagementAbstraction (std::shared_ptr< implementor::ImplementorNotifier > concreteNotifier, std::shared_ptr< ConcreteMultiSenders > concreteMultiSenders)
 Constructor using concrete implementation of the possible core abstraction.
 
 ~TaskOutputsManagementAbstraction () override=default
 Default destructor.
 
void sendAndNotify (std::shared_ptr< OutputDataType > data)
 Send a piece of data and notify the successors.
 
- Public Member Functions inherited from hh::core::abstraction::NotifierAbstraction
 NotifierAbstraction (std::shared_ptr< implementor::ImplementorNotifier > notifier)
 Constructor utilising a concrete implementation.
 
virtual ~NotifierAbstraction ()=default
 Default destructor.
 
std::set< NotifierAbstraction * > const & notifiers () const
 Const accessor to notifiers.
 
std::set< NotifierAbstraction * > & notifiers ()
 Accessor to notifiers.
 
void addSlot (SlotAbstraction *const slot)
 Add a SlotAbstraction to this notifier.
 
void removeSlot (SlotAbstraction *const slot)
 Remove SlotAbstraction from this notifier.
 
std::set< SlotAbstraction * > const & connectedSlots () const
 Accessor to the slots attached to this notifier.
 
void notify ()
 Notify a slot to wake up.
 
void notifyAllTerminated ()
 Notifier all slots that this node is terminated.
 
- Public Member Functions inherited from hh::core::abstraction::SenderAbstraction< Outputs >
 SenderAbstraction (std::shared_ptr< implementor::ImplementorSender< Outputs > > concreteSender)
 Constructor using the concrete implementation.
 
virtual ~SenderAbstraction ()=default
 Default destructor.
 
std::set< SenderAbstraction< Outputs > * > const & senders () const
 Const accessor to senders.
 
std::set< SenderAbstraction< Outputs > * > & senders ()
 Accessor to senders.
 
std::set< ReceiverAbstraction< Outputs > * > const & connectedReceivers () const
 Accessor to the receivers attached to this SenderAbstraction.
 
void addReceiver (ReceiverAbstraction< Outputs > *const receiver)
 Add a ReceiverAbstraction.
 
void removeReceiver (ReceiverAbstraction< Outputs > *const receiver)
 Remove a ReceiverAbstraction.
 
void send (std::shared_ptr< Outputs > data)
 Send a data as output of the node.
 

Private Attributes

behavior::MultiSwitchRules< Inputs... > *const multiSwitchRules_ = nullptr
 User-defined abstraction with switch rules.
 

Additional Inherited Members

- Public Types inherited from hh::core::abstraction::TaskOutputsManagementAbstraction< Inputs... >
using outputs_t = std::tuple< Outputs... >
 Accessor to the graph outputs type.
 
- Protected Member Functions inherited from hh::core::abstraction::TaskOutputsManagementAbstraction< Inputs... >
void copyInnerStructure (TaskOutputsManagementAbstraction< Outputs... > *copyableCore)
 Copy the inner structure from another task.
 
void duplicateOutputEdges (std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
 Duplicate the output edges for the node clone.
 
- Protected Member Functions inherited from hh::core::abstraction::NotifierAbstraction
void duplicateEdgeNotifier (std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
 Duplicate edges of the current notifier to slots to clone in map.
 
- Protected Member Functions inherited from hh::core::abstraction::SenderAbstraction< Outputs >
void copyInnerStructure (SenderAbstraction< Outputs > *copyableCore)
 Copy inner structure of the sender to this one.
 
void duplicateEdgeSender (std::map< abstraction::NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)
 Duplicate edges of the current sender to receiver to clone in map.
 

Detailed Description

template<class ... Inputs>
class hh::core::CoreSwitch< Inputs >

Switch core.

Template Parameters
InputsInput types list

Definition at line 35 of file core_switch.h.

Constructor & Destructor Documentation

◆ CoreSwitch()

template<class ... Inputs>
template<class Switch >
requires std::is_base_of_v<behavior::MultiSwitchRules<Inputs...>, Switch>
hh::core::CoreSwitch< Inputs >::CoreSwitch ( Switch *const  multiSwitchRules)
inlineexplicit

Construct a CoreSwitch with a user-defined abstraction with switch rules.

Template Parameters
SwitchType of the user-defined abstraction with switch rules
Parameters
multiSwitchRulesUser-defined abstraction with switch rules

Definition at line 48 of file core_switch.h.

◆ ~CoreSwitch()

template<class ... Inputs>
hh::core::CoreSwitch< Inputs >::~CoreSwitch ( )
overridedefault

Default destructor.

Member Function Documentation

◆ callSendToGraph()

template<class ... Inputs>
template<tool::ContainsConcept< Inputs... > Input>
bool hh::core::CoreSwitch< Inputs >::callSendToGraph ( std::shared_ptr< Input > &  data,
size_t const &  graphId 
)
inline

Interface to user-defined switch rules.

Template Parameters
InputInput data type
Parameters
dataInput data
graphIdGraph id
Returns
True if the data needs to be send to graph of id graphId, else false

Definition at line 61 of file core_switch.h.

Here is the call graph for this function:

◆ ids()

template<class ... Inputs>
std::vector< std::pair< std::string const, std::string const > > hh::core::CoreSwitch< Inputs >::ids ( ) const
inlineoverridevirtual

Node ids [nodeId, nodeGroupId] accessor.

Returns
Node ids [nodeId, nodeGroupId]

Implements hh::core::abstraction::NodeAbstraction.

Definition at line 67 of file core_switch.h.

Here is the call graph for this function:

◆ node()

template<class ... Inputs>
behavior::Node * hh::core::CoreSwitch< Inputs >::node ( ) const
inlineoverridevirtual

Getter to the node counterpart.

Returns
Nothing, throw an error because there is no Node attached to the core
Exceptions
std::runtime_errorbecause there is no Node attached to the core

Implements hh::core::abstraction::NodeAbstraction.

Definition at line 74 of file core_switch.h.

Member Data Documentation

◆ multiSwitchRules_

template<class ... Inputs>
behavior::MultiSwitchRules<Inputs...>* const hh::core::CoreSwitch< Inputs >::multiSwitchRules_ = nullptr
private

User-defined abstraction with switch rules.

Definition at line 40 of file core_switch.h.