/home/vlg/develop/libASSA/libassa/assa/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 #if defined(WIN32)
00025 #    include <winsock2.h>
00026 #endif
00027 
00028 namespace ASSA {
00029 
00038 class IdSet
00039 {
00040 public:
00042     IdSet ();
00043 
00047     int newid ();
00048 
00052     int recycle (int id_);
00053 
00057     int currid () const;
00058 
00059 private:
00062     int m_next_available_id;
00063 
00066     fd_set m_id_set_map;
00067 };
00068 
00069 inline
00070 IdSet::
00071 IdSet()
00072     : m_next_available_id (0)
00073 {
00074     ::memset (&m_id_set_map, 0, sizeof (m_id_set_map));
00075 }
00076  
00077 inline int
00078 IdSet::
00079 currid() const
00080 {
00081     return m_next_available_id;
00082 }
00083 
00084 } // end namespace ASSA
00085 
00086 #endif /* ID_SET_H */

Generated on Sun Aug 13 15:08:00 2006 for libassa by  doxygen 1.4.6