FairMQProgOptions: add a method to check key existence

This commit is contained in:
Alexey Rybalchenko 2017-06-21 12:16:20 +02:00 committed by Mohammad Al-Turany
parent 4bc54ad32b
commit a60fac80d9
2 changed files with 6 additions and 1 deletions

View File

@ -102,6 +102,11 @@ class FairProgOptions
// convert value to string that corresponds to the key
std::string GetStringValue(const std::string& key);
int Count(const std::string& key) const
{
return fVarMap.count(key);
}
//restrict conversion to fundamental types
template<typename T>
T ConvertTo(const std::string& strValue)

View File

@ -25,7 +25,7 @@ template<typename TMQDevice>
inline int runStateMachine(TMQDevice& device, FairMQProgOptions& cfg)
{
device.RegisterChannelEndpoints();
if (cfg.GetValue<bool>("print-channels"))
if (cfg.Count("print-channels"))
{
device.PrintRegisteredChannels();
device.ChangeState(TMQDevice::END);