libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
IdSet.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// IdSet.h
4
//------------------------------------------------------------------------------
5
// Copyright (c) 1997 by Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
#ifndef ID_SET_H
13
#define ID_SET_H
14
15
#include <string.h>
16
17
#include <sys/time.h>
/* select(3) */
18
19
#if defined(Linux)
/* select(3) */
20
# include <sys/types.h>
21
# include <unistd.h>
22
#endif
23
24
#if defined(WIN32)
25
# include <winsock2.h>
26
#endif
27
28
namespace
ASSA {
29
38
class
IdSet
39
{
40
public
:
42
IdSet
();
43
47
int
newid
();
48
52
int
recycle
(
int
id_);
53
57
int
currid
()
const
;
58
59
private
:
62
int
m_next_available_id
;
63
66
fd_set
m_id_set_map
;
67
};
68
69
inline
70
IdSet::
71
IdSet
()
72
: m_next_available_id (0)
73
{
74
::memset (&
m_id_set_map
, 0,
sizeof
(
m_id_set_map
));
75
}
76
77
inline
int
78
IdSet::
79
currid
()
const
80
{
81
return
m_next_available_id
;
82
}
83
84
}
// end namespace ASSA
85
86
#endif
/* ID_SET_H */
ASSA::IdSet::IdSet
IdSet()
Default constructor creates IdSet object with ID equals to 0.
Definition:
IdSet.h:71
ASSA::IdSet::newid
int newid()
Return current id.
Definition:
IdSet.cpp:20
ASSA::IdSet::m_id_set_map
fd_set m_id_set_map
Map of all ids.
Definition:
IdSet.h:66
ASSA::IdSet
Definition:
IdSet.h:38
ASSA::IdSet::recycle
int recycle(int id_)
Recycle id_.
Definition:
IdSet.cpp:54
ASSA::IdSet::currid
int currid() const
Get current id.
Definition:
IdSet.h:79
ASSA::IdSet::m_next_available_id
int m_next_available_id
Current id.
Definition:
IdSet.h:62
Generated on Wed Jan 1 2014 07:03:03 for libassa by
1.8.5