Hedgehog  0.0.0
A library to generate hybrid pipeline workflow systems
hh::core::CoreQueueReceiver< NodeInput > Class Template Referenceabstract

Receiver for nodes possessing a queue of data. More...

#include "core_queue_receiver.h"

Inheritance diagram for hh::core::CoreQueueReceiver< NodeInput >:
Inheritance graph
Collaboration diagram for hh::core::CoreQueueReceiver< NodeInput >:
Collaboration graph

Public Member Functions

 CoreQueueReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueReceiver constructor. More...
 
 ~CoreQueueReceiver () override
 CoreQueueReceiver default destructor.
 
virtual CoreQueueSlotqueueSlot ()=0
 Queue slot accessor possessed by a CoreQueueMultiReceiver. More...
 
size_t queueSize () override
 Return the current waiting data queue size. More...
 
size_t maxQueueSize ()
 Return the maximum current waiting data queue size registered. More...
 
void addSender (CoreSender< NodeInput > *sender) final
 Add a CoreSender to this. More...
 
void removeSender (CoreSender< NodeInput > *sender) final
 Remove a CoreSender from this. More...
 
void receive (std::shared_ptr< NodeInput > data) final
 Receive a data from a CoreQueueSender, and store it into the waiting queue. More...
 
bool receiverEmpty () final
 Test emptiness on the queue. More...
 
std::set< CoreReceiver< NodeInput > * > receivers () override
 Receivers accessor. More...
 
std::shared_ptr< NodeInput > popFront ()
 Return the front element of the queue and return it. More...
 
void copyInnerStructure (CoreQueueReceiver< NodeInput > *rhs)
 Copy the CoreQueueReceiver inner structure (queue and senders list) from rhs to this. More...
 
- Public Member Functions inherited from hh::core::CoreReceiver< NodeInput >
 CoreReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 Constructor with node name, node type and number of threads for the node. More...
 
 ~CoreReceiver () override
 Default destructor.
 
- Public Member Functions inherited from hh::core::CoreNode
 CoreNode ()=delete
 Deleted default constructor.
 
 CoreNode (std::string_view const &name, NodeType const type, size_t numberThreads)
 Core node only constructor. More...
 
virtual ~CoreNode ()
 Default virtual destructor.
 
virtual std::shared_ptr< CoreNodeclone ()=0
 Virtual constructor for copy. More...
 
virtual std::string id () const
 Unique Id accessor. More...
 
virtual std::vector< std::pair< std::string, std::string > > ids () const
 Input node ids [nodeId, nodeIdCluster] accessor. More...
 
std::string_view const & name () const
 Node name accessor. More...
 
NodeType type () const
 Node type accessor. More...
 
bool isInside () const
 Node inside property accessor. More...
 
bool hasBeenRegistered () const
 Node registration property accessor. More...
 
CoreNodecoreClusterNode () const
 Main cluster core node link to this node accessor. More...
 
int threadId () const
 Thread id accessor. More...
 
size_t numberThreads () const
 Number of threads associated accessor. More...
 
CoreNodebelongingNode () const
 Belonging node accessor. More...
 
std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode > > > const & insideNodes () const
 Inside node accessor. More...
 
std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode > > > & insideNodes ()
 Inside nodes accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & executionTime () const
 Execution time accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & waitTime () const
 Wait time accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & memoryWaitTime () const
 Memory wait time accessor. More...
 
bool isInCluster () const
 In cluster property accessor. More...
 
bool isActive () const
 Is active property accessor. More...
 
bool isCudaRelated () const
 Is related to CUDA, used to have a green background on the dot file. More...
 
virtual int graphId ()
 Graph id accessor. More...
 
virtual int deviceId ()
 Device id accessor. More...
 
virtual std::chrono::duration< uint64_t, std::micro > maxExecutionTime () const
 Maximum execution time accessor. More...
 
virtual std::chrono::duration< uint64_t, std::micro > minExecutionTime () const
 Minimum execution time accessor. More...
 
virtual std::chrono::duration< uint64_t, std::micro > maxWaitTime () const
 Maximum waiting time accessor. More...
 
virtual std::chrono::duration< uint64_t, std::micro > minWaitTime () const
 Minimum waiting time accessor. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > const & creationTimeStamp () const
 Creation timestamp accessor. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > const & startExecutionTimeStamp () const
 Execution start timestamp accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & creationDuration () const
 Creation duration accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & executionDuration () const
 Execution duration accessor. More...
 
std::chrono::duration< uint64_t, std::micro > meanExecTimeCluster () const
 Compute and return the mean execution time for all tasks in the node cluster. More...
 
