00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00022 #if !defined(GLOBUS_STATES_H)
00023 #define GLOBUS_STATES_H 1
00024
00025 #include "globus_common.h"
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031 #define globus_state_add_transition(_h, _s, _e, _ns, _cb, _d) \
00032 globus_state_add_transition_real(_h, _s, _e, _ns, _cb, #_cb, _d)
00033
00034 extern globus_extension_registry_t globus_i_state_diagram_registry;
00035 #define GLOBUS_STATE_DIAGRAM_REGISTRY &globus_i_state_diagram_registry
00036
00037 typedef struct globus_i_state_handle_s * globus_state_handle_t;
00038
00039 typedef
00040 globus_result_t
00041 (*globus_states_transition_function_t)(
00042 int new_state,
00043 void * user_arg);
00044
00045 typedef
00046 void
00047 (*globus_states_transition_error_function_t)(
00048 int new_state,
00049 void * user_arg);
00050
00051 typedef
00052 globus_result_t
00053 (*globus_states_init_function_t)(
00054 globus_state_handle_t handle);
00055
00056 typedef struct globus_state_extension_handle_s
00057 {
00058 globus_states_init_function_t init_handler;
00059 char * name;
00060 } globus_state_extension_handle_t;
00061
00062
00063
00064 typedef enum globus_state_dia_flags_e
00065 {
00066 GLOBUS_STATE_DIA_EDGE_EVENT = 1,
00067 GLOBUS_STATE_DIA_EDGE_FUNC = 2,
00068 GLOBUS_STATE_DIA_NO_DUPLICATES = 4,
00069 GLOBUS_STATE_DIA_NUMBER_LABELS = 8
00070 } globus_state_dia_flags_t;
00071
00072 globus_result_t
00073 globus_states_set_events(
00074 globus_state_handle_t handle,
00075 int state_count,
00076 int event_count,
00077 char * reg_name,
00078 char ** state_name,
00079 char ** event_name);
00080
00081 globus_result_t
00082 globus_states_init(
00083 globus_state_handle_t * out_handle,
00084 globus_states_init_function_t init_func);
00085
00086 globus_result_t
00087 globus_state_add_transition_real(
00088 globus_state_handle_t in_handle,
00089 int state,
00090 int event,
00091 int new_state,
00092 globus_states_transition_function_t cb,
00093 char * edge_name,
00094 char * desc);
00095
00096
00097 globus_result_t
00098 globus_state_handle_event_now(
00099 globus_state_handle_t in_handle,
00100 int state,
00101 int event,
00102 void * user_arg);
00103
00104 globus_result_t
00105 globus_state_queue_event(
00106 globus_state_handle_t in_handle,
00107 int state,
00108 int event,
00109 void * user_arg,
00110 globus_states_transition_error_function_t error_event);
00111
00112
00113
00114 globus_result_t
00115 globus_state_destroy(
00116 globus_state_handle_t in_handle);
00117
00118 globus_result_t
00119 globus_state_make_graph(
00120 globus_state_handle_t in_handle,
00121 const char * filename,
00122 const char * txt_filename,
00123 int flags,
00124 char * user_desc);
00125
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129
00130 #endif