#include "mediapipe/framework/tool/template_expander.h"
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "absl/strings/numbers.h"
#include "mediapipe/framework/calculator.pb.h"
#include "mediapipe/framework/port/numbers.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/tool/calculator_graph_template.pb.h"
#include "mediapipe/framework/tool/proto_util_lite.h"
namespace mediapipe {
namespace tool {
MessageLite;
ProtoUtilLite;
WireFormatLite;
FieldValue;
FieldType;
using ProtoPath = ProtoUtilLite::ProtoPath;
ProtoPathEntry;
namespace {
TemplateArgument* GetItem(TemplateDict* args, const std::string& name) { … }
void PutItem(TemplateDict* args, const std::string& name,
const TemplateArgument* value) { … }
std::unique_ptr<MessageLite> CloneMessage(const MessageLite& message) { … }
absl::Status ParseEntry(absl::string_view& path, ProtoPath* result) { … }
absl::Status SetMapKeyTypes(const std::vector<FieldType>& key_types,
ProtoPath* result) { … }
absl::Status ProtoPathSplit(const std::string& path, ProtoPath* result) { … }
absl::Status ParseProtoPath(const TemplateExpression& rule,
std::string base_path, ProtoPath* result) { … }
bool ProtoPathStartsWith(const std::string& path, const std::string& prefix) { … }
FieldType GetFieldType(const TemplateExpression& rule) { … }
int FieldCount(const FieldValue& base, ProtoPath field_path,
FieldType field_type) { … }
}
class TemplateExpanderImpl { … };
TemplateExpander::TemplateExpander() { … }
absl::Status TemplateExpander::ExpandTemplates(
const TemplateDict& args, const CalculatorGraphTemplate& templ,
CalculatorGraphConfig* output) { … }
}
}