Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Listener.cc

Go to the documentation of this file.
00001 // guard need for compilers that require template source included in header
00002 #ifndef LISTENER_CC_TEMPLATE
00003 #define LISTENER_CC_TEMPLATE
00004 
00024 #include "Listener.hh"
00025 #include "EventSender.hh"
00026 
00036 template<typename EvType>
00037 void 
00038 Listener<EvType>::ignoreThisEvent()
00039 {
00040     // only a valid call if processing an event
00041     if (! _processingEvent) return;
00042     
00043     assert( EventSender<EvType>::isSending() );
00044     if (! _ignoringHeardEvent) 
00045     {
00046         EventSender<EvType>::instance().incEventIgnored();
00047         _ignoringHeardEvent = true;
00048     }
00049     
00050     //assert( EventSender<EvType>::isRegistered(this) == _registered); 
00051 }
00052 
00056 template<typename EvType>
00057 void 
00058 Listener<EvType>::ignoreEvents() 
00059 {
00060     if (_registered) 
00061     {
00062         EventSender<EvType>::instance().removeListener(this);
00063         _registered = false;
00064     }
00065     
00066     //assert( ! EventSender<EvType>::isRegistered(this) ); 
00067 }
00068 
00072 template<typename EvType>
00073 void 
00074 Listener<EvType>::listenForEvents() 
00075 {
00076     if (!_registered) 
00077     {
00078         EventSender<EvType>::instance().registerListener(this);
00079         _registered = true;
00080     }
00081     
00082     //assert( EventSender<EvType>::isRegistered(this) ); 
00083 }
00084 
00085     
00086 #endif // LISTENER_CC_TEMPLATE
00087 
00088 
00089 

Generated on Sun Feb 16 16:56:21 2003 for C++ Event Handling Template Library by doxygen1.2.18