3 * @brief Implements TFunctor class and it propose is Call_Back Functions
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 namespace creaButtonContainer
12 // constructor - takes pointer to an object and pointer to a member and stores
13 // them in two private variables
14 // -------------------------------------------------------------------------------
15 template< typename TClass >
16 TConcreteFunctor< TClass >::TConcreteFunctor( TClass* _pt2Object, void
17 (TClass::*_fpt)( const ButtonIDType &buttonName ) )
19 this->pt2Object = _pt2Object;
22 // -------------------------------------------------------------------------------
23 // override operator "()" // execute member functions
24 template< typename TClass >
26 TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName )
30 ( *pt2Object.*fpt )( buttonName );
32 catch ( const std::exception& e )
34 std::cerr<< "TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName )"
35 <<" exception: " << e.what( ) << std::endl;
38 // -------------------------------------------------------------------------------
39 // override function "Call" // execute member function
40 template< typename TClass >
42 TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName )
46 ( *pt2Object.*fpt )( buttonName );
48 catch ( const std::exception& e )
50 std::cerr<< "TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName )"
51 <<" exception: " << e.what( ) << std::endl;