diff --git a/include/transport/config.h b/include/transport/config.h index 7d01eaa0..903480e9 100644 --- a/include/transport/config.h +++ b/include/transport/config.h @@ -28,13 +28,13 @@ #include #include - +#define CONFIG_HAS_KEY(PTR, KEY) (*PTR).hasKey(KEY) #define CONFIG_STRING(PTR, KEY) (*PTR)[KEY].as() #define CONFIG_INT(PTR, KEY) (*PTR)[KEY].as() #define CONFIG_BOOL(PTR, KEY) (*PTR)[KEY].as() #define CONFIG_LIST(PTR, KEY) (*PTR)[KEY].as >() -#define CONFIG_VECTOR(PTR, KEY) (*PTR)[KEY].as >() -#define CONFIG_HAS_KEY(PTR, KEY) (*PTR).hasKey(KEY) +#define CONFIG_VECTOR(PTR, KEY) ((*PTR).hasKey(KEY) ? (*PTR)[KEY].as >() : std::vector()) + namespace Transport { diff --git a/spectrum_manager/src/managerconfig.h b/spectrum_manager/src/managerconfig.h index 933843c3..48ca15b8 100644 --- a/spectrum_manager/src/managerconfig.h +++ b/spectrum_manager/src/managerconfig.h @@ -68,6 +68,10 @@ class ManagerConfig { return m_variables[key]; } + bool hasKey(const std::string &key) { + return m_variables.find(key) != m_variables.end(); + } + /// Returns path to config file from which data were loaded. const std::string &getManagerConfigFile() { return m_file; }