mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
Fix PropertyHelper::AddType() to include event emitter creation
This commit is contained in:
parent
c515cbb3bf
commit
b905f517cc
|
@ -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<T>(p);
|
||||
return std::pair<std::string, std::string>{ss.str(), label};
|
||||
};
|
||||
fEventEmitters[std::type_index(typeid(T))] = [](const fair::mq::EventManager& em, const std::string& k, const Property& p) {
|
||||
em.Emit<PropertyChange, T>(k, boost::any_cast<T>(p));
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ConvertPropertyToString(const Property& p)
|
||||
|
@ -63,9 +66,9 @@ class PropertyHelper
|
|||
}
|
||||
}
|
||||
|
||||
static std::unordered_map<std::type_index, void(*)(const fair::mq::EventManager&, const std::string&, const fair::mq::Property&)> fEventEmitters;
|
||||
static std::unordered_map<std::type_index, void(*)(const fair::mq::EventManager&, const std::string&, const Property&)> fEventEmitters;
|
||||
private:
|
||||
static std::unordered_map<std::type_index, std::function<std::pair<std::string, std::string>(const fair::mq::Property&)>> fTypeInfos;
|
||||
static std::unordered_map<std::type_index, std::function<std::pair<std::string, std::string>(const Property&)>> fTypeInfos;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user