| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# PropertyCallbackFunctor.h

Go to the documentation of this file.

    00001 /**********************************************************
    00002  * $Workfile: $
    00003  * $Revision: 1.2 $
    00004  * $Date: 2006/06/06 16:16:23 $
    00005  * $Author: hmd $
    00006  * $Archive: $
    00007  *
    00008  * Component Comment
    00009  * Copyright Notice
    00010  **********************************************************/
    00011
    00012 #ifndef INCLUDED_PROPERTYCALLBACKFUNCTOR_H
    00013 #define INCLUDED_PROPERTYCALLBACKFUNCTOR_H
    00014
    00015 /****************************
    00016  * C++ DECLARATION SECTION
    00017  *   Base Classes Sub-section
    00018  ****************************/
    00019
    00020 /* Standard C++ Class Headers */
    00021
    00022 /* Application C++ Class Headers */
    00023
    00024 /*************************************
    00025  * C++ DECLARATION SECTION
    00026  *   Collaborating Classes Sub-section
    00027  *************************************/
    00028
    00029 /* Standard C++ Class Declarations */
    00030
    00031 /* Application C++ Class Declarations */
    00032 class Property;
    00033
    00034
    00035 /*******************************
    00036  * CLASS DECLARATION SECTION
    00037  *   Class Interface Sub-section
    00038  *******************************/
    00039
    00040 class PropertyCallbackFunctor {
    00041
    00043 /* Static Members */
    00045
    00046 public:
    00047 // Data and Function Members for Collaborators.
    00048     // Data members
    00049     static const PropertyCallbackFunctor* const nullPropertyCallbackFunctorPointer;
    00051 /* Instance Members */
    00053
    00054 public:
    00055
    00056   // Data and Function Members for Collaborators.
    00057
    00058   // Constructors - None, abstract base class
    00059   // Destructor
    00060   virtual ~PropertyCallbackFunctor() {}
    00061
    00062   // Operators
    00063   virtual void operator() ( Property& ) const = 0;
    00064
    00065   virtual PropertyCallbackFunctor* clone() const = 0 ;
    00066
    00067 };
    00068
    00069 class PropertyCallbackPointerFunctor : public PropertyCallbackFunctor {
    00070
    00072 /* Static Members */
    00074
    00075 public:
    00076 // Data and Function Members for Collaborators.
    00077
    00078     // Typedefs, consts, and enums
    00079     typedef void ( * PtrToCallbackFunction ) ( Property& );
    00080
    00082 /* Instance Members */
    00084
    00085 public:
    00086   // Data and Function Members for Collaborators.
    00087
    00088   // Constructors
    00089   explicit PropertyCallbackPointerFunctor( PtrToCallbackFunction pCF )
    00090     : m_pCF( pCF ) { }
    00091   // Destructor - Compiler generated version will be Ok
    00092
    00093   // Operators
    00094   virtual void operator() ( Property& prop ) const
    00095   { m_pCF( prop ); }
    00096
    00097   virtual PropertyCallbackPointerFunctor* clone() const
    00098   { return new PropertyCallbackPointerFunctor(*this); } ;
    00099
    00100 private:
    00101 // Data and Function Members for This Class Implementation.
    00102
    00103     // Data members
    00104     PtrToCallbackFunction       m_pCF;
    00105
    00106 };
    00107
    00108
    00109 template< class T >
    00110 class PropertyCallbackMemberFunctor : public PropertyCallbackFunctor {
    00111
    00113 /* Static Members */
    00115
    00116 public:
    00117 // Data and Function Members for Collaborators.
    00118
    00119     // Typedefs, consts, and enums
    00120     typedef void ( T::* PtrToCallbackMember ) ( Property& );
    00121
    00123 /* Instance Members */
    00125
    00126 public:
    00127   // Data and Function Members for Collaborators.
    00128
    00129   // Constructors
    00130   explicit PropertyCallbackMemberFunctor( PtrToCallbackMember pCM, T* instance )
    00131     : m_pCM( pCM ), m_instance( instance ) { }
    00132   // Destructor - Compiler generated version will be Ok
    00133
    00134   // Operators
    00135   virtual void operator() ( Property& prop ) const
    00136   { ( m_instance->*m_pCM )( prop ); }
    00137
    00138   virtual  PropertyCallbackMemberFunctor* clone() const
    00139   { return new PropertyCallbackMemberFunctor(*this); }
    00140
    00141 private:
    00142 // Data and Function Members for This Class Implementation.
    00143
    00144     // Data members
    00145     PtrToCallbackMember m_pCM;
    00146     T*                  m_instance;
    00147
    00148 };
    00149
    00150 #endif  // INCLUDED_PROPERTYCALLBACKFUNCTOR_H