MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / getBindingCppParamType

Function getBindingCppParamType

Source/buildbindingccpp.go:1003–1050  ·  view source on GitHub ↗
(paramType string, paramClass string, NameSpace string, ClassIdentifier string, isInput bool)

Source from the content-addressed store, hash-verified

1001}
1002
1003func getBindingCppParamType(paramType string, paramClass string, NameSpace string, ClassIdentifier string, isInput bool) string {
1004
1005 paramNameSpace, paramClassName, _ := decomposeParamClassNameCPP(paramClass)
1006
1007 cppClassPrefix := "C"
1008 switch paramType {
1009 case "uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64", "single", "double":
1010 return fmt.Sprintf("%s_%s", NameSpace, paramType)
1011 case "string":
1012 return fmt.Sprintf("std::string")
1013 case "bool":
1014 return fmt.Sprintf("bool")
1015 case "pointer":
1016 return fmt.Sprintf("%s_pvoid", NameSpace)
1017 case "basicarray":
1018 cppBasicType := ""
1019 switch paramClass {
1020 case "uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64", "single", "double",
1021 "bool", "pointer":
1022 cppBasicType = getBindingCppParamType(paramClass, "", NameSpace, ClassIdentifier, isInput)
1023 default:
1024 log.Fatal("Invalid parameter type: ", paramClass)
1025 }
1026 if isInput {
1027 return fmt.Sprintf("C%sInputVector<%s>", ClassIdentifier, cppBasicType)
1028 }
1029 return fmt.Sprintf("std::vector<%s>", cppBasicType)
1030 case "structarray":
1031 typeName := paramNameSpace + "s"+paramClassName
1032 if isInput {
1033 return fmt.Sprintf("C%sInputVector<%s>", ClassIdentifier, typeName)
1034 }
1035 return fmt.Sprintf("std::vector<%s>", typeName)
1036 case "enum":
1037 return fmt.Sprintf(paramNameSpace + "e"+paramClassName)
1038 case "struct":
1039 return fmt.Sprintf(paramNameSpace + "s"+paramClassName)
1040 case "class", "optionalclass":
1041 if isInput {
1042 return fmt.Sprintf("%s%s%s%s *", paramNameSpace, cppClassPrefix, ClassIdentifier, paramClassName)
1043 }
1044 return fmt.Sprintf("%sP%s%s", paramNameSpace, ClassIdentifier, paramClassName)
1045 case "functiontype":
1046 return fmt.Sprintf(paramNameSpace + paramClassName)
1047 }
1048 log.Fatal("Invalid parameter type: ", paramType)
1049 return ""
1050}
1051
1052func getBindingCppVariableName(param ComponentDefinitionParam) string {
1053 switch param.ParamType {

Callers 2

writeDynamicCPPMethodFunction · 0.85

Calls 1

Tested by

no test coverage detected