SimpleITK  2.1.0
sitkCommand.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 sitkCommand_h
19 #define sitkCommand_h
20 
21 
22 #include "sitkCommon.h"
23 #include "sitkObjectOwnedBase.h"
24 
25 #include <set>
26 
27 namespace itk {
28 namespace simple {
29 
30 class ProcessObject;
31 
45 {
46 public:
48  Command();
49 
51  virtual ~Command() override;
52 
54  std::string
55  GetName() const override;
56  void
57  SetName(const std::string & n) override;
58 
60  virtual void
61  Execute();
62 
63 protected:
65 
66 #ifndef SWIG
67  // internal methods to maintain reference between ProcessObject and
68  // Command, so when either is destroyed, the other will be notified.
69  //
70  // Return value is the number of referenced process objects after
71  // operation.
72  virtual size_t
73  AddProcessObject(itk::simple::ProcessObject * o);
74  virtual size_t
75  RemoveProcessObject(const itk::simple::ProcessObject * o);
76 
77 #endif
78 };
79 
80 } // end namespace simple
81 } // end namespace itk
82 
83 #endif
sitkCommon.h
itk::simple::Command
An implementation of the Command design pattern for callback.
Definition: sitkCommand.h:44
sitkObjectOwnedBase.h
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::Command
class ITK_FORWARD_EXPORT Command
itk
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:51
itk::simple::ObjectOwnedBase
An abstract base class to connect this object with the lifetime of another.
Definition: sitkObjectOwnedBase.h:47