Ejemplo n.º 1
0
        public static unsafe Data GetData()
        {
            var dataNative = default(DataNative *);

            try
            {
                dataNative = DataNative.New();

                return(dataNative->ToManaged());
            }
            finally
            {
                DataNative.Free(dataNative);
            }
        }
Ejemplo n.º 2
0
        public static unsafe Data ToManaged(this DataNative data)
        {
            var parameters = new List <double>();
            var objectives = new List <double>();

            var managedData = new Data
            {
                Objective  = data.objective,
                Objectives = objectives,
                Parameters = parameters
            };

            for (int i = 0; i < data.parameterCount; ++i)
            {
                parameters.Add(data.paramters[i]);
            }
            for (int i = 0; i < data.objectiveCount; ++i)
            {
                objectives.Add(data.objectives[i]);
            }

            return(managedData);
        }