csutil/eventhandlers.h
Go to the documentation of this file.00001 /* 00002 Crystal Space 3D engine: Event and module naming interface 00003 (C) 2005 by Adam D. Bradley <artdodge@cs.bu.edu> 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_UTIL_EVENTHNAMES_H__ 00021 #define __CS_UTIL_EVENTHNAMES_H__ 00022 00023 #include "cssysdef.h" /* CS_DEBUG changes our definitions... */ 00024 #include "csextern.h" 00025 #include "iutil/eventnames.h" 00026 #include "iutil/eventhandlers.h" 00027 #include "iutil/objreg.h" 00028 #include "csutil/scf_implementation.h" 00029 #include "csutil/hash.h" 00030 #include "csutil/strset.h" 00031 #include "csutil/scf.h" 00032 00040 struct iEventHandler; 00041 00047 class CS_CRYSTALSPACE_EXPORT csEventHandlerRegistry : 00048 public scfImplementation1<csEventHandlerRegistry, iEventHandlerRegistry> 00049 { 00050 public: 00051 csEventHandlerRegistry(iObjectRegistry*); 00052 ~csEventHandlerRegistry(); 00058 CS_CONST_METHOD csHandlerID GetGenericID (const csString &); 00059 static CS_CONST_METHOD csHandlerID GetGenericID (iObjectRegistry *reg, 00060 const csString &name) 00061 { 00062 return GetRegistry (reg)->GetGenericID (name); 00063 } 00064 CS_CONST_METHOD csHandlerID GetGenericPreBoundID (csHandlerID); 00065 static CS_CONST_METHOD csHandlerID GetGenericPreBoundID ( 00066 iObjectRegistry *reg, csHandlerID id) 00067 { 00068 return GetRegistry (reg)->GetGenericPreBoundID (id); 00069 } 00070 CS_CONST_METHOD csHandlerID GetGenericPostBoundID (csHandlerID); 00071 static CS_CONST_METHOD csHandlerID GetGenericPostBoundID ( 00072 iObjectRegistry *reg, csHandlerID id) 00073 { 00074 return GetRegistry (reg)->GetGenericPostBoundID (id); 00075 } 00076 00081 csHandlerID GetID (iEventHandler *); 00082 static CS_CONST_METHOD csHandlerID GetID (iObjectRegistry *reg, 00083 iEventHandler *h) 00084 { 00085 return GetRegistry (reg)->GetID (h); 00086 } 00090 void ReleaseID (csHandlerID id); 00091 static CS_CONST_METHOD void ReleaseID (iObjectRegistry *reg, 00092 csHandlerID id) 00093 { 00094 GetRegistry (reg)->ReleaseID (id); 00095 } 00099 void ReleaseID (iEventHandler *); 00100 static CS_CONST_METHOD void ReleaseID (iObjectRegistry *reg, 00101 iEventHandler *h) 00102 { 00103 GetRegistry (reg)->ReleaseID (h); 00104 } 00110 CS_CONST_METHOD iEventHandler* GetHandler (csHandlerID id); 00111 static inline CS_CONST_METHOD iEventHandler* GetHandler ( 00112 iObjectRegistry *reg, csHandlerID id) 00113 { 00114 return GetRegistry (reg)->GetHandler (id); 00115 }; 00116 00122 CS_CONST_METHOD bool const IsInstanceOf (csHandlerID instanceid, 00123 csHandlerID genericid); 00124 static inline CS_CONST_METHOD bool IsInstanceOf (iObjectRegistry *reg, 00125 csHandlerID instanceid, csHandlerID genericid) 00126 { 00127 return GetRegistry (reg)->IsInstanceOf (instanceid, genericid); 00128 }; 00129 00133 CS_CONST_METHOD bool const IsInstance (csHandlerID id); 00134 static inline CS_CONST_METHOD bool IsInstance (iObjectRegistry *reg, 00135 csHandlerID id) 00136 { 00137 return GetRegistry (reg)->IsInstance (id); 00138 }; 00139 00143 CS_CONST_METHOD csHandlerID const GetGeneric (csHandlerID id); 00144 static inline CS_CONST_METHOD csHandlerID GetGeneric (iObjectRegistry *reg, 00145 csHandlerID id) 00146 { 00147 return GetRegistry (reg)->GetGeneric (id); 00148 }; 00149 00153 CS_CONST_METHOD const char* GetString (csHandlerID id); 00154 static inline CS_CONST_METHOD const char* GetString ( 00155 iObjectRegistry *reg, csHandlerID id) 00156 { 00157 return GetRegistry (reg)->GetString (id); 00158 }; 00159 00160 static csRef<iEventHandlerRegistry> GetRegistry ( 00161 iObjectRegistry *object_reg); 00162 00163 private: 00164 iObjectRegistry *object_reg; 00165 csStringSet names; 00166 csHash<csHandlerID, csHandlerID> instantiation; 00167 csHash<csRef<iEventHandler>, csHandlerID> idToHandler; 00168 csHash<csHandlerID, csRef<iEventHandler> > handlerToID; 00169 csHash<csHandlerID, csHandlerID> handlerPres; 00170 csHash<csHandlerID, csHandlerID> handlerPosts; 00171 uint32 instanceCounter; 00172 }; 00173 00174 /* @} */ 00175 00176 #endif // __CS_UTIL_EVENTHNAMES_H__
Generated for Crystal Space by doxygen 1.4.6