From: Inki Dae Date: Wed, 19 Jun 2024 07:43:18 +0000 (+0900) Subject: services: use const std::string &key X-Git-Tag: accepted/tizen/unified/20240903.110722~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2db3c395d353d95b71ea361a9e4722b726ea188;p=platform%2Fcore%2Fapi%2Fsingleo.git services: use const std::string &key Just code cleanup by using const std::string &key intead of just std::string key as an paramter of setXXX function in ServiceConfigParser class. Change-Id: I02bf6a9ff60673f0621ea683870c983ab37a5c0f Signed-off-by: Inki Dae --- diff --git a/services/common/include/ServiceConfigParser.h b/services/common/include/ServiceConfigParser.h index 3586dc0..83d2cc1 100644 --- a/services/common/include/ServiceConfigParser.h +++ b/services/common/include/ServiceConfigParser.h @@ -44,12 +44,12 @@ private: bool isKeyValid(std::map &valid_keys, const std::string &key); void parse(std::map &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; diff --git a/services/common/include/ServiceFactory.h b/services/common/include/ServiceFactory.h index 81f60c1..8ab2b6a 100644 --- a/services/common/include/ServiceFactory.h +++ b/services/common/include/ServiceFactory.h @@ -31,7 +31,7 @@ namespace services class ServiceFactory { public: - using createFunc = IService *(*)(); + using createFunc = IService *(*) (); static ServiceFactory &instance() { diff --git a/services/common/src/ServiceConfigParser.cpp b/services/common/src/ServiceConfigParser.cpp index aa794a0..6119ef5 100644 --- a/services/common/src/ServiceConfigParser.cpp +++ b/services/common/src/ServiceConfigParser.cpp @@ -52,12 +52,12 @@ bool ServiceConfigParser::isKeyValid(map &valid_keys, const string 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 valid_services = { { "CAMERA", InputFeedType::CAMERA }, @@ -71,12 +71,12 @@ void ServiceConfigParser::setInputFeedType(std::string key) _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) @@ -85,7 +85,7 @@ void ServiceConfigParser::setFps(std::string key) _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) @@ -94,7 +94,7 @@ void ServiceConfigParser::setAsyncMode(std::string key) _async_mode = async_mode; } -void ServiceConfigParser::setInputFormat(string key) +void ServiceConfigParser::setInputFormat(const string &key) { static map valid_services = { { "YUV420", ImagePixelFormat::YUV420 }, { "RGB888", ImagePixelFormat::RGB888 } }; @@ -184,7 +184,7 @@ void ServiceConfigParser::parseInput(std::string option) 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);