SimpleITK  
sitkFunctionCommand.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef sitkFunctionCommand_h
19#define sitkFunctionCommand_h
20
21
22#include "sitkCommand.h"
23
24#include <functional>
25
26namespace itk::simple
27{
28
34{
35public:
37
38
39 ~FunctionCommand() override;
40
42
43 void
44 Execute() override;
45
49 template <class T>
50 void
51 SetCallbackFunction(T * object, void (T::*pMemberFunction)())
52 {
53 m_Function = [object, pMemberFunction] { std::invoke(pMemberFunction, object); };
54 }
55
57 void
58 SetCallbackFunction(void (*pFunction)());
59
65 void
66 SetCallbackFunction(void (*pFunction)(void *), void * clientData);
67
69 void
70 SetCallbackFunction(const std::function<void()> &);
71
72private:
73 using FunctionObjectType = std::function<void()>;
75};
76
77} // namespace itk::simple
78
79#endif
Command()
Default Constructor.
std::function< void()> FunctionObjectType
void SetCallbackFunction(const std::function< void()> &)
void SetCallbackFunction(void(*pFunction)())
void SetCallbackFunction(void(*pFunction)(void *), void *clientData)
void SetCallbackFunction(T *object, void(T::*pMemberFunction)())
#define SITKCommon_EXPORT
Definition sitkCommon.h:41