libktorrent
2.2.0
src
dht
taskmanager.h
1
/***************************************************************************
2
* Copyright (C) 2005 by Joris Guisson *
3
* joris.guisson@gmail.com *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
* *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
14
* *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19
***************************************************************************/
20
#ifndef DHTTASKMANAGER_H
21
#define DHTTASKMANAGER_H
22
23
#include <QList>
24
#include <QPointer>
25
#include <util/constants.h>
26
#include "task.h"
27
28
namespace
dht
29
{
30
class
DHT;
31
37
class
TaskManager :
public
QObject
38
{
39
Q_OBJECT
40
public
:
41
TaskManager(
const
DHT* dh_table);
42
~TaskManager()
override
;
43
48
void
addTask
(Task* task);
49
51
bt::Uint32
getNumTasks
()
const
{
return
num_active;}
52
54
bt::Uint32
getNumQueuedTasks
()
const
{
return
queued.count();}
55
56
private
Q_SLOTS:
57
void
taskFinished(
Task
* task);
58
59
private
:
60
const
DHT
* dh_table;
61
QList<QPointer<Task> > queued;
62
bt::Uint32 num_active;
63
};
64
65
}
66
67
#endif
dht::TaskManager::getNumQueuedTasks
bt::Uint32 getNumQueuedTasks() const
Get the number of queued tasks.
Definition:
taskmanager.h:72
dht::Task
Definition:
task.h:47
dht::TaskManager::addTask
void addTask(Task *task)
dht::TaskManager::getNumTasks
bt::Uint32 getNumTasks() const
Get the number of running tasks.
Definition:
taskmanager.h:69
dht::DHT
Definition:
dht.h:63
Generated by
1.8.18