00001
00004 #ifndef SWIG_RUBY_H
00005 # define SWIG_RUBY_H
00006
00007 # ifndef SWIGRUBY
00008 # error "This file must be compiled with SWIG in ruby mode."
00009 # endif
00010
00011 # include "uclient.h"
00012
00013 namespace urbi
00014 {
00015 class Callback : public UCallbackWrapper
00016 {
00017 public:
00018 Callback(VALUE proc) :
00019 UCallbackWrapper(),
00020 proc_ (proc)
00021 {
00022 Check_Type(proc_, T_DATA);
00023 }
00024
00025 virtual UCallbackAction operator () (const UMessage& msg)
00026 {
00027
00028
00029 VALUE v = Qnil;
00030 v = SWIG_Ruby_NewPointerObj((void *)&msg,
00031 SWIGTYPE_p_urbi__UMessage,
00032 0);
00033
00034 rb_funcall(proc_, rb_intern("call"), 1, v);
00035
00036 return URBI_CONTINUE;
00037 }
00038
00039 virtual ~Callback() {}
00040
00041 private:
00042 VALUE proc_;
00043 };
00044 };
00045
00046 #endif