LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LeechCraft::Util::QueueManager Class Reference

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

#include "queuemanager.h"

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

Public Member Functions

UTIL_API QueueManager (int timeout, QObject *parent=0)
 Creates a queue manager with the given timeout. More...
 
UTIL_API void Schedule (std::function< void()> functor, QObject *dependent=0)
 Adds the given functor. 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 49 of file queuemanager.h.

Constructor & Destructor Documentation

LeechCraft::Util::QueueManager::QueueManager ( int  timeout,
QObject *  parent = 0 
)

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 37 of file queuemanager.cpp.

Member Function Documentation

void LeechCraft::Util::QueueManager::Schedule ( std::function< void()>  functor,
QObject *  dependent = 0 
)

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.

Definition at line 43 of file queuemanager.cpp.


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