libucxx  0.37.00
All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ucxx::BaseDelayedSubmissionCollection< T > Class Template Referenceabstract

Base type for a collection of delayed submissions. More...

#include <delayed_submission.h>

Public Member Functions

 BaseDelayedSubmissionCollection (const std::string name, const bool enabled)
 Constructor for a thread-safe delayed submission collection. More...
 
 BaseDelayedSubmissionCollection (const BaseDelayedSubmissionCollection &)=delete
 
BaseDelayedSubmissionCollectionoperator= (BaseDelayedSubmissionCollection const &)=delete
 
 BaseDelayedSubmissionCollection (BaseDelayedSubmissionCollection &&o)=delete
 
BaseDelayedSubmissionCollectionoperator= (BaseDelayedSubmissionCollection &&o)=delete
 
virtual void schedule (T item)
 Register a callable or complex-type for delayed submission. More...
 
void process ()
 Process all pending callbacks. More...
 

Protected Member Functions

virtual void scheduleLog (T item)=0
 Log message during schedule(). More...
 
virtual void processItem (T item)=0
 Process a single item during process(). More...
 

Protected Attributes

std::string _name {"undefined"}
 The human-readable name of the collection, used for logging.
 
bool _enabled {true}
 Whether the resource required to process the collection is enabled.
 
std::vector< T > _collection {}
 The collection.
 
std::mutex _mutex {}
 Mutex to provide access to _collection.
 

Detailed Description

template<typename T>
class ucxx::BaseDelayedSubmissionCollection< T >

Base type for a collection of delayed submissions.

Base type for a collection of delayed submission. Delayed submissions may have different purposes and this class encapsulates generic data for all derived types.

Constructor & Destructor Documentation

◆ BaseDelayedSubmissionCollection()

template<typename T >
ucxx::BaseDelayedSubmissionCollection< T >::BaseDelayedSubmissionCollection ( const std::string  name,
const bool  enabled 
)
inlineexplicit

Constructor for a thread-safe delayed submission collection.

Construct a thread-safe delayed submission collection. A delayed submission collection provides two operations: schedule and process. The schedule() method will push an operation into the collection, whereas the process() will invoke all callbacks that were previously pushed into the collection and clear the collection.

Parameters
[in]namehuman-readable name of the collection, used for logging.
[in]enabledwhether the resource is enabled, if false an exception is raised when attempting to schedule a callable. Disabled instances of this class should only be used to provide a consistent interface among implementations.

Member Function Documentation

◆ process()

template<typename T >
void ucxx::BaseDelayedSubmissionCollection< T >::process ( )
inline

Process all pending callbacks.

Process all pending generic. Generic callbacks are deemed completed when their execution completes.

◆ processItem()

template<typename T >
virtual void ucxx::BaseDelayedSubmissionCollection< T >::processItem ( item)
protectedpure virtual

Process a single item during process().

Method called by process() to process a single item of the collection.

Parameters
[in]itemthe callback that was passed as argument to schedule() when the first registered.

Implemented in ucxx::RequestDelayedSubmissionCollection, and ucxx::GenericDelayedSubmissionCollection.

◆ schedule()

template<typename T >
virtual void ucxx::BaseDelayedSubmissionCollection< T >::schedule ( item)
inlinevirtual

Register a callable or complex-type for delayed submission.

Register a simple callback, or complex-type with a callback (requires specialization), for delayed submission that will be executed when the request is in fact submitted when process() is called.

Raise an exception if false was specified as the enabled argument to the constructor.

Exceptions
std::runtime_errorif _enabled is false.
Parameters
[in]itemthe callback that will be executed by process() when the operation is submitted.

◆ scheduleLog()

template<typename T >
virtual void ucxx::BaseDelayedSubmissionCollection< T >::scheduleLog ( item)
protectedpure virtual

Log message during schedule().

Log a specialized message while schedule() is being executed.

Parameters
[in]itemthe callback that was passed as argument to schedule().

Implemented in ucxx::RequestDelayedSubmissionCollection, and ucxx::GenericDelayedSubmissionCollection.


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