MPD
0.20.15
client
ClientList.hxx
Go to the documentation of this file.
1
/*
2
* Copyright 2003-2017 The Music Player Daemon Project
3
* http://www.musicpd.org
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 along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
#ifndef MPD_CLIENT_LIST_HXX
21
#define MPD_CLIENT_LIST_HXX
22
23
#include "
Client.hxx
"
24
25
#include <boost/intrusive/list.hpp>
26
27
class
ClientList
{
28
typedef
boost::intrusive::list<
Client
,
29
boost::intrusive::constant_time_size<true>> List;
30
31
const
unsigned
max_size;
32
33
List list;
34
35
public
:
36
ClientList
(
unsigned
_max_size)
37
:max_size(_max_size) {}
38
~ClientList
() {
39
CloseAll
();
40
}
41
42
List::iterator
begin
() {
43
return
list.begin();
44
}
45
46
List::iterator
end
() {
47
return
list.end();
48
}
49
50
bool
IsFull
()
const
{
51
return
list.size() >= max_size;
52
}
53
54
void
Add
(
Client
&client) {
55
list.push_front(client);
56
}
57
58
void
Remove
(
Client
&client);
59
60
void
CloseAll
();
61
62
void
IdleAdd
(
unsigned
flags);
63
};
64
65
#endif
ClientList::Add
void Add(Client &client)
Definition:
ClientList.hxx:54
ClientList::end
List::iterator end()
Definition:
ClientList.hxx:46
ClientList
Definition:
ClientList.hxx:27
ClientList::ClientList
ClientList(unsigned _max_size)
Definition:
ClientList.hxx:36
ClientList::Remove
void Remove(Client &client)
ClientList::CloseAll
void CloseAll()
ClientList::~ClientList
~ClientList()
Definition:
ClientList.hxx:38
Client
Definition:
Client.hxx:47
Client.hxx
ClientList::begin
List::iterator begin()
Definition:
ClientList.hxx:42
ClientList::IsFull
bool IsFull() const
Definition:
ClientList.hxx:50
ClientList::IdleAdd
void IdleAdd(unsigned flags)
Generated on Thu Jan 11 2018 20:53:11 for MPD by
1.8.14