Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
usServiceListenerHook.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center (DKFZ)
6  All rights reserved.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  https://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 ============================================================================*/
21 
22 #ifndef USSERVICELISTENERHOOK_H
23 #define USSERVICELISTENERHOOK_H
24 
25 #include "usServiceInterface.h"
26 #include "usShrinkableVector.h"
27 #include "usSharedData.h"
28 
29 #include <string>
30 
32 
33 class ModuleContext;
34 class ServiceListenerEntry;
35 
47 struct US_Core_EXPORT ServiceListenerHook
48 {
49 
50  class ListenerInfoData;
51 
58  struct US_Core_EXPORT ListenerInfo
59  {
60  ListenerInfo();
61 
62  ListenerInfo(const ListenerInfo& other);
63 
64  ~ListenerInfo();
65 
66  ListenerInfo& operator=(const ListenerInfo& other);
67 
75  bool IsNull() const;
76 
83 
90  std::string GetFilter() const;
91 
111  bool IsRemoved() const;
112 
125  bool operator==(const ListenerInfo& other) const;
126 
127  private:
128 
129  friend class ServiceListenerEntry;
130 
131  US_HASH_FUNCTION_FRIEND(ServiceListenerHook::ListenerInfo);
132 
133  ListenerInfo(ListenerInfoData* data);
134 
135  ExplicitlySharedDataPointer<ListenerInfoData> d;
136  };
137 
138  virtual ~ServiceListenerHook();
139 
151  virtual void Added(const std::vector<ListenerInfo>& listeners) = 0;
152 
162  virtual void Removed(const std::vector<ListenerInfo>& listeners) = 0;
163 
164 };
165 
167 
169 US_HASH_FUNCTION_BEGIN(US_PREPEND_NAMESPACE(ServiceListenerHook::ListenerInfo))
170  return US_HASH_FUNCTION(const US_PREPEND_NAMESPACE(ServiceListenerHook::ListenerInfoData)*, arg.d.Data());
173 
174 #endif // USSERVICELISTENERHOOK_H
US_HASH_FUNCTION
US_MSVC_POP_WARNING US_HASH_FUNCTION_NAMESPACE_BEGIN return US_HASH_FUNCTION(us::ServiceRegistrationBasePrivate *, arg.d)
usServiceInterface.h
US_HASH_FUNCTION_FRIEND
#define US_HASH_FUNCTION_FRIEND(type)
Definition: usGlobalConfig.h:180
usShrinkableVector.h
ModuleContext
Definition: usModuleContext.h:91
US_HASH_FUNCTION_END
#define US_HASH_FUNCTION_END
Definition: usGlobalConfig.h:202
us::GetModuleContext
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Definition: usGetModuleContext.h:50
US_HASH_FUNCTION_NAMESPACE_BEGIN
#define US_HASH_FUNCTION_NAMESPACE_BEGIN
Definition: usGlobalConfig.h:184
US_HASH_FUNCTION_BEGIN
#define US_HASH_FUNCTION_BEGIN(type)
Definition: usGlobalConfig.h:197
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
US_BEGIN_NAMESPACE
#define US_BEGIN_NAMESPACE
Definition: usGlobalConfig.h:76
US_END_NAMESPACE
#define US_END_NAMESPACE
Definition: usGlobalConfig.h:77
US_PREPEND_NAMESPACE
#define US_PREPEND_NAMESPACE(name)
Definition: usGlobalConfig.h:74
US_HASH_FUNCTION_NAMESPACE_END
#define US_HASH_FUNCTION_NAMESPACE_END
Definition: usGlobalConfig.h:185
US_Core_EXPORT
#define US_Core_EXPORT
Definition: usCoreExport.h:21
usSharedData.h