Slotv0.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-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 __SLOTV0__
00023 #define __SLOTV0__
00024 
00025 #include "Slot.hxx"
00026 #include "CBL.hxx"
00027 //#include "Assert.hxx"
00028 
00029 namespace SigSlot
00030 {
00031 
00032         class Slotv0 : public Slot
00033         {
00034                 typedef CBL::Functor0 WrappedFuncType;
00035   
00036         public:
00037   
00038                 Slotv0()
00039                         : mIsInit( false )
00040                 {
00041                 }
00042 
00043                 virtual ~Slotv0()
00044                 {
00045                 }
00046   
00047                 template < class RefType, typename PtrMember >
00048                 void Wrap( RefType thisRef, PtrMember pMember )
00049                 {
00050                         mFunctor = CBL::makeFunctor( (CBL::Functor0*)0, *thisRef, pMember );
00051                         mIsInit = true;
00052                 }
00053   
00054                 template <  typename PtrMember >
00055                 void Wrap( PtrMember pMember )
00056                 {
00057                         mFunctor = CBL::makeFunctor( (CBL::Functor0*)0, pMember );
00058                         mIsInit = true;
00059                 }
00060   
00061 
00062                 const WrappedFuncType& GetMethod() const
00063                 {
00064                         //CLAM_ASSERT( mIsInit, "Must be initialized" );
00065                         return mFunctor;
00066                 }
00067   
00068                 void operator()( )
00069                 {
00070                         //CLAM_ASSERT( mIsInit, "Must be initialized" );
00071                         mFunctor(  );
00072                 }
00073   
00074         private:
00075   
00076                 WrappedFuncType   mFunctor;
00077                 bool              mIsInit;
00078   
00079         };
00080 
00081 }
00082 
00083 #endif // Slotv0.hxx
00084 
Generated by  doxygen 1.6.3