1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
28 * @brief Defines TFunctor class
29 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
39 /*! @namespace <creaButtonContainer>
40 * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
42 namespace creaButtonContainer
44 /*! @namespace <creaButtonContainer::model>
45 * @brief Contains the implementation of the model in creaButtonContainer library.
46 * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
51 /*! @typedef std::string ButtonIDType;
52 * @brief Defines the ButtonIDType type.
54 typedef std::string ButtonIDType;
55 //end of typedef definition
56 /*! @class TFunctor functor.h "functor.h"
57 * @brief This is an abstract class for call_back functions.
62 // two possible functions to call member function. virtual cause derived
63 // classes will use a pointer to an object and a pointer to a member function
64 /*! @fn virtual void TFunctor::operator()( const ButtonIDType &buttonName )
65 * @brief To make the function call.
70 operator()( const ButtonIDType &buttonName )=0; // call using operator
72 * @brief Call using function.
77 Call( const ButtonIDType &buttonName )=0;
80 // derived template class
81 /*! @tparam <typename TClass>
82 * @brief TClass makes TConcreteFunctor usable for all Classes.
84 template< typename TClass >
85 /*! @class TConcreteFunctor: public TFunctor functor.h "functor.h"
86 * @brief This class allows to make call_back functions.
88 class TConcreteFunctor : public TFunctor
91 /*! @fn TConcreteFunctor::TConcreteFunctor( TClass* _pt2Object, void
92 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
93 * @brief This is the parameterized constructor.
94 * Takes pointer to an object and pointer to a member and stores them in two private variables
95 * @param _pt2Object Pointer to object.
96 * @param _fpt Pointer to the function.
97 * @param buttonName The ID of the button (ButtonName).
99 TConcreteFunctor( TClass* _pt2Object, void
100 (TClass::*_fpt)( const ButtonIDType &buttonName ) );
101 // -------------------------------------------------------------------------------
102 /*! @fn virtual void TConcreteFunctor::operator()( const ButtonIDType &buttonName );
103 * @brief Override operator "()". Execute member function.
106 * @exception std::bad_alloc
109 operator()( const ButtonIDType &buttonName );
110 // -------------------------------------------------------------------------------
111 /*! @fn virtual void TConcreteFunctor::Call( const ButtonIDType &buttonName );
112 * @brief Override function "Call". Execute member function
115 * @exception std::bad_alloc
118 Call( const ButtonIDType &buttonName );
119 // -------------------------------------------------------------------------------
122 (TClass::*fpt)( const ButtonIDType &buttonName ); //! <void (TClass::*fpt) Pointer to member function.
123 TClass* pt2Object; //! <TClass* pointer to object.
129 //! @include "functor.txx"
130 #include "functor.txx"
132 #endif /* TFUNCTOR_H_ */