using Google.Protobuf; using Mediapipe.Core; using Mediapipe.Framework.Formats; using Mediapipe.Framework.Port; using Mediapipe.Gpu; using Mediapipe.PInvoke; namespace Mediapipe.Framework; public static class PacketValidatorExtension { /// /// Validate if the content of the is a boolean. /// /// /// If the doesn't contain bool data. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsBool(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsBool(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is a std::vector<bool>. /// /// /// If the doesn't contain std::vector<bool>. /// public static void Validate(this Packet> packet) { UnsafeNativeMethods.mp_Packet__ValidateAsBoolVector(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsBoolVector(this Packet> packet) { packet.Validate(); } /// /// Validate if the content of the is a double. /// /// /// If the doesn't contain double data. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsDouble(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsDouble(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is a float. /// /// /// If the doesn't contain float data. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsFloat(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsFloat(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is a float array. /// /// /// If the doesn't contain a float array. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsFloatArray(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsFloatArray(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is std::vector<float>. /// /// /// If the doesn't contain std::vector<bool>. /// public static void Validate(this Packet> packet) { UnsafeNativeMethods.mp_Packet__ValidateAsFloatVector(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsFloatVector(this Packet> packet) { packet.Validate(); } /// /// Validate if the content of the is an . /// /// /// If the doesn't contain . /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsGpuBuffer(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsGpuBuffer(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is an . /// /// /// If the doesn't contain . /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsImage(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsImage(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is an . /// /// /// If the doesn't contain . /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsImageFrame(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsImageFrame(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is an . /// /// /// If the doesn't contain . /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsInt(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsInt(this Packet packet) { packet.Validate(); } /// /// Validate if the content of the is mediapipe::Matrix. /// /// /// If the doesn't contain mediapipe::Matrix. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsMatrix(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } /// /// Validate if the content of the is a proto message. /// /// /// If the doesn't contain proto messages. /// public static void Validate(this Packet packet) where T : IMessage { UnsafeNativeMethods.mp_Packet__ValidateAsProtoMessageLite(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsProtoMessageLite(this Packet packet) where T : IMessage { packet.Validate(); } /// /// Validate if the content of the is a string. /// /// /// If the doesn't contain string. /// public static void Validate(this Packet packet) { UnsafeNativeMethods.mp_Packet__ValidateAsString(packet.MpPtr, out IntPtr statusPtr).Assert(); Status.UnsafeAssertOk(statusPtr); } [Obsolete("Use Validate instead")] public static void ValidateAsString(this Packet packet) { packet.Validate(); } }