3 * @brief Defines TFunctor class
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
14 /*! @namespace <creaButtonContainer>
15 * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
17 namespace creaButtonContainer
19 /*! @namespace <creaButtonContainer::model>
20 * @brief Contains the implementation of the model in creaButtonContainer library.
21 * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
26 /*! @typedef std::string ButtonIDType;
27 * @brief Defines the ButtonIDType type.
29 typedef std::string ButtonIDType;
30 //end of typedef definition
31 /*! @class TFunctor functor.h "functor.h"
32 * @brief This is an abstract class for call_back functions.
37 // two possible functions to call member function. virtual cause derived
38 // classes will use a pointer to an object and a pointer to a member function
39 /*! @fn virtual void TFunctor::operator()( const ButtonIDType &buttonName )
40 * @brief To make the function call.
45 operator()( const ButtonIDType &buttonName )=0; // call using operator
47 * @brief Call using function.
52 Call( const ButtonIDType &buttonName )=0;
55 // derived template class
56 /*! @tparam <typename TClass>
57 * @brief TClass makes TConcreteFunctor usable for all Classes.
59 template< typename TClass >
60 /*! @class TConcreteFunctor: public TFunctor functor.h "functor.h"
61 * @brief This class allows to make call_back functions.
63 class TConcreteFunctor : public TFunctor
66 /*! @fn TConcreteFunctor::TConcreteFunctor( TClass* _pt2Object, void
67 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
68 * @brief This is the parameterized constructor.
69 * Takes pointer to an object and pointer to a member and stores them in two private variables
70 * @param _pt2Object Pointer to object.
71 * @param _fpt Pointer to the function.
72 * @param buttonName The ID of the button (ButtonName).
74 TConcreteFunctor( TClass* _pt2Object, void
75 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
76 // -------------------------------------------------------------------------------
77 /*! @fn virtual void TConcreteFunctor::operator()( const ButtonIDType &buttonName );
78 * @brief Override operator "()". Execute member function.
81 * @exception std::bad_alloc
84 operator()( const ButtonIDType &buttonName );
85 // -------------------------------------------------------------------------------
86 /*! @fn virtual void TConcreteFunctor::Call( const ButtonIDType &buttonName );
87 * @brief Override function "Call". Execute member function
90 * @exception std::bad_alloc
93 Call( const ButtonIDType &buttonName );
94 // -------------------------------------------------------------------------------
97 (TClass::*fpt)( const ButtonIDType &buttonName ); //! <void (TClass::*fpt) Pointer to member function.
98 TClass* pt2Object; //! <TClass* pointer to object.
104 //! @include "functor.txx"
105 #include "functor.txx"
107 #endif /* TFUNCTOR_H_ */