From 223ad98f85db070e2f763b4d32559053ee4f5a8f Mon Sep 17 00:00:00 2001 From: Nathan Woodward Date: Wed, 5 Jan 2022 15:42:23 +0000 Subject: [PATCH 1/2] Don't require cpp17 for clientimpl --- Source/buildimplementationcpp.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/buildimplementationcpp.go b/Source/buildimplementationcpp.go index 3d3ae1e5..343e7516 100644 --- a/Source/buildimplementationcpp.go +++ b/Source/buildimplementationcpp.go @@ -1786,6 +1786,7 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co for k := 0; k < len(method.Params); k++ { param := method.Params[k] variableName := getCppVariableName(param) + cppParamType := getCppParamType(param, NameSpace, true) switch param.ParamPass { case "in": @@ -1806,7 +1807,8 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co checkInputCode = append(checkInputCode, fmt.Sprintf(" throw %s (%s_ERROR_INVALIDPARAM);", exceptionType, strings.ToUpper(NameSpace))) callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName if (isClientImpl) { - callParameters = callParameters + fmt.Sprintf("%sInputVector(%s, n%sBufferSize)", ClassIdentifier, variableName, param.ParamName) + inputVecTypeParam := cppParamType[:len(cppParamType)-2] + callParameters = callParameters + fmt.Sprintf("%sInputVector<%s>(%s, n%sBufferSize)", ClassIdentifier, inputVecTypeParam, variableName, param.ParamName) } else { callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName } @@ -1814,7 +1816,8 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co checkInputCode = append(checkInputCode, fmt.Sprintf("if ( (!p%sBuffer) && (n%sBufferSize>0))", param.ParamName, param.ParamName)) checkInputCode = append(checkInputCode, fmt.Sprintf(" throw %s (%s_ERROR_INVALIDPARAM);", exceptionType, strings.ToUpper(NameSpace))) if (isClientImpl) { - callParameters = callParameters + fmt.Sprintf("%sInputVector(%s, n%sBufferSize)", ClassIdentifier, variableName, param.ParamName) + inputVecTypeParam := cppParamType[:len(cppParamType)-2] + callParameters = callParameters + fmt.Sprintf("%sInputVector<%s>(%s, n%sBufferSize)", ClassIdentifier, inputVecTypeParam, variableName, param.ParamName) } else { callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName } From 052c8b406d87b2c4806249a30c74341db993a388 Mon Sep 17 00:00:00 2001 From: Nathan Woodward Date: Wed, 5 Jan 2022 16:03:18 +0000 Subject: [PATCH 2/2] Fixed indentation and add comment --- Source/buildimplementationcpp.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/buildimplementationcpp.go b/Source/buildimplementationcpp.go index 343e7516..9cd2b9e0 100644 --- a/Source/buildimplementationcpp.go +++ b/Source/buildimplementationcpp.go @@ -1807,7 +1807,8 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co checkInputCode = append(checkInputCode, fmt.Sprintf(" throw %s (%s_ERROR_INVALIDPARAM);", exceptionType, strings.ToUpper(NameSpace))) callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName if (isClientImpl) { - inputVecTypeParam := cppParamType[:len(cppParamType)-2] + // note: slicing because we need to chop off the trailing " *". + inputVecTypeParam := cppParamType[:len(cppParamType)-2] callParameters = callParameters + fmt.Sprintf("%sInputVector<%s>(%s, n%sBufferSize)", ClassIdentifier, inputVecTypeParam, variableName, param.ParamName) } else { callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName @@ -1816,7 +1817,8 @@ func generatePrePostCallCPPFunctionCode(component ComponentDefinition, method Co checkInputCode = append(checkInputCode, fmt.Sprintf("if ( (!p%sBuffer) && (n%sBufferSize>0))", param.ParamName, param.ParamName)) checkInputCode = append(checkInputCode, fmt.Sprintf(" throw %s (%s_ERROR_INVALIDPARAM);", exceptionType, strings.ToUpper(NameSpace))) if (isClientImpl) { - inputVecTypeParam := cppParamType[:len(cppParamType)-2] + // note: slicing because we need to chop off the trailing " *". + inputVecTypeParam := cppParamType[:len(cppParamType)-2] callParameters = callParameters + fmt.Sprintf("%sInputVector<%s>(%s, n%sBufferSize)", ClassIdentifier, inputVecTypeParam, variableName, param.ParamName) } else { callParameters = callParameters + fmt.Sprintf("n%sBufferSize, ", param.ParamName) + variableName