00001 #ifndef _UNEVT_EventPtrT_H_ // -*-c++-*-
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef __GNUG__
00022 # pragma interface
00023 #endif
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _UNEVT_EventPtr_H_
00037 # include <UniEvent/EventPtr.h>
00038 #endif
00039 #ifndef _UNEVT_Event_H_
00040 # include <UniEvent/Event.h>
00041 #endif
00042
00043 #define _UNEVT_EventPtrT_H_
00044
00045 namespace strmod {
00046 namespace unievent {
00047
00048 template <class Event_t>
00049 class EventPtrT : virtual public EventPtr
00050 {
00051 public:
00052 typedef EventPtr super1;
00053 typedef lcore::RefCountPtrT<Event_t> refctr_t;
00054
00055 EventPtrT(EventPtrT<Event_t> &b) : super1(b) { }
00056 EventPtrT(refctr_t &b) : super1(b.GetPtr()) { }
00057 EventPtrT(Event_t *eptr = 0) : super1(eptr) { }
00058
00059 inline Event_t &operator *() const;
00060 inline Event_t *operator ->() const;
00061
00062 inline Event_t *GetPtr() const;
00063
00064 inline const EventPtrT<Event_t> &operator =(const EventPtrT<Event_t> &b);
00065 inline const EventPtrT<Event_t> &operator =(const refctr_t &b);
00066 inline const EventPtrT<Event_t> &operator =(Event_t *b);
00067
00068 protected:
00069 inline virtual lcore::ReferenceCounting *
00070 i_CheckType(lcore::ReferenceCounting *p) const;
00071 };
00072
00073
00074
00075 template <class Event_t>
00076 inline Event_t &EventPtrT<Event_t>::operator *() const
00077 {
00078 return(*GetPtr());
00079 }
00080
00081 template <class Event_t>
00082 inline Event_t *EventPtrT<Event_t>::operator ->() const
00083 {
00084 return(GetPtr());
00085 }
00086
00087 template <class Event_t>
00088 inline Event_t *EventPtrT<Event_t>::GetPtr() const
00089 {
00090 return(static_cast<Event_t *>(super1::GetPtr()));
00091 }
00092
00093 template <class Event_t>
00094 inline const EventPtrT<Event_t> &
00095 EventPtrT<Event_t>::operator =(const EventPtrT<Event_t> &b)
00096 {
00097 super1::operator =(b);
00098 return(*this);
00099 }
00100
00101 template <class Event_t>
00102 inline const EventPtrT<Event_t> &
00103 EventPtrT<Event_t>::operator =(const refctr_t &b)
00104 {
00105 super1::operator =(b.GetPtr());
00106 return(*this);
00107 }
00108
00109 template <class Event_t>
00110 inline const EventPtrT<Event_t> &
00111 EventPtrT<Event_t>::operator =(Event_t *b)
00112 {
00113 super1::operator =(b);
00114 return(*this);
00115 }
00116
00117 template <class Event_t>
00118 inline lcore::ReferenceCounting *
00119 EventPtrT<Event_t>::i_CheckType(lcore::ReferenceCounting *p) const
00120 {
00121 return(((p != 0) && p->AreYouA(Event::identifier)) ? p : 0);
00122 }
00123
00124 }
00125 }
00126
00127 #endif