Guest User

Untitled

a guest
Apr 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. class VirtualBase {
  2. public:
  3. VirtualBase();
  4. // virtual int doWork() {return 0;}
  5. // virtual int processWorker() = 0;
  6. };
  7.  
  8.  
  9.  
  10. #include "rice/Director.hpp"
  11. using namespace Rice;
  12.  
  13. class VirtualBaseProxy : public VirtualBase, public Rice::Director {
  14. public:
  15. VirtualBaseProxy(Object self) : Rice::Director(self) { }
  16. /*
  17. virtual int doWork() {
  18. if(callIsFromRuby("do_work")) {
  19. return VirtualBase::doWork();
  20. } else {
  21. return from_ruby<int>( getSelf().call("do_work") );
  22. }
  23. }
  24.  
  25. virtual int processWorker() {
  26. if(callIsFromRuby("process_worker")) {
  27. raisePureVirtual();
  28. } else {
  29. return from_ruby<int>( getSelf().call("process_worker") );
  30. }
  31. }*/
  32. };
  33.  
  34. #include "rice/Constructor.hpp"
  35.  
  36. extern "C"
  37. void Init_virtual() {
  38. // See Caveat below
  39. define_class<VirtualBase>("__VirtualBase__");
  40.  
  41. define_class<VirtualBaseProxy, VirtualBase>("VirtualBase")
  42. .define_constructor(Constructor<VirtualBaseProxy, Object>());
  43. // .define_method("do_work", &VirtualBaseProxy::doWork);
  44. // .define_method("process_worker", &VirtualBaseProxy::processWorker);
  45. }
Add Comment
Please, Sign In to add comment