Ejemplo n.º 1
0
        public Status SetConfig(ConfigProto config)
        {
            var bytes = config.ToByteArray();
            var proto = Marshal.AllocHGlobal(bytes.Length);

            Marshal.Copy(bytes, 0, proto, bytes.Length);
            c_api.TF_SetConfig(_handle, proto, (ulong)bytes.Length, _status);
            _status.Check(false);
            return(_status);
        }
Ejemplo n.º 2
0
        private unsafe void SetConfig(ConfigProto config)
        {
            var bytes = config.ToByteArray();

            fixed(byte *proto2 = bytes)
            {
                using (var status = new Status())
                {
                    c_api.TF_SetConfig(Handle, (IntPtr)proto2, (ulong)bytes.Length, status.Handle);
                    status.Check(false);
                }
            }
        }
Ejemplo n.º 3
0
        public void SetConfig(ConfigProto config)
        {
            var bytes = config.ToByteArray();               //TODO! we can use WriteTo
            var proto = Marshal.AllocHGlobal(bytes.Length); //TODO! potential memory leak

            Marshal.Copy(bytes, 0, proto, bytes.Length);

            using (var status = new Status())
            {
                c_api.TF_SetConfig(_handle, proto, (ulong)bytes.Length, status);
                status.Check(false);
            }

            Marshal.FreeHGlobal(proto);
        }
Ejemplo n.º 4
0
        public void SetConfig(ConfigProto config)
        {
            var bytes = config.ToByteArray();
            var proto = Marshal.AllocHGlobal(bytes.Length);

            Marshal.Copy(bytes, 0, proto, bytes.Length);

            using (var status = new Status())
            {
                c_api.TF_SetConfig(_handle, proto, (ulong)bytes.Length, status);
                status.Check(false);
            }

            Marshal.FreeHGlobal(proto);
        }