diff --git a/libraries/create_tf2_listener.sh b/libraries/create_tf2_listener.sh index 58ee0f5bd13bf4115407a60c25677c5574dd78ff..59686a3a194eff05cb6d6bfbbc1059a4a4bae61d 100644 --- a/libraries/create_tf2_listener.sh +++ b/libraries/create_tf2_listener.sh @@ -144,14 +144,36 @@ function create_tf2_listener # modify Node.cpp # #Add constructor - if [[ "${driver_alg}" = "driver" ]] + + line="${listener_name}(tf2_buffer)" + + #check if ':' are needed + comment="${class_name}::${class_name}(" + add_char=`grep "${comment}" "${node_c}" | grep " :"` + if [[ -z ${add_char} ]] then - comment="iri_base_driver::IriBaseNodeDriver<" + sed -i "/${comment}/s|$| :|" "${node_c}" + add_line_to_file "\ \ ${line}" "${comment}" "${node_c}" else - comment="algorithm_base::IriBaseAlgorithm<" + #check if it is an algorithm or a driver + if [[ ${driver_alg} == "alg" ]] + then + comment="::IriBaseAlgorithm<" + else + comment="::IriBaseNodeDriver<" + fi + #check if ',' is needed + add_char=`grep "${comment}" "${node_c}" | grep ","` + if [[ -z ${add_char} ]] + then + #add ',' to comment + sed -i "/${comment}/s|$|,|" "${node_c}" + add_line_to_file "\ \ ${line}" "${comment}" "${node_c}" + else + add_line_to_file "\ \ ${line}," "${comment}" "${node_c}" + fi fi - - line=",${listener_name}(tf2_buffer)" + add_line_to_file " ${line}" "${comment}" "${node_c}" #Add example