MCPcopy Create free account
hub / github.com/apple/coremltools / handleContainer

Function handleContainer

mlmodel/tools/enumgen.cpp:38–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36// or a top level file (FileDescriptor).
37template<typename T>
38static void handleContainer(const T& container, std::ostream& ret) {
39 // flat structure
40 for (size_t i=0; i<container.enum_type_count(); i++) {
41 const auto* enumType = container.enum_type(i);
42 ret << "enum ML" << enumType->name() << ": int {" << std::endl;
43 for (size_t j=0; j<enumType->value_count(); j++) {
44 const auto* enumValue = enumType->value(j);
45 ret << INDENT << "ML" << enumType->name() << enumValue->name();
46 ret << " = " << enumValue->number() << "," << std::endl;
47 }
48 ret << "};" << std::endl << std::endl;
49 }
50}
51
52// recursively handle message types
53static void handleMessage(const Descriptor& message, std::ostream& ret) {

Callers 2

handleMessageFunction · 0.85
makeContentsFunction · 0.85

Calls 4

enum_typeMethod · 0.80
nameMethod · 0.45
valueMethod · 0.45
numberMethod · 0.45

Tested by

no test coverage detected