Slotv3.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef __SLOTV3__
00023 #define __SLOTV3__
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 >
00033 class Slotv3 : public Slot
00034 {
00035                 typedef CBL::Functor3<ParmType1, ParmType2, ParmType3> WrappedFuncType;
00036 
00037 public:
00038 
00039                 Slotv3()
00040                                 : mIsInit( false )
00041                 {
00042                 }
00043 
00044                 virtual ~Slotv3()
00045                 {
00046                 }
00047 
00048                 template < class RefType, typename PtrMember >
00049                 void Wrap( RefType thisRef, PtrMember pMember )
00050                 {
00051                                 mFunctor = CBL::makeFunctor( (CBL::Functor3<ParmType1,ParmType2,ParmType3>*)0, *thisRef, pMember );
00052                                 mIsInit = true;
00053                 }
00054 
00055                 template <  typename PtrMember >
00056                 void Wrap( PtrMember pMember )
00057                 {
00058                                 mFunctor = CBL::makeFunctor( (CBL::Functor3<ParmType1,ParmType2,ParmType3>*)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 )
00070                 {
00071                                 CLAM_ASSERT( mIsInit, "Must be initialized" );
00072                                 mFunctor( parm1, parm2, parm3 );
00073                 }
00074 
00075 private:
00076 
00077                 WrappedFuncType   mFunctor;
00078                 bool              mIsInit;
00079 
00080 };
00081 
00082 }
00083 
00084 #endif // SlottedMethod.hxx
00085 
Generated by  doxygen 1.6.3