Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNTimerEntry.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MN_TIMER_ENTRY_H 00025 #define MN_TIMER_ENTRY_H 00026 00027 #include <sys/time.h> 00028 00029 #include "MNMutex.h" 00030 #include "MNString.h" 00031 00032 class TimerCallBase; 00033 00034 /*********************************************************************** 00035 * timer_entry_t 00036 ***********************************************************************/ 00037 00038 struct timer_entry_t 00039 { 00040 // int idx; 00041 TimerCallBase* caller; 00042 struct timeval time_out; 00043 bool periodic; 00044 struct timeval periodic_time; 00045 void* info; 00046 00047 MNString owner; 00048 00049 timer_entry_t& operator=( const timer_entry_t& orig ) 00050 { 00051 // idx = orig.idx; 00052 caller = orig.caller; 00053 time_out = orig.time_out; 00054 periodic = orig.periodic; 00055 periodic_time = orig.periodic_time; 00056 info = orig.info; 00057 owner = orig.owner; 00058 return *this; 00059 } 00060 }; 00061 00062 /*********************************************************************** 00063 * TimerMultiMap 00064 * A private STL thing. 00065 ***********************************************************************/ 00066 00067 class TimerMultiMap; 00068 00069 /*********************************************************************** 00070 * TimerMap 00071 ***********************************************************************/ 00072 00073 class TimerMap 00074 { 00075 TimerMultiMap* _m; 00076 size_t _len; 00077 MNMutex _lock; 00078 00079 public: 00080 TimerMap(); 00081 ~TimerMap(); 00082 00090 bool del( TimerCallBase* k ); 00091 // bool del( int k ); 00092 00098 bool insert( const timer_entry_t& i ); 00099 00104 bool get( timer_entry_t& t ); 00105 00111 bool peek_next_timeout( struct timeval& t ); 00112 00113 void clear( ); 00114 }; 00115 00116 #endif /* MN_TIMER_ENTRY_H */ 00117

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8