Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

callback.h

Go to the documentation of this file.
00001 
00048  /* Two points about this enumeration: a) The first entry is not */
00049  /* a valid callback because 0 is used to indicate an invalid or */
00050  /* missing callback and b) The last entry in the enum list      */
00051  /* indicates how many enums are defined.                        */
00052 
00053 #ifndef CALLBACK_H_INCLUDED     /* Avoid duplicate includes  */
00054 #define CALLBACK_H_INCLUDED     /* excludeFromBuildInfo */
00055 
00056  /* First we define the possible callbacks in an enum.  Then we  */
00057  /* describe how each one will be called in user code.           */
00058 
00059 typedef enum {
00060     NO_CALLBACK,                /* Used for missing callback */
00061     SYSTEM_STARTUP_CALLBACK,
00062     SYSTEM_TERMINATION_CALLBACK,
00063     BEFORE_INIT_SOAR_CALLBACK,
00064     AFTER_INIT_SOAR_CALLBACK,
00065     AFTER_HALT_SOAR_CALLBACK,
00066     BEFORE_SCHEDULE_CYCLE_CALLBACK,
00067     AFTER_SCHEDULE_CYCLE_CALLBACK,
00068     BEFORE_DECISION_CYCLE_CALLBACK,
00069     AFTER_DECISION_CYCLE_CALLBACK,
00070     BEFORE_INPUT_PHASE_CALLBACK,
00071     INPUT_PHASE_CALLBACK,
00072     AFTER_INPUT_PHASE_CALLBACK,
00073     BEFORE_PREFERENCE_PHASE_CALLBACK,
00074     AFTER_PREFERENCE_PHASE_CALLBACK,
00075     BEFORE_WM_PHASE_CALLBACK,
00076     AFTER_WM_PHASE_CALLBACK,
00077     BEFORE_OUTPUT_PHASE_CALLBACK,
00078     OUTPUT_PHASE_CALLBACK,
00079     AFTER_OUTPUT_PHASE_CALLBACK,
00080     BEFORE_DECISION_PHASE_CALLBACK,
00081     AFTER_DECISION_PHASE_CALLBACK,
00082     WM_CHANGES_CALLBACK,
00083     CREATE_NEW_CONTEXT_CALLBACK,
00084     POP_CONTEXT_STACK_CALLBACK,
00085     CREATE_NEW_ATTRIBUTE_IMPASSE_CALLBACK,
00086     REMOVE_ATTRIBUTE_IMPASSE_CALLBACK,
00087     PRODUCTION_JUST_ADDED_CALLBACK,
00088     PRODUCTION_JUST_ABOUT_TO_BE_EXCISED_CALLBACK,
00089     FIRING_CALLBACK,
00090     RETRACTION_CALLBACK,
00091     SYSTEM_PARAMETER_CHANGED_CALLBACK,
00092     PRINT_CALLBACK,
00093     LOG_CALLBACK,
00094     ASK_CALLBACK,
00095     WAIT_CALLBACK,
00096 #ifdef ATTENTION_LAPSE
00097     INIT_LAPSE_DURATION_CALLBACK,
00098 #endif
00099     /*  READ_CALLBACK,    *//* kjh CUSP B10 */
00100     /*  RECORD_CALLBACK,  *//* kjh CUSP B10 */
00101     NUMBER_OF_CALLBACKS         /* Not actually a callback   */
00102         /* type.  Used to indicate   */
00103         /* list size and MUST ALWAYS */
00104         /* BE LAST.                  */
00105 } SOAR_CALLBACK_TYPE;
00106 
00107 #define NUMBER_OF_MONITORABLE_CALLBACKS (NUMBER_OF_CALLBACKS - 2)
00108 
00109 typedef enum {
00110     NO_GLOBAL_CALLBACK,
00111     GLB_CREATE_AGENT,
00112     GLB_AGENT_CREATED,
00113     GLB_DESTROY_AGENT,
00114     NUMBER_OF_GLOBAL_CALLBACKS
00115 } SOAR_GLOBAL_CALLBACK_TYPE;
00116 
00117 typedef list *soar_global_callback_array[NUMBER_OF_GLOBAL_CALLBACKS];
00118 
00391 typedef list *soar_callback_array[NUMBER_OF_CALLBACKS];
00392 
00397 typedef void *soar_callback_agent;
00398 
00402 typedef const char *soar_callback_id;
00403 
00410 typedef void *soar_callback_data;
00411 
00417 typedef const void *soar_call_data;
00418 
00423 typedef void (*soar_callback_fn) (soar_callback_agent, soar_callback_data, soar_call_data);
00424 
00425 typedef void (*soar_callback_free_fn) (soar_callback_data);
00426 
00427 typedef struct callback_struct {
00428     soar_callback_id id;
00429     soar_callback_fn function;
00430     soar_callback_data data;
00431     soar_callback_free_fn free_function;
00432 } soar_callback;
00433 
00434 extern void soar_callback_data_free_string(soar_callback_data);
00435 extern char *soar_callback_enum_to_name(SOAR_CALLBACK_TYPE, bool);
00436 extern void soar_destroy_callback(soar_callback *);
00437 extern bool soar_exists_callback(soar_callback_agent, SOAR_CALLBACK_TYPE);
00438 extern soar_callback *soar_exists_callback_id(soar_callback_agent the_agent,
00439                                               SOAR_CALLBACK_TYPE callback_type, soar_callback_id id);
00440 extern void soar_init_callbacks(soar_callback_agent);
00441 extern void soar_init_global_callbacks(void);
00442 
00443 extern void soar_invoke_callbacks(soar_callback_agent, SOAR_CALLBACK_TYPE, soar_call_data);
00444 extern void soar_invoke_global_callbacks(soar_callback_agent, SOAR_CALLBACK_TYPE, soar_call_data);
00445 extern void soar_invoke_first_callback(soar_callback_agent, SOAR_CALLBACK_TYPE, soar_call_data);
00446 extern bool soar_exists_global_callback(SOAR_GLOBAL_CALLBACK_TYPE);
00447 
00448 #endif

Generated on Thu Dec 11 13:00:14 2003 for Soar Kernel by doxygen 1.3.5