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

Function buildDynamicCInitTableCode

Source/buildbindingccpp.go:266–298  ·  view source on GitHub ↗
(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, useStrictC bool)

Source from the content-addressed store, hash-verified

264}
265
266func buildDynamicCInitTableCode(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, useStrictC bool) error {
267 global := component.Global
268
269 nullPtrStr := "nullptr"
270 if (useStrictC) {
271 nullPtrStr = "NULL"
272 }
273
274 w.Writeln("if (pWrapperTable == %s)", nullPtrStr)
275 w.Writeln(" return %s_ERROR_INVALIDPARAM;", strings.ToUpper(NameSpace))
276 w.Writeln("")
277
278 w.Writeln("pWrapperTable->m_LibraryHandle = %s;", nullPtrStr)
279
280 for i := 0; i < len(component.Classes); i++ {
281 class := component.Classes[i]
282 for j := 0; j < len(class.Methods); j++ {
283 method := class.Methods[j]
284 w.Writeln("pWrapperTable->m_%s_%s = %s;", class.ClassName, method.MethodName, nullPtrStr)
285 }
286 }
287
288 global = component.Global
289 for j := 0; j < len(global.Methods); j++ {
290 method := global.Methods[j]
291 w.Writeln("pWrapperTable->m_%s = %s;", method.MethodName, nullPtrStr)
292 }
293
294 w.Writeln("")
295 w.Writeln("return %s_SUCCESS;", strings.ToUpper(NameSpace))
296
297 return nil
298}
299
300func buildDynamicCReleaseTableCode(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, initWrapperFunctionName string, useStrictC bool) error {
301 nullPtrStr := "nullptr"

Callers 2

buildCppHeaderFunction · 0.85

Calls 1

WritelnMethod · 0.80

Tested by

no test coverage detected