00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __SIGNALV2IMPLSERIOUS__
00023 #define __SIGNALV2IMPLSERIOUS__
00024
00025 #ifndef __SIGNALV2__
00026 #error "This is an internal implementation header. You are not allowed to include it directly!"
00027 #endif
00028
00029 #include "ConnectionHandler.hxx"
00030
00031 namespace SigSlot
00032 {
00033
00034 template < typename ParmType1, typename ParmType2 >
00035 class Signalv2 : public Signal
00036 {
00037 public:
00038 typedef typename CBL::Functor2<ParmType1,ParmType2> tCallbackType;
00039
00040 public:
00041
00042 virtual ~Signalv2()
00043 {
00044 mSuper.DestroyConnections();
00045 }
00046
00047
00048 void Connect( Slotv2<ParmType1,ParmType2>& slot )
00049 {
00050 Connection c( AssignConnection(), this );
00051
00052 mSuper.AddCallback( c.GetID(), &slot, slot.GetMethod() );
00053
00054 slot.Bind(c);
00055 }
00056
00057 void Emit( ParmType1 parm1, ParmType2 parm2 )
00058 {
00059 if ( mSuper.HasNoCallbacks() )
00060 return;
00061
00062 typename tSuperType::tCallList calls = mSuper.GetCalls();
00063 typename tSuperType::tCallIterator i = calls.begin();
00064 typename tSuperType::tCallIterator end = calls.end();
00065
00066 while ( i != end )
00067 {
00068 (*(*i))( parm1, parm2 );
00069 i++;
00070 }
00071
00072 }
00073
00074 void FreeConnection( Connection* pConnection )
00075 {
00076 mSuper.RemoveCall( pConnection->GetID() );
00077 FreeConnectionId( pConnection->GetID() );
00078 }
00079 private:
00080 typedef Signalv2<ParmType1,ParmType2> tSignalType;
00081 typedef ConnectionHandler<tSignalType > tSuperType;
00082
00083 tSuperType mSuper;
00084 };
00085
00086 }
00087
00088
00089 #endif // Signalv2ImplSerious.hxx
00090