Loading...
Searching...
No Matches
Callback.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::Callback
28
29Description
30 Abstract class to handle automatic call-back registration with the
31 CallbackRegistry. Derive from this class and extend by adding the
32 appropriate callback functions.
33
34SourceFiles
35 Callback.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Callback_H
40#define Callback_H
41
42#include "CallbackRegistry.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class Callback Declaration
51\*---------------------------------------------------------------------------*/
52
53template<class CallbackType>
54class Callback
55:
56 public CallbackRegistry<CallbackType>::link
57{
58 // Private data
59
60 //- CallbackRegistry reference
62
63
64 // Private Member Functions
65
66 //- No copy assignment
67 void operator=(const Callback<CallbackType>&) = delete;
68
69
70public:
71
72 // Constructors
73
74 //- Construct and register with CallbackRegistry
76
77 //- Construct as copy
79
80
81 //- Destructor
82 virtual ~Callback();
83
84
85 // Member functions
86
87 // Registration
88
89 //- Register Callback with CallbackRegistry
90 bool checkIn();
91
92 //- Check-out Callback from CallbackRegistry
93 bool checkOut();
94};
95
96
97// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98
99} // End namespace Foam
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103#ifdef NoRepository
104 #include "Callback.C"
105#endif
106
107// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108
109#endif
110
111// ************************************************************************* //
Base class with which callbacks are registered.
virtual ~Callback()
Destructor.
Definition Callback.C:47
bool checkOut()
Check-out Callback from CallbackRegistry.
Definition Callback.C:69
Callback(CallbackRegistry< CallbackType > &)
Construct and register with CallbackRegistry.
Definition Callback.C:27
bool checkIn()
Register Callback with CallbackRegistry.
Definition Callback.C:56
Namespace for OpenFOAM.