libassa 3.5.1
Loading...
Searching...
No Matches
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
28namespace ASSA {
29
38class IdSet
39{
40public:
42 IdSet ();
43
47 int newid ();
48
52 int recycle (int id_);
53
57 int currid () const;
58
59private:
63
67};
68
69inline
71IdSet()
72 : m_next_available_id (0)
73{
74 ::memset (&m_id_set_map, 0, sizeof (m_id_set_map));
75}
76
77inline int
79currid() const
80{
82}
83
84} // end namespace ASSA
85
86#endif /* ID_SET_H */
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
int m_next_available_id
Current id.
Definition IdSet.h:62
int newid()
Return current id.
Definition IdSet.cpp:20
IdSet()
Default constructor creates IdSet object with ID equals to 0.
Definition IdSet.h:71
int recycle(int id_)
Recycle id_.
Definition IdSet.cpp:54
int currid() const
Get current id.
Definition IdSet.h:79
fd_set m_id_set_map
Map of all ids.
Definition IdSet.h:66