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

Function buildDynamicCCPPHeader

Source/buildbindingccpp.go:174–264  ·  view source on GitHub ↗
(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string,
	headerOnly bool, useCPPTypes bool)

Source from the content-addressed store, hash-verified

172}
173
174func buildDynamicCCPPHeader(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string,
175 headerOnly bool, useCPPTypes bool) error {
176
177 sIncludeGuard := "__" + strings.ToUpper(NameSpace) + "_DYNAMICHEADER"
178 if useCPPTypes {
179 sIncludeGuard += "_CPPTYPES"
180 }
181 w.Writeln("#ifndef %s", sIncludeGuard)
182 w.Writeln("#define %s", sIncludeGuard)
183 w.Writeln("")
184
185 if useCPPTypes {
186 w.Writeln("#include \"%s_types.hpp\"", BaseName)
187 } else {
188 w.Writeln("#include \"%s_types.h\"", BaseName)
189 }
190 w.Writeln("")
191 for _, subComponent := range(component.ImportedComponentDefinitions) {
192 w.Writeln("#include \"%s_types.hpp\"", subComponent.BaseName)
193 }
194 w.Writeln("")
195
196 for i := 0; i < len(component.Classes); i++ {
197 class := component.Classes[i]
198
199 w.Writeln("")
200 w.Writeln("/*************************************************************************************************************************")
201 w.Writeln(" Class definition for %s", class.ClassName)
202 w.Writeln("**************************************************************************************************************************/")
203
204 for j := 0; j < len(class.Methods); j++ {
205 method := class.Methods[j]
206 WriteCCPPAbiMethod(method, w, NameSpace, class.ClassName, false, true, useCPPTypes)
207 }
208 }
209
210 w.Writeln("")
211 w.Writeln("/*************************************************************************************************************************")
212 w.Writeln(" Global functions")
213 w.Writeln("**************************************************************************************************************************/")
214
215 global := component.Global
216 for j := 0; j < len(global.Methods); j++ {
217 method := global.Methods[j]
218 err := WriteCCPPAbiMethod(method, w, NameSpace, "Wrapper", true, true, useCPPTypes)
219 if err != nil {
220 return err
221 }
222 }
223
224 w.Writeln("")
225 w.Writeln("/*************************************************************************************************************************")
226 w.Writeln(" Function Table Structure")
227 w.Writeln("**************************************************************************************************************************/")
228 w.Writeln("")
229 w.Writeln("typedef struct {")
230 w.Writeln(" void * m_LibraryHandle;")
231

Callers 2

BuildBindingCExplicitFunction · 0.85
BuildBindingCppExplicitFunction · 0.85

Calls 2

WriteCCPPAbiMethodFunction · 0.85
WritelnMethod · 0.80

Tested by

no test coverage detected