From b905f517cc34b436604486276c2563be87c53ad3 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Thu, 6 Jun 2019 15:40:41 +0200 Subject: [PATCH] Fix PropertyHelper::AddType() to include event emitter creation --- fairmq/Properties.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fairmq/Properties.h b/fairmq/Properties.h index b25df9f6..15649100 100644 --- a/fairmq/Properties.h +++ b/fairmq/Properties.h @@ -41,11 +41,14 @@ class PropertyHelper if (label == "") { label = boost::core::demangle(typeid(T).name()); } - fTypeInfos[std::type_index(typeid(T))] = [label](const fair::mq::Property& p) { + fTypeInfos[std::type_index(typeid(T))] = [label](const Property& p) { std::stringstream ss; ss << boost::any_cast(p); return std::pair{ss.str(), label}; }; + fEventEmitters[std::type_index(typeid(T))] = [](const fair::mq::EventManager& em, const std::string& k, const Property& p) { + em.Emit(k, boost::any_cast(p)); + }; } static std::string ConvertPropertyToString(const Property& p) @@ -63,9 +66,9 @@ class PropertyHelper } } - static std::unordered_map fEventEmitters; + static std::unordered_map fEventEmitters; private: - static std::unordered_map(const fair::mq::Property&)>> fTypeInfos; + static std::unordered_map(const Property&)>> fTypeInfos; }; }