mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +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
e6aad7bfa7
|
@ -448,3 +448,6 @@ void ProgOptions::PrintOptionsRaw() const
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace fair::mq
|
} // 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 key
|
||||||
/// @param val
|
/// @param val
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void SetProperty(const std::string& key, T val)
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Updates an existing config property (or fails if it doesn't exist)
|
/// @brief Updates an existing config property (or fails if it doesn't exist)
|
||||||
/// @param key
|
/// @param key
|
||||||
|
@ -275,5 +265,20 @@ class ProgOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fair::mq
|
} // 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 */
|
#endif /* FAIR_MQ_PROGOPTIONS_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user