std::chrono::duration< uint64_t, std::micro > meanWaitTimeCluster () const
 Compute and return the mean wait time for all tasks in the node cluster. More...
 
std::chrono::duration< uint64_t, std::micro > meanMemoryWaitTimeCluster () const
 Compute and return the mean memory wait time for all tasks in the node cluster. More...
 
uint64_t stdvExecTimeCluster () const
 Compute and return the standard deviation execution time for all tasks in the node cluster. More...
 
uint64_t stdvWaitTimeCluster () const
 Compute and return the standard deviation wait time for all tasks in the node cluster. More...
 
uint64_t stdvMemoryWaitTimeCluster () const
 Compute and return the standard deviation memory wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxWaitTimeCluster () const
 Compute and return the min and max wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxMemoryWaitTimeCluster () const
 Compute and return the min and max memory wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxExecTimeCluster () const
 Compute and return the min and max execution time for all tasks in the node cluster. More...
 
size_t numberActiveThreadInCluster () const
 Compute and return the number of active nodes in a cluster. More...
 
virtual std::string extraPrintingInformation ()
 Extra printing information accessor. More...
 
void startExecutionTimeStamp (std::chrono::time_point< std::chrono::high_resolution_clock > const &startExecutionTimeStamp)
 Execution timestamp setter. More...
 
virtual void deviceId (int deviceId)
 Device id setter. More...
 
virtual void setInside ()
 Set the node as inside, (inside a graph)
 
void setInCluster ()
 Set the task as part of a cluster.
 
void threadId (uint8_t threadId)
 Set the thread id. More...
 
void coreClusterNode (CoreNode *coreClusterNode)
 Set the main cluster node to associate to this node. More...
 
void name (std::string_view const &name)
 Name node setter. More...
 
void numberThreads (size_t numberThreads)
 Number of threads setter. More...
 
void belongingNode (CoreNode *belongingNode)
 Belonging node setter. More...
 
void hasBeenRegistered (bool hasBeenRegistered)
 Has been registered property setter. More...
 
void isActive (bool isActive)
 Is active property setter. More...
 
void isCudaRelated (bool isCudaRelated)
 Is CUDA related property setter. More...
 
void isInside (bool isInside)
 Set the node as being inside another one. More...
 
void creationDuration (std::chrono::duration< uint64_t, std::micro > const &creationDuration)
 Creation duration setter. More...
 
void executionDuration (std::chrono::duration< uint64_t, std::micro > const &executionDuration)
 Execution duration setter. More...
 
void incrementWaitForMemoryDuration (std::chrono::duration< uint64_t, std::micro > const &memoryWait)
 Add wait for memory duration to total duration. More...
 
virtual void preRun ()
 Method defining what to do before the run.
 
virtual void run ()
 Run method, main execution.
 
virtual void postRun ()
 Method defining what to do after the run.
 
virtual void createCluster (std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &)
 Define how to create a cluster for the node, by default do nothing.
 
virtual void joinThreads ()
 Define what is done when the thread is joined.
 
virtual void duplicateEdge (CoreNode *duplicateNode, std::map< CoreNode *, std::shared_ptr< CoreNode >> &correspondenceMap)=0
 Duplicate all of the edges from this to its copy duplicateNode. More...
 
virtual behavior::Nodenode ()=0
 User's node accessor. More...
 
virtual void visit (AbstractPrinter *printer)=0
 Abstract visit method for printing mechanism. More...
 
virtual std::set< CoreSlot * > getSlots ()=0
 Slots accessor for the node. More...
 
void removeInsideNode (CoreNode *coreNode)
 Remove a node from the registered inside nodes. More...
 
void copyInnerStructure (CoreNode *rhs)
 Copy inner structure from rhs nodes to this. More...
 

Private Attributes

std::shared_ptr< std::queue< std::shared_ptr< NodeInput > > > queue_ = nullptr
 Waiting list of data to be processed.
 
std::shared_ptr< std::set< CoreSender< NodeInput > * > > senders_ = nullptr
 Senders connected to this receiver.
 
size_t maxQueueSize_ = 0
 Maximum queue size registered.
 

Additional Inherited Members

- Protected Member Functions inherited from hh::core::CoreNode
void addUniqueInsideNode (const std::shared_ptr< CoreNode > &coreNode)
 Add a node to the inside nodes. More...
 
void incrementWaitDuration (std::chrono::duration< uint64_t, std::micro > const &wait)
 Increment wait duration. More...
 
void incrementExecutionDuration (std::chrono::duration< uint64_t, std::micro > const &exec)
 Increment execution duration. More...
 

Detailed Description

template<class NodeInput>
class hh::core::CoreQueueReceiver< NodeInput >

