Slotv4.hxx
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef __SLOTV4__
00023 #define __SLOTV4__
00024 
00025 #include "Slot.hxx"
00026 #include "CBL.hxx"
00027 #include "Assert.hxx"
00028 
00029 namespace SigSlot
00030 {
00031 
00032 template < typename ParmType1, typename ParmType2, typename ParmType3, typename ParmType4 >
00033 class Slotv4 : public Slot
00034 {
00035                 typedef CBL::Functor4<ParmType1, ParmType2, ParmType3, ParmType4> WrappedFuncType;
00036 
00037 public:
00038 
00039                 Slotv4()
00040                                 : mIsInit( false )
00041                 {
00042                 }
00043 
00044                 virtual ~Slotv4()
00045                 {
00046                 }
00047 
00048                 template < class RefType, typename PtrMember >
00049                 void Wrap( RefType thisRef, PtrMember pMember )
00050                 {
00051                                 mFunctor = CBL::makeFunctor( (CBL::Functor4<ParmType1,ParmType2,ParmType3,ParmType4>*)0, *thisRef, pMember );
00052                                 mIsInit = true;
00053                 }
00054 
00055                 template <  typename PtrMember >
00056                 void Wrap( PtrMember pMember )
00057                 {
00058                                 mFunctor = CBL::makeFunctor( (CBL::Functor4<ParmType1,ParmType2,ParmType3,ParmType4>*)0, pMember );
00059                                 mIsInit = true;
00060                 }
00061 
00062 
00063                 const WrappedFuncType& GetMethod() const
00064                 {
00065                                 CLAM_ASSERT( mIsInit, "Must be initialized" );
00066                                 return mFunctor;
00067                 }
00068 
00069                 void operator()( ParmType1 parm1, ParmType2 parm2, ParmType3 parm3, ParmType4 parm4 )
00070                 {
00071                                 CLAM_ASSERT( mIsInit, "Must be initialized" );
00072                                 mFunctor( parm1, parm2, parm3, parm4 );
00073                 }
00074 
00075 private:
00076 
00077                 WrappedFuncType   mFunctor;
00078                 bool              mIsInit;
00079 
00080 };
00081 
00082 }
00083 
00084 #endif // SlottedMethod.hxx
00085