public ErrorCode InitWithSettings(InitializationSettings settings)
        {
            CInitializationSettings cSettings = new CInitializationSettings()
            {
                persistent_cache         = IntPtr.Zero, // Using default one.
                swappy_tracer_fn         = null,        // It will be set by native library.
                fidelity_params_callback = settings.fidelityParamsCallback,
                training_fidelity_params = IntPtr.Zero,
                endpoint_uri_override    = IntPtr.Zero,
                swappy_version           = 0, // It will be set by native library.
                max_num_metrics          = settings.maxNumMetrics,
                api_key = IntPtr.Zero
            };

            if (settings.trainingFidelityParams != null)
            {
                CProtobufSerialization cs = CProtobufSerialization.Create(settings.trainingFidelityParams);
                cSettings.training_fidelity_params = Marshal.AllocHGlobal(Marshal.SizeOf(cs));
                Marshal.StructureToPtr(cs, cSettings.training_fidelity_params, true);
                m_Ptrs.Add(cSettings.training_fidelity_params);
            }

            if (!string.IsNullOrEmpty(settings.endpointUriOverride))
            {
                cSettings.endpoint_uri_override = Marshal.StringToHGlobalAnsi(settings.endpointUriOverride);
                m_Ptrs.Add(cSettings.endpoint_uri_override);
            }

            return(m_LibraryMethods.InitWithSettings(ref cSettings));
        }
 public ErrorCode InitWithSettings(ref CInitializationSettings settings)
 {
     return((ErrorCode)Unity_TuningFork_init_with_settings(ref settings));
 }
Exemple #3
0
 public ErrorCode InitWithSettings(ref CInitializationSettings settings)
 {
     return(ErrorCode.PlatformNotSupported);
 }
 static extern int Unity_TuningFork_init_with_settings(ref CInitializationSettings settings);