@@ -156,24 +156,28 @@ void IBaseModule::check_splitted_model() {
156156 }
157157}
158158
159- bool IBaseModule::check_bool_param (const std::string& param_name, const bool & default_value, const bool & requires ) {
160- auto p = requires ? get_param (param_name) : get_optional_param (param_name);
161- if (p.empty ()) {
162- return default_value;
163- }
164-
165- if (p == " true" || p == " True" || p == " TRUE" || p == " 1" ) {
166- GENAI_INFO (" Module[" + module_desc->name + " ]: " + param_name + " = true" );
159+ static bool str_to_bool (const std::string& str, bool default_value) {
160+ if (str == " true" || str == " True" || str == " TRUE" || str == " 1" ) {
167161 return true ;
168- } else if (p == " false" || p == " False" || p == " FALSE" || p == " 0" ) {
169- GENAI_INFO (" Module[" + module_desc->name + " ]: " + param_name + " = false" );
162+ } else if (str == " false" || str == " False" || str == " FALSE" || str == " 0" ) {
170163 return false ;
171164 }
172- GENAI_ERR (" Module[" + module_desc->name + " ]: Invalid bool param value for '" + param_name + " ': " + p +
173- " , use default value: " + (default_value ? " true" : " false" ));
174165 return default_value;
175166}
176167
168+ bool IBaseModule::check_bool_param (const std::string& param_name) {
169+ auto p = get_param (param_name);
170+ return str_to_bool (p, false );
171+ }
172+
173+ bool IBaseModule::check_bool_optional_param (const std::string& param_name, const bool & default_value) {
174+ auto p = get_optional_param (param_name);
175+ if (p.empty ()) {
176+ return default_value;
177+ }
178+ return str_to_bool (p, default_value);
179+ }
180+
177181// PipelineDesc implementation
178182PipelineDesc::PipelineDesc () : m_resource_cache(std::make_unique<PipelineResourceCache>()) {}
179183
0 commit comments