diff options
| author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-28 15:26:29 +0200 |
|---|---|---|
| committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-28 15:26:29 +0200 |
| commit | e7da86053b3df2882816b0df8089e1a51b61939f (patch) | |
| tree | 8f7430f7d1e82ddb8449548886f57a3a7c646c05 /osc_server.h | |
| parent | 9b134ea457f91ba8ea6ae558c9192f58c09f62bc (diff) | |
| download | osc-graphics-e7da86053b3df2882816b0df8089e1a51b61939f.tar.gz | |
autotools based build system
Diffstat (limited to 'osc_server.h')
| -rw-r--r-- | osc_server.h | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/osc_server.h b/osc_server.h deleted file mode 100644 index f6d0c51..0000000 --- a/osc_server.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef __OSC_SERVER_H -#define __OSC_SERVER_H - -#include <string.h> -#include <stdarg.h> - -#include <SDL.h> - -#include <lo/lo.h> - -#include "osc_graphics.h" - -class Layer; - -class OSCServer { - lo_server_thread server; - -public: - struct MethodHandlerId { - char *types; - char *path; - void *data; - - MethodHandlerId(const char *_types, const char *_path, - void *_data = NULL) : - types(strdup(_types)), path(strdup(_path)), - data(_data) {} - ~MethodHandlerId() - { - free(types); - free(path); - } - }; - -private: - void add_method_v(MethodHandlerId **hnd, const char *types, - lo_method_handler handler, void *data, - const char *fmt, va_list ap) - __attribute__((format(printf, 6, 0))); - -public: - typedef void (*MethodHandlerCb)(Layer *obj, lo_arg **argv); - typedef Layer *(*CtorHandlerCb)(const char *name, SDL_Rect geo, - float alpha, lo_arg **argv); - - ~OSCServer(); - - void open(const char *port); - - inline void - start() - { - lo_server_thread_start(server); - } - inline void - stop() - { - lo_server_thread_stop(server); - } - - inline void - add_method(MethodHandlerId **hnd, const char *types, - lo_method_handler handler, void *data, - const char *fmt, ...) - __attribute__((format(printf, 6, 7))) - { - va_list ap; - va_start(ap, fmt); - add_method_v(hnd, types, handler, data, fmt, ap); - va_end(ap); - } - inline void - add_method(const char *types, - lo_method_handler handler, void *data, - const char *fmt, ...) - __attribute__((format(printf, 5, 6))) - { - va_list ap; - va_start(ap, fmt); - add_method_v(NULL, types, handler, data, fmt, ap); - va_end(ap); - } - - void del_method(const char *types, const char *fmt, ...) - __attribute__((format(printf, 3, 4))); - inline void - del_method(MethodHandlerId *hnd) - { - del_method(hnd->types, "%s", hnd->path); - delete hnd; - } - - void register_layer(const char *name, const char *types, - CtorHandlerCb ctor_cb); - - MethodHandlerId *register_method(Layer *layer, const char *method, - const char *types, - MethodHandlerCb method_cb); - void unregister_method(MethodHandlerId *hnd); -}; - -#define GEO_TYPES "iiii" /* x, y, width, height */ -#define NEW_LAYER_TYPES "is" GEO_TYPES "f" /* position, name, GEO, alpha */ - -#endif |
