BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bseprocedure.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BSE_PROCEDURE_H__
00003 #define __BSE_PROCEDURE_H__
00004 
00005 #include        <bse/bseparam.hh>
00006 
00007 G_BEGIN_DECLS
00008 
00009 /* --- BSE type macros --- */
00010 #define BSE_PROCEDURE_TYPE(proc)        (G_TYPE_FROM_CLASS (proc))
00011 #define BSE_IS_PROCEDURE_CLASS(proc)    (G_TYPE_CHECK_CLASS_TYPE ((proc), BSE_TYPE_PROCEDURE))
00012 #define BSE_PROCEDURE_NAME(proc)        (g_type_name (BSE_PROCEDURE_TYPE (proc)))
00013 
00014 
00015 /* --- limits --- */
00016 #define BSE_PROCEDURE_MAX_IN_PARAMS     (16)
00017 #define BSE_PROCEDURE_MAX_OUT_PARAMS    (16)
00018 
00019 
00020 /* --- BseProcedureClass --- */
00021 typedef void          (*BseProcedureInit)   (BseProcedureClass *proc,
00022                                              GParamSpec       **in_pspecs,
00023                                              GParamSpec       **out_pspecs);
00024 typedef BseErrorType  (*BseProcedureExec)   (BseProcedureClass *procedure,
00025                                              const GValue      *in_values,
00026                                              GValue            *out_values);
00027 struct _BseProcedureClass
00028 {
00029   GTypeClass      bse_class;
00030 
00031   /* implementation hint */
00032   guint           private_id;
00033 
00034   /* in/out parameters */
00035   guint           n_in_pspecs;
00036   GParamSpec    **in_pspecs;
00037   guint           n_out_pspecs;
00038   GParamSpec    **out_pspecs;
00039   /* keep type references during class lifetime */
00040   GTypeClass    **class_refs;
00041   guint           cache_stamp;
00042   gpointer        cache_next;
00043 
00044   BseProcedureExec execute;
00045 };
00046 
00047 
00048 /* --- notifiers --- */
00049 typedef gboolean (*BseProcedureNotify) (gpointer     func_data,
00050                                         const gchar *proc_name,
00051                                         BseErrorType exit_status);
00052 typedef BseErrorType (*BseProcedureMarshal) (gpointer           marshal_data,
00053                                              BseProcedureClass *proc,
00054                                              const GValue      *ivalues,
00055                                              GValue            *ovalues);
00056 
00057 
00058 /* --- prototypes --- */
00059 /* execute procedure, passing n_in_pspecs param values for in
00060  * values and n_out_pspecs param value locations for out values
00061  */
00062 BseErrorType bse_procedure_exec           (const gchar          *proc_name,
00063                                            ...);
00064 BseErrorType bse_procedure_exec_void      (const gchar          *proc_name,
00065                                            ...);
00066 GType        bse_procedure_lookup         (const gchar          *proc_name);
00067 BseErrorType bse_procedure_marshal_valist (GType                 proc_type,
00068                                            const GValue         *first_value,
00069                                            BseProcedureMarshal   marshal,
00070                                            gpointer              marshal_data,
00071                                            gboolean              skip_ovalues,
00072                                            va_list               var_args);
00073 BseErrorType bse_procedure_marshal        (GType                 proc_type,
00074                                            const GValue         *ivalues,
00075                                            GValue               *ovalues,
00076                                            BseProcedureMarshal   marshal,
00077                                            gpointer              marshal_data);
00078 BseErrorType bse_procedure_collect_input_args (BseProcedureClass  *proc,
00079                                                const GValue       *first_value,
00080                                                va_list             var_args,
00081                                                GValue              ivalues[BSE_PROCEDURE_MAX_IN_PARAMS]);
00082 BseErrorType bse_procedure_execvl         (BseProcedureClass    *proc,
00083                                            GSList               *in_value_list,
00084                                            GSList               *out_value_list,
00085                                            BseProcedureMarshal   marshal,
00086                                            gpointer              marshal_data);
00087 
00088 
00089 /* --- internal --- */
00090 const gchar* bse_procedure_type_register (const gchar           *name,
00091                                           BsePlugin             *plugin,
00092                                           GType                 *ret_type);
00093 
00094 G_END_DECLS
00095 
00096 #endif /* __BSE_PROCEDURE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines