IdSet.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                                IdSet.h
00004 //------------------------------------------------------------------------------
00005 //  Copyright (c) 1997 by Vladislav Grinchenko
00006 //
00007 //  This library is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU Library General Public
00009 //  License as published by the Free Software Foundation; either
00010 //  version 2 of the License, or (at your option) any later version.
00011 //------------------------------------------------------------------------------
00012 #ifndef ID_SET_H
00013 #define ID_SET_H
00014 
00015 #include <string.h>
00016 
00017 #include <sys/time.h>       /* select(3) */
00018 
00019 #if defined(Linux)      /* select(3) */
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 } // end namespace ASSA
00081 
00082 #endif /* ID_SET_H */

Generated on Sat Dec 31 19:52:09 2005 for libassa by  doxygen 1.4.5