#include "mediapipe/framework/tool/options_field_util.h"
#include <memory>
#include <string>
#include <tuple>
#include <vector>
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "mediapipe/framework/packet.h"
#include "mediapipe/framework/packet_type.h"
#include "mediapipe/framework/port/advanced_proto_inc.h"
#include "mediapipe/framework/port/any_proto.h"
#include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/tool/name_util.h"
#include "mediapipe/framework/tool/proto_util_lite.h"
#include "mediapipe/framework/tool/type_util.h"
namespace mediapipe {
namespace tool {
namespace options_field_util {
WireFormatLite;
FieldType;
namespace {
constexpr absl::string_view kGoogleProtobufAny = …;
FieldType AsFieldType(proto_ns::FieldDescriptorProto::Type type) { … }
absl::Status WriteField(const FieldData& packet, const FieldDescriptor* field,
std::string* result) { … }
absl::Status ReadField(absl::string_view bytes, const FieldDescriptor& field,
FieldData* result) { … }
absl::StatusOr<std::vector<FieldData>> GetFieldValues(
const FieldData& message_data, const FieldDescriptor& field) { … }
absl::Status GetFieldValue(const FieldData& message_data,
const FieldPathEntry& entry, FieldData* result) { … }
absl::Status SetFieldValue(FieldData& result, const FieldPathEntry& entry,
const FieldData& value) { … }
absl::Status SetFieldValues(FieldData& result, const FieldPathEntry& entry,
const std::vector<FieldData>& values) { … }
bool IsProtobufAny(const FieldDescriptor* field) { … }
FieldData ParseProtobufAny(const FieldData& data) { … }
FieldData SerializeProtobufAny(const FieldData& data) { … }
StatusOr<int> FindExtensionIndex(const FieldData& message_data,
FieldPathEntry* entry) { … }
bool HasField(const FieldPath& field_path, const FieldData& message_data) { … }
const FieldDescriptor* FindExtensionField(const FieldData& message_data,
absl::string_view extension_type) { … }
void SetOptionsMessage(
const FieldData& node_options,
proto_ns::RepeatedPtrField<mediapipe::protobuf::Any>* result) { … }
}
absl::StatusOr<Packet> ReadMessage(const std::string& value,
const std::string& type_name) { … }
absl::StatusOr<FieldData> MergeMessages(const FieldData& base,
const FieldData& over) { … }
absl::Status FindExtension(const FieldData& message_data,
FieldPathEntry* entry) { … }
FieldPath GetExtensionPath(const std::string& parent_type,
const std::string& extension_type,
const std::string& field_name,
bool is_protobuf_any) { … }
absl::StatusOr<FieldData> GetNodeOptions(const FieldData& message_data,
const std::string& extension_type) { … }
absl::StatusOr<FieldData> GetGraphOptions(const FieldData& message_data,
const std::string& extension_type) { … }
absl::StatusOr<std::vector<FieldData>> GetFieldValues(
const FieldData& message_data, const FieldPath& field_path) { … }
absl::StatusOr<FieldData> GetField(const FieldData& message_data,
const FieldPath& field_path) { … }
absl::Status SetFieldValues(FieldData& message_data,
const FieldPath& field_path,
const std::vector<FieldData>& values) { … }
absl::Status SetField(FieldData& message_data, const FieldPath& field_path,
const FieldData& value) { … }
absl::Status MergeFieldValues(FieldData& message_data,
const FieldPath& field_path,
const std::vector<FieldData>& values) { … }
void SetOptionsMessage(const FieldData& node_options,
CalculatorGraphConfig::Node* node) { … }
FieldData AsFieldData(const proto_ns::MessageLite& message) { … }
struct ProtoEnum { … };
absl::StatusOr<Packet> AsPacket(const FieldData& data) { … }
absl::StatusOr<FieldData> AsFieldData(Packet packet) { … }
std::string TypeUrl(absl::string_view type_name) { … }
std::string ParseTypeUrl(absl::string_view type_url) { … }
}
}
}