Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

event.h

00001 //-*- C++ -*-
00002 //
00003 #ifndef __LISTENER__event_h__
00004 #define __LISTENER__event_h__
00005 
00006 #include "common.h"
00007 #include "utils/gen_object.h"
00008 
00009 namespace listener { 
00010 
00011   class Publisher ;
00012 
00016   class IGSLISTENER Event: public basic::GenObject {
00017   public:
00018     Event() ;
00019     virtual ~Event() ;
00020     
00024     Publisher* get_source() const ;
00025 
00029     template <typename EVENT>
00030     bool is_of_type() {return (typeid(*this)==typeid(EVENT)) ;}
00031 
00035     template <typename EVENT>
00036     bool inherits_from() {return (dynamic_cast<EVENT*>(this)!=NULL) ;}
00037     
00038   private:
00039     friend class Publisher ;
00040     void set_publisher(Publisher* p) ;
00041     Publisher* publisher_ ;
00042     
00043   } ;
00044   typedef basic::SmartPointer<Event> Event_var ;
00045 
00046 
00050   template <typename EVENT>
00051   EVENT* duplicate_event(EVENT* e) {return new EVENT(*e) ;}
00052 
00053 
00054   inline Publisher* Event::get_source() const {
00055     return publisher_ ;
00056   }
00057 
00058 }
00059 
00060 #endif

Generated on Mon Jan 30 11:57:50 2006 for EventListener by  doxygen 1.3.9.1