1 /************************************************************************************//*!
2 * Name: @file functor.h
3 * Purpose: @brief defines TFunctor class
4 * Author: @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 ***************************************************************************************/
16 //! @namespace <creaButtonContainer>
17 namespace creaButtonContainer
19 //! @namespace <model>
22 /*! @typedef std::string ButtonIDType;
23 * @brief Defines the ButtonIDType type.
25 typedef std::string ButtonIDType;
27 /*! @class TFunctor functor.h "functor.h"
28 * @brief This is an abstract class for call_back functions.
33 // two possible functions to call member function. virtual cause derived
34 // classes will use a pointer to an object and a pointer to a member function
35 /*! @fn virtual void TFunctor::operator()( const ButtonIDType &buttonName )
36 * @brief To make the function call.
41 operator()( const ButtonIDType &buttonName )=0; // call using operator
43 * @brief Call using function.
48 Call( const ButtonIDType &buttonName )=0;
51 // derived template class
52 /*! @tparam <typename TClass>
53 * @brief It makes TConcreteFunctor usable for all Classes.
55 template< typename TClass >
56 /*! @class TConcreteFunctor: public TFunctor functor.h "functor.h"
57 * @brief This class contains the ButtonContainer factory.
58 * This class describes the factory of the ButtonContainer using design patterns.
60 class TConcreteFunctor : public TFunctor
63 /*! @fn TConcreteFunctor::TConcreteFunctor( TClass* _pt2Object, void
64 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
65 * @brief This is the parameterized constructor.
66 * Takes pointer to an object and pointer to a member and stores them in two private variables
67 * @param _pt2Object Pointer to object.
68 * @param _fpt Pointer to the function.
69 * @param buttonName The ID of the button (ButtonName).
71 TConcreteFunctor( TClass* _pt2Object, void
72 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
73 // -------------------------------------------------------------------------------
74 /*! @fn virtual void TConcreteFunctor::operator()( const ButtonIDType &buttonName );
75 * @brief Override operator "()". Execute member function.
80 operator()( const ButtonIDType &buttonName );
81 // -------------------------------------------------------------------------------
82 /*! @fn virtual void TConcreteFunctor::Call( const ButtonIDType &buttonName );
83 * @brief Override function "Call". Execute member function
88 Call( const ButtonIDType &buttonName );
89 // -------------------------------------------------------------------------------
91 void (TClass::*fpt)( const ButtonIDType &buttonName ); //! <void (TClass::*fpt) Pointer to member function.
92 TClass* pt2Object; //! <TClass* pointer to object.
98 //! @include "functor.txx"
99 #include "functor.txx"
101 #endif /* TFUNCTOR_H_ */