3 * @brief Defines TFunctor class
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
13 /*! @namespace <creaButtonContainer>
14 * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
16 namespace creaButtonContainer
18 /*! @namespace <creaButtonContainer::model>
19 * @brief Contains the implementation of the model in creaButtonContainer library.
20 * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
25 /*! @typedef std::string ButtonIDType;
26 * @brief Defines the ButtonIDType type.
28 typedef std::string ButtonIDType;
29 //end of typedef definition
30 /*! @class TFunctor functor.h "functor.h"
31 * @brief This is an abstract class for call_back functions.
36 // two possible functions to call member function. virtual cause derived
37 // classes will use a pointer to an object and a pointer to a member function
38 /*! @fn virtual void TFunctor::operator()( const ButtonIDType &buttonName )
39 * @brief To make the function call.
44 operator()( const ButtonIDType &buttonName )=0; // call using operator
46 * @brief Call using function.
51 Call( const ButtonIDType &buttonName )=0;
54 // derived template class
55 /*! @tparam <typename TClass>
56 * @brief TClass makes TConcreteFunctor usable for all Classes.
58 template< typename TClass >
59 /*! @class TConcreteFunctor: public TFunctor functor.h "functor.h"
60 * @brief This class allows to make call_back functions.
62 class TConcreteFunctor : public TFunctor
65 /*! @fn TConcreteFunctor::TConcreteFunctor( TClass* _pt2Object, void
66 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
67 * @brief This is the parameterized constructor.
68 * Takes pointer to an object and pointer to a member and stores them in two private variables
69 * @param _pt2Object Pointer to object.
70 * @param _fpt Pointer to the function.
71 * @param buttonName The ID of the button (ButtonName).
73 TConcreteFunctor( TClass* _pt2Object, void
74 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
75 // -------------------------------------------------------------------------------
76 /*! @fn virtual void TConcreteFunctor::operator()( const ButtonIDType &buttonName );
77 * @brief Override operator "()". Execute member function.
80 * @exception std::bad_alloc
83 operator()( const ButtonIDType &buttonName );
84 // -------------------------------------------------------------------------------
85 /*! @fn virtual void TConcreteFunctor::Call( const ButtonIDType &buttonName );
86 * @brief Override function "Call". Execute member function
89 * @exception std::bad_alloc
92 Call( const ButtonIDType &buttonName );
93 // -------------------------------------------------------------------------------
96 (TClass::*fpt)( const ButtonIDType &buttonName ); //! <void (TClass::*fpt) Pointer to member function.
97 TClass* pt2Object; //! <TClass* pointer to object.
103 //! @include "functor.txx"
104 #include "functor.txx"
106 #endif /* TFUNCTOR_H_ */