| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PropertyCallbackFunctor.h
Go to the documentation of this file.
1 /**********************************************************
2 * $Workfile: $
3 * $Revision: 1.2 $
4 * $Date: 2006/06/06 16:16:23 $
5 * $Author: hmd $
6 * $Archive: $
7 *
8 * Component Comment
9 * Copyright Notice
10 **********************************************************/
11
12 #ifndef INCLUDED_PROPERTYCALLBACKFUNCTOR_H
13 #define INCLUDED_PROPERTYCALLBACKFUNCTOR_H
14
15 #include "GaudiKernel/Kernel.h"
16
17 /****************************
18 * C++ DECLARATION SECTION
19 * Base Classes Sub-section
20 ****************************/
21
22 /* Standard C++ Class Headers */
23
24 /* Application C++ Class Headers */
25
26 /*************************************
27 * C++ DECLARATION SECTION
28 * Collaborating Classes Sub-section
29 *************************************/
30
31 /* Standard C++ Class Declarations */
32
33 /* Application C++ Class Declarations */
34 class Property;
35
36
37 /*******************************
38 * CLASS DECLARATION SECTION
39 * Class Interface Sub-section
40 *******************************/
41
42 class GAUDI_API PropertyCallbackFunctor {
43
45 /* Static Members */
47
48 public:
49 // Data and Function Members for Collaborators.
50 // Data members
51 static const PropertyCallbackFunctor* const nullPropertyCallbackFunctorPointer;
53 /* Instance Members */
55
56 public:
57
58 // Data and Function Members for Collaborators.
59
60 // Constructors - None, abstract base class
61 // Destructor
62 virtual ~PropertyCallbackFunctor() {}
63
64 // Operators
65 virtual void operator() ( Property& ) const = 0;
66
67 virtual PropertyCallbackFunctor* clone() const = 0 ;
68
69 };
70
71 class PropertyCallbackPointerFunctor : public PropertyCallbackFunctor {
72
74 /* Static Members */
76
77 public:
78 // Data and Function Members for Collaborators.
79
80 // Typedefs, consts, and enums
81 typedef void ( * PtrToCallbackFunction ) ( Property& );
82
84 /* Instance Members */
86
87 public:
88 // Data and Function Members for Collaborators.
89
90 // Constructors
91 explicit PropertyCallbackPointerFunctor( PtrToCallbackFunction pCF )
92 : m_pCF( pCF ) { }
93 // Destructor - Compiler generated version will be Ok
94
95 // Operators
96 virtual void operator() ( Property& prop ) const
97 { m_pCF( prop ); }
98
99 virtual PropertyCallbackPointerFunctor* clone() const
100 { return new PropertyCallbackPointerFunctor(*this); }
101
102 private:
103 // Data and Function Members for This Class Implementation.
104
105 // Data members
106 PtrToCallbackFunction m_pCF;
107
108 };
109
110
111 template< class T >
112 class PropertyCallbackMemberFunctor : public PropertyCallbackFunctor {
113
115 /* Static Members */
117
118 public:
119 // Data and Function Members for Collaborators.
120
121 // Typedefs, consts, and enums
122 typedef void ( T::* PtrToCallbackMember ) ( Property& );
123
125 /* Instance Members */
127
128 public:
129 // Data and Function Members for Collaborators.
130
131 // Constructors
132 explicit PropertyCallbackMemberFunctor( PtrToCallbackMember pCM, T* instance )
133 : m_pCM( pCM ), m_instance( instance ) { }
134 // Destructor - Compiler generated version will be Ok
135
136 // Operators
137 virtual void operator() ( Property& prop ) const
138 { ( m_instance->*m_pCM )( prop ); }
139
140 virtual PropertyCallbackMemberFunctor* clone() const
141 { return new PropertyCallbackMemberFunctor(*this); }
142
143 private:
144 // Data and Function Members for This Class Implementation.
145
146 // Data members
147 PtrToCallbackMember m_pCM;
148 T* m_instance;
149
150 };
151
152 #endif // INCLUDED_PROPERTYCALLBACKFUNCTOR_H