/// <summary> /// Provides access to the underlying buffer for the given <see cref="JobPointer"/>. /// </summary> /// <param name="context"></param> /// <param name="job"></param> /// <param name="io_id"></param> /// <param name="resultBuffer"></param> /// <returns></returns> /// <exception cref="BufferOverflowException"></exception> public static bool imageflow_job_get_output_buffer_by_id(ContextPointer context, JobPointer job, int io_id, out JsonReader resultBuffer) { IntPtr resultBufferPointer; long bufferSize; bool @return = imageflow_job_get_output_buffer_by_id(context, job, io_id, out resultBufferPointer, out bufferSize); if (!@return) { resultBuffer = null; return(false); } #pragma warning disable HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation resultBuffer = new UnmanagedJsonReader(resultBufferPointer, bufferSize); #pragma warning restore HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation return(true); }
/// <summary> /// Writes fields from the given imageflow_json_response to the locations referenced. /// </summary> /// <param name="context"></param> /// <param name="response_in"></param> /// <param name="status_code_out"></param> /// <param name="buffer"></param> /// <returns></returns> /// <exception cref="BufferOverflowException"></exception> public static bool imageflow_json_response_read(ContextPointer context, JsonResponsePointer response_in, out long status_code_out, out JsonReader buffer) { IntPtr bufferPointer; IntPtr bufferSize; bool result = imageflow_json_response_read(context, response_in, out status_code_out, out bufferPointer, out bufferSize); if (!result) { buffer = null; return(false); } #pragma warning disable HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation buffer = new UnmanagedJsonReader(bufferPointer, bufferSize.ToInt64()); #pragma warning restore HeapAnalyzerExplicitNewObjectRule // Explicit new reference type allocation return(true); }
public static extern JobIoPointer imageflow_io_create_for_file(ContextPointer context, IoMode mode, [MarshalAs(UnmanagedType.LPStr)] string filename, CleanupWith cleanup);
public static extern bool imageflow_context_memory_free(ContextPointer context, InternalMemoryPointer pointer, [MarshalAs(UnmanagedType.LPStr)] string filename = null, int line = -1);
private static extern bool imageflow_json_response_read(ContextPointer context, JsonResponsePointer response_in, out long status_code_out, [Out] out IntPtr buffer_utf8_no_nulls_out, [Out] out IntPtr buffer_size_out);
public static extern bool imageflow_context_raise_error(ContextPointer context, ErrorInt32 error_code, [MarshalAs(UnmanagedType.LPStr)][In] string message, [MarshalAs(UnmanagedType.LPStr)][In] string file = null, int line = -1, [MarshalAs(UnmanagedType.LPStr)][In] string function_name = null);
public static extern ErrorInt32 imageflow_context_error_code(ContextPointer context);
public static extern void imageflow_context_clear_error(ContextPointer context);
public static extern bool imageflow_io_get_output_buffer(ContextPointer context, JobIoPointer io, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)][Out] out byte[] result_buffer, [Out] out long result_buffer_length);
private static extern bool imageflow_job_get_output_buffer_by_id(ContextPointer context, JobPointer job, int io_id, [Out] out IntPtr result_buffer, [Out] out long result_buffer_length);
private static extern JsonResponsePointer imageflow_job_send_json(ContextPointer context, JobPointer job, [MarshalAs(UnmanagedType.LPStr)][In] string method, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)][In] byte[] json_buffer, IntPtr json_buffer_size);
/// <summary> /// Sends a JSON message to the <see cref="JobPointer"/>. /// </summary> /// <param name="context">The context.</param> /// <param name="job">The job.</param> /// <param name="method">Determines which code path will be used to process the provided JSON data and compose a response.</param> /// <param name="json">The json.</param> /// <returns><see cref="JsonResponsePointer.Zero"/> on failure.</returns> public static JsonResponsePointer imageflow_job_send_json(ContextPointer context, JobPointer job, string method, string json) { byte[] json_buffer = Encoding.UTF8.GetBytes(json); return(imageflow_job_send_json(context, job, method, json_buffer, new IntPtr(json_buffer.Length))); }
public static extern bool imageflow_job_destroy(ContextPointer context, JobPointer job);
public static extern bool imageflow_job_add_io(ContextPointer context, JobPointer job, IntPtr io, int placeholder_id, Direction direction);
public static extern bool imageflow_json_response_destroy(ContextPointer context, JsonResponsePointer response);
public static extern JobIoPointer imageflow_io_create_from_buffer(ContextPointer context, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)][In] byte[] buffer, IntPtr buffer_byte_count, Lifetime lifetime, CleanupWith cleanup);
public static extern JobIoPointer imageflow_io_create_for_output_buffer(ContextPointer context);
public static extern JobPointer imageflow_job_create(ContextPointer context);
public static extern bool imageflow_context_has_error(ContextPointer context);
public static extern JobIoPointer imageflow_job_get_io(ContextPointer context, JobPointer job, int placeholder_id);
public static extern NegativeInt32False imageflow_context_error_and_stacktrace(ContextPointer context, [MarshalAs(UnmanagedType.LPStr)][In][Out] StringBuilder buffer, IntPtr buffer_length, [MarshalAs(UnmanagedType.I1)] bool full_file_path);
public static extern bool imageflow_context_begin_terminate(ContextPointer context);
public static extern bool imageflow_context_print_and_exit_if_error(ContextPointer context);
public static extern void imageflow_context_destroy(ContextPointer context);
public static extern bool imageflow_context_add_to_callstack(ContextPointer context, [MarshalAs(UnmanagedType.LPStr)][In] string filename = null, int line = -1, [MarshalAs(UnmanagedType.LPStr)][In] string function_name = null);
public static extern InternalMemoryPointer imageflow_context_memory_allocate(ContextPointer context, uint bytes, [MarshalAs(UnmanagedType.LPStr)] string filename = null, int line = -1);