Receiver for nodes possessing a queue of data.

Template Parameters
NodeInputNode input types

Definition at line 32 of file core_queue_receiver.h.

Constructor & Destructor Documentation

◆ CoreQueueReceiver()

template<class NodeInput>
hh::core::CoreQueueReceiver< NodeInput >::CoreQueueReceiver ( std::string_view const &  name,
NodeType const  type,
size_t const  numberThreads 
)
inline

CoreQueueReceiver constructor.

Parameters
nameNode's name
typeNode's type
numberThreadsNode's number of thread

Definition at line 43 of file core_queue_receiver.h.

Member Function Documentation

◆ addSender()

template<class NodeInput>
void hh::core::CoreQueueReceiver< NodeInput >::addSender ( CoreSender< NodeInput > *  sender)
inlinefinalvirtual

Add a CoreSender to this.

Parameters
senderCoreSender to add

Implements hh::core::CoreReceiver< NodeInput >.

Definition at line 68 of file core_queue_receiver.h.

◆ copyInnerStructure()

template<class NodeInput>
void hh::core::CoreQueueReceiver< NodeInput >::copyInnerStructure ( CoreQueueReceiver< NodeInput > *  rhs)
inline

Copy the CoreQueueReceiver inner structure (queue and senders list) from rhs to this.

Parameters
rhsCoreQueueReceiver to copy

Definition at line 118 of file core_queue_receiver.h.

◆ maxQueueSize()

template<class NodeInput>
size_t hh::core::CoreQueueReceiver< NodeInput >::maxQueueSize ( )
inline

Return the maximum current waiting data queue size registered.

Returns
The maximum current waiting data queue size registered

Definition at line 64 of file core_queue_receiver.h.

◆ popFront()

template<class NodeInput>
std::shared_ptr<NodeInput> hh::core::CoreQueueReceiver< NodeInput >::popFront ( )
inline

Return the front element of the queue and return it.

Attention
Not thread safe
Returns
The queue front element

Definition at line 107 of file core_queue_receiver.h.

Here is the caller graph for this function:

◆ queueSize()

template<class NodeInput>
size_t hh::core::CoreQueueReceiver< NodeInput >::queueSize ( )
inlineoverridevirtual

Return the current waiting data queue size.

Returns
The current waiting data queue size

Reimplemented from hh::core::CoreReceiver< NodeInput >.

Definition at line 60 of file core_queue_receiver.h.

Here is the caller graph for this function:

◆ queueSlot()

template<class NodeInput>
virtual CoreQueueSlot* hh::core::CoreQueueReceiver< NodeInput >::queueSlot ( )
pure virtual

Queue slot accessor possessed by a CoreQueueMultiReceiver.

Returns
Queue slot possessed by a CoreQueueMultiReceiver

Implemented in hh::core::CoreQueueMultiReceivers< NodeInputs >, hh::core::CoreQueueMultiReceivers< GraphOutput >, and hh::core::CoreQueueMultiReceivers< TaskInputs... >.

Here is the caller graph for this function:

◆ receive()

template<class NodeInput>
void hh::core::CoreQueueReceiver< NodeInput >::receive ( std::shared_ptr< NodeInput >  data)
inlinefinalvirtual

Receive a data from a CoreQueueSender, and store it into the waiting queue.

Attention
Thread safe
Parameters
dataData to store into the queue

Implements hh::core::CoreReceiver< NodeInput >.

Definition at line 83 of file core_queue_receiver.h.

◆ receiverEmpty()

template<class NodeInput>
bool hh::core::CoreQueueReceiver< NodeInput >::receiverEmpty ( )
inlinefinalvirtual

Test emptiness on the queue.

Attention
Not thread safe
Returns
True if the queue is empty, else False

Implements hh::core::CoreReceiver< NodeInput >.

Definition at line 94 of file core_queue_receiver.h.

◆ receivers()

template<class NodeInput>
std::set<CoreReceiver < NodeInput> *> hh::core::CoreQueueReceiver< NodeInput >::receivers ( )
inlineoverridevirtual

Receivers accessor.

Returns
{this}

Implements hh::core::CoreReceiver< NodeInput >.

Definition at line 102 of file core_queue_receiver.h.

◆ removeSender()

template<class NodeInput>
void hh::core::CoreQueueReceiver< NodeInput >::removeSender ( CoreSender< NodeInput > *  sender)
inlinefinalvirtual

Remove a CoreSender from this.

Parameters
senderCoreSender to remove

Implements hh::core::CoreReceiver< NodeInput >.

Definition at line 75 of file core_queue_receiver.h.


The documentation for this class was generated from the following file: