HTGS  v2.0
The Hybrid Task Graph Scheduler
htgs::AnyConnector Class Referenceabstract

Parent class for Connector, which removes the template type of the Connector. More...

#include <htgs/core/graph/AnyConnector.hpp>

Inheritance diagram for htgs::AnyConnector:
Inheritance graph
Collaboration diagram for htgs::AnyConnector:
Collaboration graph

Public Member Functions

 AnyConnector ()
 Constructor initializing the producer task count to 0.
 
virtual ~AnyConnector ()
 Virtual destructor.
 
void producerFinished ()
 Indicates to the Connector that the producer has finished producing data for the Connector. More...
 
size_t getProducerCount ()
 Gets the number of producers producing data for the connector. More...
 
void incrementInputTaskCount ()
 Increments the number of tasks producing data for the Connector. More...
 
std::string getDotId ()
 Gets the id used for dot graphs for GraphViz. More...
 
std::string genDot (int flags)
 Generates the dot representation for this connector. More...
 
virtual std::string typeName ()=0
 Gets the demangled type name of the connector. More...
 
virtual bool isInputTerminated ()=0
 Checks whether the producer for this Connector has finished pushing data onto its queue. More...
 
virtual void wakeupConsumer ()=0
 Awakens all Tasks that are consuming data from this connector. More...
 
virtual AnyConnectorcopy ()=0
 Creates a copy of the BaseConnector. More...
 
virtual void produceAnyData (std::shared_ptr< IData > data)=0
 Produces any data into the queue. More...
 
virtual void profileProduce (size_t numThreads)=0
 Provide profile output for the produce operation. More...
 
virtual void profileConsume (size_t numThreads, bool showQueueSize)=0
 Provides profile output for the consume operation. More...
 
virtual size_t getMaxQueueSize ()=0
 Gets the maximum queue size that this connector has in its data queue. More...
 
virtual size_t getQueueSize ()=0
 Gets the size of the queue that this connector has in its data queue. More...
 
virtual void resetMaxQueueSize ()=0
 Resets the max queue size profile.
 

Private Attributes

std::atomic_size_t producerTaskCount
 The number of producers adding data to the connector.
 

Detailed Description

Parent class for Connector, which removes the template type of the Connector.

Used to hold various types of Connectors. Each Connector is built using an EdgeDescriptor routines to add ITasks to a TaskGraphConf.

Each Connector holds onto a priority queue that acquires/distributes IData from a producer/consumer ITask.

Most common use for this class is to indicate when the producer for this Connector has finished pushing data onto its queue.

Common usage:

inputConnector->isInputTerminated();

Member Function Documentation

◆ copy()

virtual AnyConnector* htgs::AnyConnector::copy ( )
pure virtual

Creates a copy of the BaseConnector.

Returns
a copy of the BaseConnector
Note
This function should only be called by the HTGS API

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ genDot()

std::string htgs::AnyConnector::genDot ( int  flags)
inline

Generates the dot representation for this connector.

Parameters
flagsdot gen flags
Returns
the dot representation

◆ getDotId()

std::string htgs::AnyConnector::getDotId ( )
inline

Gets the id used for dot graphs for GraphViz.

Returns
the unique id associated with this Connector

◆ getMaxQueueSize()

virtual size_t htgs::AnyConnector::getMaxQueueSize ( )
pure virtual

Gets the maximum queue size that this connector has in its data queue.

Returns
the maximum queue size for the connector

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ getProducerCount()

size_t htgs::AnyConnector::getProducerCount ( )
inline

Gets the number of producers producing data for the connector.

Returns
the number of producers adding data for this connector.

◆ getQueueSize()

virtual size_t htgs::AnyConnector::getQueueSize ( )
pure virtual

Gets the size of the queue that this connector has in its data queue.

Returns
the size of the queue for the connector

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ incrementInputTaskCount()

void htgs::AnyConnector::incrementInputTaskCount ( )
inline

Increments the number of tasks producing data for the Connector.

Note
This function should only be called by the HTGS API

◆ isInputTerminated()

virtual bool htgs::AnyConnector::isInputTerminated ( )
pure virtual

Checks whether the producer for this Connector has finished pushing data onto its queue.

Returns
whether the input has terminated or not
Return values
TRUEif the input has terminated and no more data is in the queue.
FALSEif there is still data to be processed.

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ produceAnyData()

virtual void htgs::AnyConnector::produceAnyData ( std::shared_ptr< IData data)
pure virtual

Produces any data into the queue.

This function should be used with care as the data will be dynamically cast to the type of Connector.

Parameters
datathe data that will be added to the Connector's queue.

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ producerFinished()

void htgs::AnyConnector::producerFinished ( )
inline

Indicates to the Connector that the producer has finished producing data for the Connector.

Note
This function should only be called by the HTGS API

◆ profileConsume()

virtual void htgs::AnyConnector::profileConsume ( size_t  numThreads,
bool  showQueueSize 
)
pure virtual

Provides profile output for the consume operation.

Parameters
numThreadsthe number of threads associated with consuming data
showQueueSizewhether to show the max queue size or not
Note
#define PROFILE to enable profiling

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ profileProduce()

virtual void htgs::AnyConnector::profileProduce ( size_t  numThreads)
pure virtual

Provide profile output for the produce operation.

Parameters
numThreadsthe number of threads associated with producing data
Note
#define PROFILE to enable profiling

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ typeName()

virtual std::string htgs::AnyConnector::typeName ( )
pure virtual

Gets the demangled type name of the connector.

Returns
the demangled type name

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.

◆ wakeupConsumer()

virtual void htgs::AnyConnector::wakeupConsumer ( )
pure virtual

Awakens all Tasks that are consuming data from this connector.

This function passes nullptr to each consumer to check whether that consumer is ready to be terminated.

Note
This function should only be called by the HTGS API

Implemented in htgs::Connector< T >, and htgs::Connector< htgs::MemoryData< T > >.


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