mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
Out of line ProgOption::SetProperty for int and std::string
The specializations are common enough to show up in O2 compilation profiles and they are not time critical (once per run at max).
This commit is contained in:
parent
8fe95e644e
commit
41165cf16b
|
@ -448,3 +448,6 @@ void ProgOptions::PrintOptionsRaw() const
|
|||
}
|
||||
|
||||
} // namespace fair::mq
|
||||
|
||||
template void fair::mq::ProgOptions::SetProperty<std::string>(const std::string& key, std::string val);
|
||||
template void fair::mq::ProgOptions::SetProperty<int>(const std::string& key, int val);
|
||||
|
|
|
@ -129,17 +129,7 @@ class ProgOptions
|
|||
/// @param key
|
||||
/// @param val
|
||||
template<typename T>
|
||||
void SetProperty(const std::string& key, T val)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(fMtx);
|
||||
|
||||
SetVarMapValue<typename std::decay<T>::type>(key, val);
|
||||
|
||||
lock.unlock();
|
||||
|
||||
fEvents.Emit<fair::mq::PropertyChange, typename std::decay<T>::type>(key, val);
|
||||
fEvents.Emit<fair::mq::PropertyChangeAsString, std::string>(key, GetPropertyAsString(key));
|
||||
}
|
||||
void SetProperty(const std::string& key, T val);
|
||||
|
||||
/// @brief Updates an existing config property (or fails if it doesn't exist)
|
||||
/// @param key
|
||||
|
@ -275,5 +265,20 @@ class ProgOptions
|
|||
};
|
||||
|
||||
} // namespace fair::mq
|
||||
template <typename T>
|
||||
void fair::mq::ProgOptions::SetProperty(const std::string& key, T val)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(fMtx);
|
||||
|
||||
SetVarMapValue<typename std::decay<T>::type>(key, val);
|
||||
|
||||
lock.unlock();
|
||||
|
||||
fEvents.Emit<fair::mq::PropertyChange, typename std::decay<T>::type>(key, val);
|
||||
fEvents.Emit<fair::mq::PropertyChangeAsString, std::string>(key, GetPropertyAsString(key));
|
||||
}
|
||||
|
||||
extern template void fair::mq::ProgOptions::SetProperty<int>(const std::string& key, int val);
|
||||
extern template void fair::mq::ProgOptions::SetProperty<std::string>(const std::string& key, std::string val);
|
||||
|
||||
#endif /* FAIR_MQ_PROGOPTIONS_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user