digiKam
Digikam::ParallelWorkers Class Referenceabstract
+ Inheritance diagram for Digikam::ParallelWorkers:

Public Member Functions

bool connect (const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoConnection) const
 Connects signals outbound from all workers to a given receiver. More...
 
void deactivate (WorkerObject::DeactivatingMode mode=WorkerObject::FlushSignals)
 
bool optimalWorkerCountReached () const
 
 ParallelWorkers ()
 
void schedule ()
 
void setPriority (QThread::Priority priority)
 
void wait ()
 
virtual ~ParallelWorkers ()
 

Static Public Member Functions

static int optimalWorkerCount ()
 

Protected Types

typedef void(* StaticMetacallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Protected Member Functions

void add (WorkerObject *const worker)
 
virtual QObject * asQObject ()=0
 
virtual const QMetaObject * mocMetaObject () const =0
 
const QMetaObject * replacementMetaObject () const
 
int replacementQtMetacall (QMetaObject::Call _c, int _id, void **_a)
 
int replacementStaticQtMetacall (QMetaObject::Call _c, int _id, void **_a)
 
virtual StaticMetacallFunction staticMetacallPointer ()=0
 
virtual int WorkerObjectQtMetacall (QMetaObject::Call _c, int _id, void **_a)=0
 

Protected Attributes

int m_currentIndex
 
StaticMetacallFunction m_originalStaticMetacall
 
QMetaObject * m_replacementMetaObject
 
QList< WorkerObject * > m_workers
 

Member Typedef Documentation

◆ StaticMetacallFunction

typedef void(* Digikam::ParallelWorkers::StaticMetacallFunction) (QObject *, QMetaObject::Call, int, void **)
protected

Constructor & Destructor Documentation

◆ ParallelWorkers()

Digikam::ParallelWorkers::ParallelWorkers ( )
explicit

ParallelWorkers is a helper class to distribute work over several identical workers objects. See ParallelAdapter for guidance how to use it.

◆ ~ParallelWorkers()

Digikam::ParallelWorkers::~ParallelWorkers ( )
virtual

Member Function Documentation

◆ add()

void Digikam::ParallelWorkers::add ( WorkerObject *const  worker)
protected

References m_workers.

Referenced by Digikam::ParallelAdapter< A >::add().

◆ asQObject()

virtual QObject* Digikam::ParallelWorkers::asQObject ( )
protectedpure virtual

Return the target QObject (double inheritance)

Implemented in Digikam::ParallelAdapter< A >, and Digikam::ParallelAdapter< Digikam::FileWorkerInterface >.

Referenced by replacementStaticQtMetacall().

◆ connect()

bool Digikam::ParallelWorkers::connect ( const char *  signal,
const QObject *  receiver,
const char *  method,
Qt::ConnectionType  type = Qt::AutoConnection 
) const

Connects signals outbound from all workers to a given receiver.

References m_workers.

Referenced by Digikam::ParallelAdapter< A >::connect().

◆ deactivate()

void Digikam::ParallelWorkers::deactivate ( WorkerObject::DeactivatingMode  mode = WorkerObject::FlushSignals)

◆ mocMetaObject()

virtual const QMetaObject* Digikam::ParallelWorkers::mocMetaObject ( ) const
protectedpure virtual

The moc-generated metaObject of the target object

Implemented in Digikam::ParallelAdapter< A >, and Digikam::ParallelAdapter< Digikam::FileWorkerInterface >.

Referenced by replacementMetaObject(), and replacementStaticQtMetacall().

◆ optimalWorkerCount()

int Digikam::ParallelWorkers::optimalWorkerCount ( )
static

Regarding the number of logical CPUs on the current machine, returns the optimal count of concurrent workers

Referenced by Digikam::ItemInfoTaskSplitter::ItemInfoTaskSplitter(), and optimalWorkerCountReached().

◆ optimalWorkerCountReached()

bool Digikam::ParallelWorkers::optimalWorkerCountReached ( ) const

Returns true if the current number of added workers has reached the optimalWorkerCount()

References m_workers, and optimalWorkerCount().

◆ replacementMetaObject()

const QMetaObject * Digikam::ParallelWorkers::replacementMetaObject ( ) const
protected

◆ replacementQtMetacall()

int Digikam::ParallelWorkers::replacementQtMetacall ( QMetaObject::Call  _c,
int  _id,
void **  _a 
)
protected

Replaces slot call distribution of the target QObject

References replacementStaticQtMetacall(), and WorkerObjectQtMetacall().

Referenced by Digikam::ParallelAdapter< A >::qt_metacall().

◆ replacementStaticQtMetacall()

int Digikam::ParallelWorkers::replacementStaticQtMetacall ( QMetaObject::Call  _c,
int  _id,
void **  _a 
)
protected

◆ schedule()

void Digikam::ParallelWorkers::schedule ( )

The corresponding methods of all added worker objects will be called

References m_workers.

Referenced by Digikam::ParallelAdapter< A >::schedule().

◆ setPriority()

void Digikam::ParallelWorkers::setPriority ( QThread::Priority  priority)

References m_workers.

◆ staticMetacallPointer()

virtual StaticMetacallFunction Digikam::ParallelWorkers::staticMetacallPointer ( )
protectedpure virtual

◆ wait()

void Digikam::ParallelWorkers::wait ( )

◆ WorkerObjectQtMetacall()

virtual int Digikam::ParallelWorkers::WorkerObjectQtMetacall ( QMetaObject::Call  _c,
int  _id,
void **  _a 
)
protectedpure virtual

The qt_metacall of WorkerObject, one level above the target QObject

Implemented in Digikam::ParallelAdapter< A >, and Digikam::ParallelAdapter< Digikam::FileWorkerInterface >.

Referenced by replacementQtMetacall().

Member Data Documentation

◆ m_currentIndex

int Digikam::ParallelWorkers::m_currentIndex
protected

◆ m_originalStaticMetacall

StaticMetacallFunction Digikam::ParallelWorkers::m_originalStaticMetacall
protected

◆ m_replacementMetaObject

QMetaObject* Digikam::ParallelWorkers::m_replacementMetaObject
protected

◆ m_workers


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