bool isKeyValid(std::map<std::string, bool> &valid_keys, const std::string &key);
void parse(std::map<std::string, bool> &valid_keys, std::string option);
void update();
- void setServiceName(std::string key);
- void setInputFeedType(std::string key);
- void setCameraDeviceId(std::string key);
- void setFps(std::string key);
- void setAsyncMode(std::string key);
- void setInputFormat(std::string key);
+ void setServiceName(const std::string &key);
+ void setInputFeedType(const std::string &key);
+ void setCameraDeviceId(const std::string &key);
+ void setFps(const std::string &key);
+ void setAsyncMode(const std::string &key);
+ void setInputFormat(const std::string &key);
public:
ServiceConfigParser() = default;
return true;
}
-void ServiceConfigParser::setServiceName(string key)
+void ServiceConfigParser::setServiceName(const string &key)
{
_service_name = key;
}
-void ServiceConfigParser::setInputFeedType(std::string key)
+void ServiceConfigParser::setInputFeedType(const std::string &key)
{
static map<string, InputFeedType> valid_services = {
{ "CAMERA", InputFeedType::CAMERA },
_input_feed_type = it->second;
}
-void ServiceConfigParser::setCameraDeviceId(std::string key)
+void ServiceConfigParser::setCameraDeviceId(const std::string &key)
{
_camera_config.device_id = std::stoi(key);
}
-void ServiceConfigParser::setFps(std::string key)
+void ServiceConfigParser::setFps(const std::string &key)
{
int fps = std::stoi(key);
if (fps < 1 || fps > 60)
_fps = fps;
}
-void ServiceConfigParser::setAsyncMode(std::string key)
+void ServiceConfigParser::setAsyncMode(const std::string &key)
{
int async_mode = std::stoi(key);
if (async_mode != 0 && async_mode != 1)
_async_mode = async_mode;
}
-void ServiceConfigParser::setInputFormat(string key)
+void ServiceConfigParser::setInputFormat(const string &key)
{
static map<string, ImagePixelFormat> valid_services = { { "YUV420", ImagePixelFormat::YUV420 },
{ "RGB888", ImagePixelFormat::RGB888 } };
void ServiceConfigParser::update()
{
- using setParamCallback = void (ServiceConfigParser::*)(std::string);
+ using setParamCallback = void (ServiceConfigParser::*)(const std::string &);
auto setParam = [this](const std::string &key, setParamCallback cb) -> void {
auto it = _params.find(key);