@@ -103,8 +103,7 @@ class InputRecord
103103
104104 InputRecord (std::vector<InputRoute> const & inputs,
105105 InputSpan& span,
106- ObjectCache& cache,
107- CallbackService& callbacks);
106+ ServiceRegistry&);
108107
109108 // / A deleter type to be used with unique_ptr, which can be marked that
110109 // / it does not own the underlying resource and thus should not delete it.
@@ -400,30 +399,32 @@ class InputRecord
400399 // and cache the deserialised object at the given id.
401400 auto path = fmt::format (" {}" , DataSpecUtils::describe (matcher));
402401 LOGP (info, " {}" , path);
403- auto cacheEntry = mCache .matcherToId .find (path);
404- if (cacheEntry == mCache .matcherToId .end ()) {
405- mCache .matcherToId .insert (std::make_pair (path, id));
402+ auto & cache = mRegistry .get <ObjectCache>();
403+ auto & callbacks = mRegistry .get <CallbackService>();
404+ auto cacheEntry = cache.matcherToId .find (path);
405+ if (cacheEntry == cache.matcherToId .end ()) {
406+ cache.matcherToId .insert (std::make_pair (path, id));
406407 std::unique_ptr<ValueT const , Deleter<ValueT const >> result (DataRefUtils::as<CCDBSerialized<ValueT>>(ref).release (), false );
407408 void * obj = (void *)result.get ();
408- mCallbacks (CallbackService::Id::CCDBDeserialised, (ConcreteDataMatcher&)matcher, (void *)obj);
409- mCache .idToObject [id] = obj;
409+ callbacks (CallbackService::Id::CCDBDeserialised, (ConcreteDataMatcher&)matcher, (void *)obj);
410+ cache .idToObject [id] = obj;
410411 LOGP (info, " Caching in {} ptr to {} ({})" , id.value , path, obj);
411412 return result;
412413 }
413414 auto & oldId = cacheEntry->second ;
414415 // The id in the cache is the same, let's simply return it.
415416 if (oldId.value == id.value ) {
416- std::unique_ptr<ValueT const , Deleter<ValueT const >> result ((ValueT const *)mCache .idToObject [id], false );
417+ std::unique_ptr<ValueT const , Deleter<ValueT const >> result ((ValueT const *)cache .idToObject [id], false );
417418 LOGP (info, " Returning cached entry {} for {} ({})" , id.value , path, (void *)result.get ());
418419 return result;
419420 }
420421 // The id in the cache is different. Let's destroy the old cached entry
421422 // and create a new one.
422- delete reinterpret_cast <ValueT*>(mCache .idToObject [oldId]);
423+ delete reinterpret_cast <ValueT*>(cache .idToObject [oldId]);
423424 std::unique_ptr<ValueT const , Deleter<ValueT const >> result (DataRefUtils::as<CCDBSerialized<ValueT>>(ref).release (), false );
424425 void * obj = (void *)result.get ();
425- mCallbacks (CallbackService::Id::CCDBDeserialised, (ConcreteDataMatcher&)matcher, (void *)obj);
426- mCache .idToObject [id] = obj;
426+ callbacks (CallbackService::Id::CCDBDeserialised, (ConcreteDataMatcher&)matcher, (void *)obj);
427+ cache .idToObject [id] = obj;
427428 LOGP (info, " Replacing cached entry {} with {} for {} ({})" , oldId.value , id.value , path, obj);
428429 oldId.value = id.value ;
429430 return result;
@@ -438,8 +439,6 @@ class InputRecord
438439 } else {
439440 // non-messageable objects for which serialization method can not be derived by type,
440441 // the operation depends on the transmitted serialization method
441- using DataHeader = o2::header::DataHeader;
442-
443442 auto header = DataRefUtils::getHeader<header::DataHeader*>(ref);
444443 auto method = header->payloadSerializationMethod ;
445444 if (method == o2::header::gSerializationMethodNone ) {
@@ -668,10 +667,9 @@ class InputRecord
668667 }
669668
670669 private:
671- ObjectCache& mCache ;
670+ ServiceRegistry& mRegistry ;
672671 std::vector<InputRoute> const & mInputsSchema ;
673672 InputSpan& mSpan ;
674- CallbackService& mCallbacks ;
675673};
676674
677675} // namespace o2::framework
0 commit comments