LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::QueueManager Class Reference

A simple scheduling manager for a queue of functors. More...

#include "queuemanager.h"

+ Inheritance diagram for LC::Util::QueueManager:
+ Collaboration diagram for LC::Util::QueueManager:

Public Member Functions

 QueueManager (int timeout, QObject *parent=nullptr)
 Creates a queue manager with the given timeout. More...
 
void Schedule (std::function< void()> functor, QObject *dependent=nullptr, QueuePriority prio=QueuePriority::Normal)
 Adds the given functor. More...
 
void Clear ()
 Clears the queue. More...
 
void Pause ()
 Pauses the queue rotation. More...
 
bool IsPaused () const
 Checks if the queue is paused. More...
 
void Resume ()
 Continues the queue rotation. More...
 

Detailed Description

A simple scheduling manager for a queue of functors.

This class manages execution of functors that should be called with some minimal timeout between them.

Definition at line 43 of file queuemanager.h.

Constructor & Destructor Documentation

◆ QueueManager()

LC::Util::QueueManager::QueueManager ( int  timeout,
QObject *  parent = nullptr 
)

Creates a queue manager with the given timeout.

Parameters
[in]timeoutThe timeout between invoking the functions in milliseconds.
[in]parentThe parent object of this queue manager.

Definition at line 28 of file queuemanager.cpp.

References LC::Util::oral::sph::f.

Member Function Documentation

◆ Clear()

void LC::Util::QueueManager::Clear ( )

Clears the queue.

Clears the remaining items in the queue, but doesn't abort the current operation.

Definition at line 57 of file queuemanager.cpp.

◆ IsPaused()

bool LC::Util::QueueManager::IsPaused ( ) const

Checks if the queue is paused.

Returns
Whether the queue is paused.
See also
Pause(), Resume()

Definition at line 68 of file queuemanager.cpp.

◆ Pause()

void LC::Util::QueueManager::Pause ( )

Pauses the queue rotation.

If the queue is already paused, this function does nothing.

See also
IsPaused(), Resume()

Definition at line 62 of file queuemanager.cpp.

◆ Resume()

void LC::Util::QueueManager::Resume ( )

Continues the queue rotation.

If the queue is already running, this function does nothing.

See also
IsPaused(), Pause()

Definition at line 73 of file queuemanager.cpp.

◆ Schedule()

void LC::Util::QueueManager::Schedule ( std::function< void()>  functor,
QObject *  dependent = nullptr,
QueuePriority  prio = QueuePriority::Normal 
)

Adds the given functor.

This function adds the given functor to the execution queue, or executes it right at the point of adding if more than timeout has passed since executing the last functor.

dependent is an object this functor depends upon. If dependent object is destructed by the time queue reaches the passed functor, the functor will be skipped and next scheduled functor will be executed (if any).

Parameters
[in]functorThe functor to add to the queue.
[in]dependentThe dependent object, or nullptr if this functor doesn't depend on anything.
[in]prioThe priority of the functor. Functors with high priority are added to the beginning of the queue.

Definition at line 41 of file queuemanager.cpp.

Referenced by LC::Util::SvcAuth::VkAuthManager::SetSilentMode().

+ Here is the caller graph for this function:

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