[Bf-blender-cvs] [ade4c610630] functions: function api design

Jacques Lucke noreply at git.blender.org
Sun Feb 10 20:24:44 CET 2019


Commit: ade4c6106306879987cdad41bdb2c79f1e4eb362
Author: Jacques Lucke
Date:   Mon Jan 21 10:02:42 2019 +0100
Branches: functions
https://developer.blender.org/rBade4c6106306879987cdad41bdb2c79f1e4eb362

function api design

===================================================================

A	source/blender/functions/FN_funtions.h

===================================================================

diff --git a/source/blender/functions/FN_funtions.h b/source/blender/functions/FN_funtions.h
new file mode 100644
index 00000000000..8d19c261bc4
--- /dev/null
+++ b/source/blender/functions/FN_funtions.h
@@ -0,0 +1,65 @@
+#include "BLI_utildefines.h"
+
+struct Function;
+typedef struct Function Function;
+
+struct FnInputs;
+typedef struct FnInputs FnInputs;
+
+struct FnOutputs;
+typedef struct FnOutputs FnOutputs;
+
+struct FnStaticInputs;
+typedef struct FnStaticInputs FnStaticInputs;
+
+struct FnDependencies;
+typedef struct FnDependencies FnDependencies;
+
+/* Split ownership of the function. */
+void FN_function_copy_ref(Function *fn);
+
+/* Tag the function as unused by the caller. */
+void FN_function_free_ref(Function *fn);
+
+
+/* Raw function pointer to call when the function should be executed. */
+void *FN_function_get_pointer(Function *fn);
+
+/* Pass into the function as first argument. */
+void *FN_function_get_settings(Function *fn);
+
+/* Call a function with the given input.
+ * The function output will be written into fn_out.
+ * Returns true on success. */
+bool FN_function_call(Function *fn, FnInputs *fn_in, FnOutputs *fn_out);
+
+
+/* Create a container to store function inputs. */
+FnInputs *FN_inputs_new(Function *fn);
+
+/* Free a set of function inputs. */
+void FN_inputs_free(FnInputs *fn_in);
+
+/* Set a funtion input by name. Returns true on success. */
+bool FN_inputs_set_name(FnInputs *fn_in, const char *name, void *value);
+
+/* Set a function input by index. Returns true on success. */
+bool FN_inputs_set_index(FnInputs *fn_in, uint index, void *value);
+
+
+/* Create a container to store function outputs. */
+FnOutputs *FN_outputs_new(Function *fn);
+
+/* Free a set of output functions. */
+void FN_outputs_free(FnOutputs *fn_out);
+
+/* Extract the result of an executed function by name. */
+void *FN_outputs_get_name(FnOutputs *fn_out, const char *name);
+
+/* Extract the result of an executed function by index. */
+void *FN_outputs_get_index(FnOutputs *fn_out, const char *name);
+
+
+/* Get dependencies of function given some static inputs.
+ * Returns NULL on failure (when not all static inputs are given). */
+FnDependencies *FN_dependencies_get(Function *fn, FnStaticInputs *fn_in);



More information about the Bf-blender-cvs mailing list