MCPcopy Create free account
hub / github.com/MITK/MITK / FilterServiceReferences

Method FilterServiceReferences

Modules/CppMicroServices/src/usServiceHooks.cpp:105–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void ServiceHooks::FilterServiceReferences(ModuleContext* mc, const std::string& service,
106 const std::string& filter, std::vector<ServiceReferenceBase>& refs)
107{
108 std::vector<ServiceRegistrationBase> srl;
109 coreCtx->services.Get_unlocked(us_service_interface_iid<ServiceFindHook>(), srl);
110 if (!srl.empty())
111 {
112 ShrinkableVector<ServiceReferenceBase> filtered(refs);
113
114 std::sort(srl.begin(), srl.end());
115 for (std::vector<ServiceRegistrationBase>::reverse_iterator fhrIter = srl.rbegin(), fhrEnd = srl.rend();
116 fhrIter != fhrEnd; ++fhrIter)
117 {
118 ServiceReference<ServiceFindHook> sr = fhrIter->GetReference();
119 ServiceFindHook* const fh = reinterpret_cast<ServiceFindHook*>(sr.d->GetService(GetModuleContext()->GetModule()));
120 if (fh != nullptr)
121 {
122 try
123 {
124 fh->Find(mc, service, filter, filtered);
125 }
126 catch (const std::exception& e)
127 {
128 MITK_WARN << "Failed to call find hook #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
129 << ": " << e.what();
130 }
131 catch (...)
132 {
133 MITK_WARN << "Failed to call find hook #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
134 << ": unknown exception type";
135 }
136 }
137 }
138 }
139}
140
141void ServiceHooks::FilterServiceEventReceivers(const ServiceEvent& evt,
142 ServiceListeners::ServiceListenerEntries& receivers)

Callers 1

Get_unlockedMethod · 0.80

Calls 12

GetModuleContextFunction · 0.85
Get_unlockedMethod · 0.80
whatMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetReferenceMethod · 0.45
GetServiceMethod · 0.45
GetModuleMethod · 0.45
FindMethod · 0.45
ToStringMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected