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

Function writeCPPInputVector

Source/buildbindingccpp.go:949–990  ·  view source on GitHub ↗
(w LanguageWriter, NameSpace string, ClassIdentifier string)

Source from the content-addressed store, hash-verified

947}
948
949func writeCPPInputVector(w LanguageWriter, NameSpace string, ClassIdentifier string) error {
950 w.Writeln("/*************************************************************************************************************************")
951 w.Writeln(" Class C%sInputVector", ClassIdentifier)
952 w.Writeln("**************************************************************************************************************************/")
953 w.Writeln("template <typename T>")
954 w.Writeln("class C%sInputVector {", ClassIdentifier)
955 w.Writeln("private:")
956 w.Writeln(" ")
957 w.Writeln(" const T* m_data;")
958 w.Writeln(" size_t m_size;")
959 w.Writeln(" ")
960 w.Writeln("public:")
961 w.Writeln(" ")
962 w.Writeln(" C%sInputVector( const std::vector<T>& vec)", ClassIdentifier)
963 w.Writeln(" : m_data( vec.data() ), m_size( vec.size() )")
964 w.Writeln(" {")
965 w.Writeln(" }")
966 w.Writeln(" ")
967 w.Writeln(" C%sInputVector( const T* in_data, size_t in_size)", ClassIdentifier)
968 w.Writeln(" : m_data( in_data ), m_size(in_size )")
969 w.Writeln(" {")
970 w.Writeln(" }")
971 w.Writeln(" ")
972 w.Writeln(" const T* data() const")
973 w.Writeln(" {")
974 w.Writeln(" return m_data;")
975 w.Writeln(" }")
976 w.Writeln(" ")
977 w.Writeln(" size_t size() const")
978 w.Writeln(" {")
979 w.Writeln(" return m_size;")
980 w.Writeln(" }")
981 w.Writeln(" ")
982 w.Writeln("};")
983 w.Writeln("")
984 if (strings.Compare(ClassIdentifier, NameSpace) != 0) {
985 w.Writeln("// declare deprecated class name")
986 w.Writeln("template<typename T>")
987 w.Writeln("using C%sInputVector = C%sInputVector<T>;", NameSpace, ClassIdentifier)
988 }
989 return nil
990}
991
992func decomposeParamClassNameCPP(paramClassName string) (string, string, error) {
993 paramNameSpace, paramClassName, err := decomposeParamClassName(paramClassName)

Callers 1

buildCppHeaderFunction · 0.85

Calls 1

WritelnMethod · 0.80

Tested by

no test coverage detected