/// <summary>
        /// </summary>
        public static CalculatorGraphConfig ParseFromTextFormat(this pb::MessageParser <CalculatorGraphConfig> parser, string configText)
        {
            UnsafeNativeMethods.mp_api__ConvertFromCalculatorGraphConfigTextFormat(configText, out var serializedProtoPtr).Assert();

            var config = Protobuf.DeserializeProto(serializedProtoPtr, CalculatorGraphConfig.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(config);
        }
        public override List <Rect> Get()
        {
            UnsafeNativeMethods.mp_Packet__GetRectVector(mpPtr, out var serializedProtoVectorPtr).Assert();
            GC.KeepAlive(this);

            var rects = Protobuf.DeserializeProtoVector <Rect>(serializedProtoVectorPtr, Rect.Parser);

            UnsafeNativeMethods.mp_api_SerializedProtoVector__delete(serializedProtoVectorPtr);

            return(rects);
        }
Ejemplo n.º 3
0
        public override List <NormalizedLandmarkList> Get()
        {
            UnsafeNativeMethods.mp_Packet__GetNormalizedLandmarkListVector(mpPtr, out var serializedProtoVectorPtr).Assert();
            GC.KeepAlive(this);

            var normalizedLandmarkLists = Protobuf.DeserializeProtoVector <NormalizedLandmarkList>(serializedProtoVectorPtr, NormalizedLandmarkList.Parser);

            UnsafeNativeMethods.mp_api_SerializedProtoVector__delete(serializedProtoVectorPtr);

            return(normalizedLandmarkLists);
        }
        /// <remarks>Crashes if config is not set</remarks>
        public CalculatorGraphConfig Config()
        {
            UnsafeNativeMethods.mp_CalculatorGraph__Config(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var config = Protobuf.DeserializeProto <CalculatorGraphConfig>(serializedProtoPtr, CalculatorGraphConfig.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(config);
        }
Ejemplo n.º 5
0
        public override FaceGeometry.FaceGeometry Get()
        {
            UnsafeNativeMethods.mp_Packet__GetFaceGeometry(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var geometry = Protobuf.DeserializeProto <FaceGeometry.FaceGeometry>(serializedProtoPtr, FaceGeometry.FaceGeometry.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(geometry);
        }
Ejemplo n.º 6
0
        public override List <ClassificationList> Get()
        {
            UnsafeNativeMethods.mp_Packet__GetClassificationListVector(mpPtr, out var serializedProtoVectorPtr).Assert();
            GC.KeepAlive(this);

            var detections = Protobuf.DeserializeProtoVector <ClassificationList>(serializedProtoVectorPtr, ClassificationList.Parser);

            UnsafeNativeMethods.mp_api_SerializedProtoVector__delete(serializedProtoVectorPtr);

            return(detections);
        }
        public override List <FaceGeometry.FaceGeometry> Get()
        {
            UnsafeNativeMethods.mp_Packet__GetFaceGeometryVector(mpPtr, out var serializedProtoVectorPtr).Assert();
            GC.KeepAlive(this);

            var geometries = Protobuf.DeserializeProtoVector <FaceGeometry.FaceGeometry>(serializedProtoVectorPtr, FaceGeometry.FaceGeometry.Parser);

            UnsafeNativeMethods.mp_api_SerializedProtoVector__delete(serializedProtoVectorPtr);

            return(geometries);
        }
        public override NormalizedRect Get()
        {
            UnsafeNativeMethods.mp_Packet__GetNormalizedRect(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var normalizedRect = Protobuf.DeserializeProto <NormalizedRect>(serializedProtoPtr, NormalizedRect.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(normalizedRect);
        }
Ejemplo n.º 9
0
        public override ClassificationList Get()
        {
            UnsafeNativeMethods.mp_Packet__GetClassificationList(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var rect = Protobuf.DeserializeProto <ClassificationList>(serializedProtoPtr, ClassificationList.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(rect);
        }
Ejemplo n.º 10
0
        public override TimedModelMatrixProtoList Get()
        {
            UnsafeNativeMethods.mp_Packet__GetTimedModelMatrixProtoList(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var matrixProtoList = Protobuf.DeserializeProto <TimedModelMatrixProtoList>(serializedProtoPtr, TimedModelMatrixProtoList.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(matrixProtoList);
        }
Ejemplo n.º 11
0
        public override Detection Get()
        {
            UnsafeNativeMethods.mp_Packet__GetDetection(mpPtr, out var serializedProtoPtr).Assert();
            GC.KeepAlive(this);

            var detection = Protobuf.DeserializeProto <Detection>(serializedProtoPtr, Detection.Parser);

            UnsafeNativeMethods.mp_api_SerializedProto__delete(serializedProtoPtr);

            return(detection);
        }
Ejemplo n.º 12
0
        public static List <T> DeserializeProtoVector <T>(IntPtr ptr, pb::MessageParser <T> parser) where T : pb::IMessage <T>
        {
            var serializedProtoVector = Marshal.PtrToStructure <SerializedProtoVector>(ptr);
            var protos = new List <T>(serializedProtoVector.size);

            unsafe {
                byte **protoPtr = (byte **)serializedProtoVector.data;

                for (var i = 0; i < serializedProtoVector.size; i++)
                {
                    protos.Add(Protobuf.DeserializeProto <T>((IntPtr)(*protoPtr++), parser));
                }
            }

            return(protos);
        }
Ejemplo n.º 13
0
 public static CalculatorGraphConfig ParseFromString(string configText)
 {
     return(Protobuf.ParseFromStringAsCalculatorGraphConfig(configText));
 }