00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ID_SET_H
00013 #define ID_SET_H
00014
00015 #include <string.h>
00016
00017 #include <sys/time.h>
00018
00019 #if defined(Linux)
00020 # include <sys/types.h>
00021 # include <unistd.h>
00022 #endif
00023
00024 namespace ASSA {
00025
00034 class IdSet
00035 {
00036 public:
00038 IdSet ();
00039
00043 int newid ();
00044
00048 int recycle (int id_);
00049
00053 int currid () const;
00054
00055 private:
00058 int m_next_available_id;
00059
00062 fd_set m_id_set_map;
00063 };
00064
00065 inline
00066 IdSet::
00067 IdSet()
00068 : m_next_available_id (0)
00069 {
00070 ::memset (&m_id_set_map, 0, sizeof (m_id_set_map));
00071 }
00072
00073 inline int
00074 IdSet::
00075 currid() const
00076 {
00077 return m_next_available_id;
00078 }
00079
00080 }
00081
00082 #endif