mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
FairMQProgOptions: add a method to check key existence
This commit is contained in:
parent
4bc54ad32b
commit
a60fac80d9
|
@ -102,6 +102,11 @@ class FairProgOptions
|
||||||
// convert value to string that corresponds to the key
|
// convert value to string that corresponds to the key
|
||||||
std::string GetStringValue(const std::string& key);
|
std::string GetStringValue(const std::string& key);
|
||||||
|
|
||||||
|
int Count(const std::string& key) const
|
||||||
|
{
|
||||||
|
return fVarMap.count(key);
|
||||||
|
}
|
||||||
|
|
||||||
//restrict conversion to fundamental types
|
//restrict conversion to fundamental types
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T ConvertTo(const std::string& strValue)
|
T ConvertTo(const std::string& strValue)
|
||||||
|
|
|
@ -25,7 +25,7 @@ template<typename TMQDevice>
|
||||||
inline int runStateMachine(TMQDevice& device, FairMQProgOptions& cfg)
|
inline int runStateMachine(TMQDevice& device, FairMQProgOptions& cfg)
|
||||||
{
|
{
|
||||||
device.RegisterChannelEndpoints();
|
device.RegisterChannelEndpoints();
|
||||||
if (cfg.GetValue<bool>("print-channels"))
|
if (cfg.Count("print-channels"))
|
||||||
{
|
{
|
||||||
device.PrintRegisteredChannels();
|
device.PrintRegisteredChannels();
|
||||||
device.ChangeState(TMQDevice::END);
|
device.ChangeState(TMQDevice::END);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user