ThreadWeaver 5.109.0
Public Member Functions | Protected Member Functions | List of all members
ThreadWeaver::Stateabstract

We use a State pattern to handle the system state in ThreadWeaver. More...

#include <state.h>

Public Member Functions

 State (QueueSignals *weaver)
 Default constructor.
 
 ~State () override
 Destructor.
 
virtual void activated ()
 The state has been changed so that this object is responsible for state handling.
 
virtual StateId stateId () const =0
 The state Id.
 
QString stateName () const
 The ID of the current state.
 
- Public Member Functions inherited from ThreadWeaver::QueueInterface
virtual int currentNumberOfThreads () const =0
 Returns the current number of threads in the inventory.
 
virtual void dequeue ()=0
 Remove all queued jobs.
 
virtual bool dequeue (const JobPointer &job)=0
 Remove a job from the queue.
 
virtual void enqueue (const QVector< JobPointer > &jobs)=0
 Queue a vector of jobs.
 
virtual void finish ()=0
 Finish all queued operations, then return.
 
virtual bool isEmpty () const =0
 Is the queue empty? The queue is empty if no more jobs are queued.
 
virtual bool isIdle () const =0
 Is the weaver idle? The weaver is idle if no jobs are queued and no jobs are processed by the threads.
 
virtual int maximumNumberOfThreads () const =0
 Get the maximum number of threads this Weaver may start.
 
virtual int queueLength () const =0
 Returns the number of pending jobs.
 
virtual void requestAbort ()=0
 Request aborts of the currently executed jobs.
 
virtual void reschedule ()=0
 Reschedule the jobs in the queue.
 
virtual void resume ()=0
 Resume job queueing.
 
virtual void setMaximumNumberOfThreads (int cap)=0
 Set the maximum number of threads this Weaver object may start.
 
virtual void shutDown ()=0
 Shut down the queue.
 
virtual const Statestate () const =0
 Return the state of the weaver object.
 
virtual void suspend ()=0
 Suspend job execution.
 

Protected Member Functions

virtual QueueInterfaceweaver ()
 The Weaver interface this state handles.
 
virtual const QueueInterfaceweaver () const
 

Detailed Description

We use a State pattern to handle the system state in ThreadWeaver.

Constructor & Destructor Documentation

◆ State()

ThreadWeaver::State::State ( QueueSignals weaver)
explicit

Default constructor.

◆ ~State()

ThreadWeaver::State::~State ( )
override

Destructor.

Member Function Documentation

◆ activated()

virtual void ThreadWeaver::State::activated ( )
virtual

The state has been changed so that this object is responsible for state handling.

Reimplemented in ThreadWeaver::SuspendingState.

◆ stateId()

virtual StateId ThreadWeaver::State::stateId ( ) const
pure virtual

◆ stateName()

QString ThreadWeaver::State::stateName ( ) const

The ID of the current state.

See also
StateNames, StateID

◆ weaver()

virtual QueueInterface * ThreadWeaver::State::weaver ( )
protectedvirtual

The Weaver interface this state handles.

Reimplemented in ThreadWeaver::DestructedState, and ThreadWeaver::WeaverImplState.