csutil/csevcord.h
00001 /* 00002 Copyright (C) 2000 by Jorrit Tyberghein 00003 Written by Michael Dale Long. 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSEVCORD_H__ 00021 #define __CS_CSEVCORD_H__ 00022 00023 #include "csextern.h" 00024 #include "scf.h" 00025 #include "iutil/event.h" 00026 struct iEventHandler; 00027 class csEventOutlet; 00028 00032 class CS_CSUTIL_EXPORT csEventCord : public iEventCord 00033 { 00034 protected: 00036 volatile bool pass; 00037 00039 int category, subcategory; 00040 00042 struct PluginData 00043 { 00044 iEventHandler *plugin; 00045 int priority; 00046 PluginData *next; 00047 }; 00048 00050 PluginData *plugins; 00051 00053 volatile int SpinLock; 00054 00056 inline void Lock() { while (SpinLock) {} SpinLock++; } 00058 inline void Unlock() { SpinLock--; } 00059 00061 friend class csEventOutlet; 00062 bool Post(iEvent*); 00063 00064 public: 00065 SCF_DECLARE_IBASE; 00066 00068 csEventCord(int category, int subcategory); 00069 00071 virtual ~csEventCord(); 00072 00074 virtual int Insert(iEventHandler*, int priority); 00075 00077 virtual void Remove(iEventHandler*); 00078 00080 virtual bool GetPass() const { return pass; } 00081 00083 virtual void SetPass(bool flag) { pass = flag; } 00084 00086 virtual int GetCategory() const { return category; } 00087 00089 virtual int GetSubcategory() const { return subcategory; } 00090 }; 00091 00092 #endif // __CS_CSEVCORD_H__
Generated for Crystal Space by doxygen 1.2.18