ipc_wrapper.h

Go to the documentation of this file.
00001 
00003 // @{
00004 
00014 #ifndef CARMEN_GENERIC_INTERFACE_H
00015 #define CARMEN_GENERIC_INTERFACE_H
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 #include <carmen/carmen.h>
00022 
00023 typedef enum {CARMEN_UNSUBSCRIBE, 
00024               CARMEN_SUBSCRIBE_LATEST, 
00025               CARMEN_SUBSCRIBE_ALL} carmen_subscribe_t;
00026 
00027 typedef void (*carmen_handler_t)(void *);
00028 
00029 extern MSG_INSTANCE current_msgRef;
00030 
00033 void 
00034 carmen_subscribe_message(char *message_name, char *message_fmt, 
00035                          void *message_mem, int message_size, 
00036                          carmen_handler_t handler, carmen_subscribe_t subscribe_how);
00037 
00039 void
00040 carmen_unsubscribe_message(char *message_name, carmen_handler_t handler);
00041 
00042 void 
00043 carmen_ipc_subscribe_fd(int fd, carmen_handler_t handler);
00044 
00045 void 
00046 carmen_ipc_unsubscribe_fd(int fd, carmen_handler_t handler);
00047 
00048 int 
00049 carmen_ipc_connect_locked(char *module_name);
00050 
00051 int
00052 carmen_ipc_connect(char *module_name);
00053 
00054 void
00055 carmen_ipc_initialize_locked(int argc, char **argv);
00056 
00057 void 
00058 carmen_ipc_initialize_locked_with_name(int argc, char **argv, char *name);
00059 
00060 void 
00061 carmen_ipc_initialize(int argc, char **argv);
00062 
00063 void 
00064 carmen_ipc_dispatch(void);
00065 
00066 void 
00067 carmen_ipc_sleep(double timeout);
00068 
00069 void 
00070 carmen_ipc_disconnect(void);
00071 
00072 void
00073 carmen_ipc_addPeriodicTimer(double interval, TIMER_HANDLER_TYPE handler,
00074                          void *clientData);
00075 
00076 #define carmen_test_ipc_return(ERR, ERR_MSG, IPC_MSG) do {carmen_test_ipc((ERR), (ERR_MSG), (IPC_MSG)); if ((ERR) != IPC_OK) return; } while (0)
00077 
00078 #define carmen_test_ipc_return_int(ERR, ERR_MSG, IPC_MSG) do {carmen_test_ipc((ERR), (ERR_MSG), (IPC_MSG)); if ((ERR) != IPC_OK) return -1; } while (0)
00079 
00080 #define carmen_test_ipc_return_null(ERR, ERR_MSG, IPC_MSG) do {carmen_test_ipc((ERR), (ERR_MSG), (IPC_MSG)); if ((ERR) != IPC_OK) return NULL; } while (0)
00081 
00082 #define carmen_test_ipc_exit(ERR, ERR_MSG, IPC_MSG) do {carmen_test_ipc((ERR), (ERR_MSG), (IPC_MSG)); if ((ERR) != IPC_OK) {fprintf(stderr, "This is a fatal error. Exiting.\n"); exit(-1);} } while (0)
00083 
00084 #define carmen_ipc_define_test_exit(name,fmt) { IPC_RETURN_TYPE err; err = IPC_defineMsg(name, IPC_VARIABLE_LENGTH, fmt); carmen_test_ipc_exit(err, "Could not define", name); }
00085 
00086 #define carmen_ipc_publish_exit(name,msg) { IPC_RETURN_TYPE err; err = IPC_publishData(name, &msg); carmen_test_ipc_exit(err, "Could not publish", name); }
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #endif
00093 // @}

Generated on Wed Apr 5 18:34:17 2006 for CARMEN by  doxygen 1.4.4