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

Base class for an htgs::IRule. More...

#include <htgs/core/rules/AnyIRule.hpp>

Inheritance diagram for htgs::AnyIRule:
Inheritance graph
Collaboration diagram for htgs::AnyIRule:
Collaboration graph

Public Member Functions

 AnyIRule ()
 Creates an AnyIRule with locks enabled.
 
 AnyIRule (bool useLocks)
 Creates an AnyIRule with locks specified. More...
 
virtual ~AnyIRule ()
 Destructor.
 
virtual bool canTerminateRule (size_t pipelineId)=0
 Virtual function to determine if a rule is ready to be terminated. More...
 
virtual void shutdownRule (size_t pipelineId)=0
 Virtual function that handles when a rule is being shutdown for a particular pipelineId. More...
 
virtual std::string getName ()=0
 Virtual function to get the name of the IRule. More...
 
std::mutex & getMutex ()
 Gets the mutex associated with this IRule. More...
 
bool canUseLocks () const
 Gets whether the rule should use locks or not. More...
 

Private Attributes

std::mutex mutex
 The mutex associated with this IRule to ensure no more than one thread is processing the rule at a time.
 
bool useLocks
 Will enable using the mutex to lock the rule to ensure this rule is only accessed by a thread at a time.
 

Detailed Description

Base class for an htgs::IRule.

Constructor & Destructor Documentation

◆ AnyIRule()

htgs::AnyIRule::AnyIRule ( bool  useLocks)
inline

Creates an AnyIRule with locks specified.

Parameters
useLockswhether to use locks on the rule or not to ensure one thread accesses the rule at a time

Member Function Documentation

◆ canTerminateRule()

virtual bool htgs::AnyIRule::canTerminateRule ( size_t  pipelineId)
pure virtual

Virtual function to determine if a rule is ready to be terminated.

If there is no more data entering the RuleManager that is managing this IRule, then the rule will be automatically terminated.

Parameters
pipelineIdthe pipelineId associated with this rule
Returns
whether the rule should be terminated or not
Return values
TRUEif the rule should be terminated
FALSEif the rule should not be terminated
Note
The rule will automatically be terminated if the input ITask has terminated.

Implemented in htgs::IRule< T, U >, htgs::IRule< T, T >, and htgs::ExecutionPipelineBroadcastRule< T >.

◆ canUseLocks()

bool htgs::AnyIRule::canUseLocks ( ) const
inline

Gets whether the rule should use locks or not.

Returns
TRUE if locks should be used, otherwise false
Return values
TRUEthe lock will be used to ensure mutual exclusion when accessing this rule across multiple threads
FALSEthe lock will not be used, and any thread may access the rule asynchronously

◆ getMutex()

std::mutex& htgs::AnyIRule::getMutex ( )
inline

Gets the mutex associated with this IRule.

Returns
the mutex
Note
This function should only be called by the HTGS API

◆ getName()

virtual std::string htgs::AnyIRule::getName ( )
pure virtual

Virtual function to get the name of the IRule.

Returns
the name of the IRule

Implemented in htgs::IRule< T, U >, htgs::IRule< T, T >, and htgs::ExecutionPipelineBroadcastRule< T >.

◆ shutdownRule()

virtual void htgs::AnyIRule::shutdownRule ( size_t  pipelineId)
pure virtual

Virtual function that handles when a rule is being shutdown for a particular pipelineId.

Parameters
pipelineIdthe pipelineId to shutdown
Note
This function can be used to release memory, but if there are multiple pipelines managed by an ExecutionPipeline, then the memory release should occur in a destructor.

Implemented in htgs::IRule< T, U >, htgs::IRule< T, T >, and htgs::ExecutionPipelineBroadcastRule< T >.


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