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 
43 
45 /* Static Members */
47 
48 public:
49 // Data and Function Members for Collaborators.
50  // Data members
53 /* Instance Members */
55 
56 public:
57 
58  // Data and Function Members for Collaborators.
59 
60  // Constructors - None, abstract base class
61  // Destructor
63 
64  // Operators
65  virtual void operator() ( Property& ) const = 0;
66 
67  virtual PropertyCallbackFunctor* clone() const = 0 ;
68 
69 };
70 
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
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 
100  { return new PropertyCallbackPointerFunctor(*this); }
101 
102 private:
103 // Data and Function Members for This Class Implementation.
104 
105  // Data members
107 
108 };
109 
110 
111 template< class T >
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
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 
141  { return new PropertyCallbackMemberFunctor(*this); }
142 
143 private:
144 // Data and Function Members for This Class Implementation.
145 
146  // Data members
149 
150 };
151 
152 #endif // INCLUDED_PROPERTYCALLBACKFUNCTOR_H
virtual void operator()(Property &prop) const
void(T::* PtrToCallbackMember)(Property &)
PropertyCallbackMemberFunctor(PtrToCallbackMember pCM, T *instance)
static const PropertyCallbackFunctor *const nullPropertyCallbackFunctorPointer
virtual PropertyCallbackMemberFunctor * clone() const
virtual void operator()(Property &prop) const
virtual PropertyCallbackPointerFunctor * clone() const
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
PropertyCallbackPointerFunctor(PtrToCallbackFunction pCF)
#define GAUDI_API
Definition: Kernel.h:108