MashRemoteObject

If you RPC a lot using Dp, you will love this.

MashRemoteObject is a class that hides the underlying Dp calls for you. It makes remote object behave like local objects.

Say you want to control a camera on a remote machine. You can do this:

    set socket [dp_MakeRPCClient camera.bmrc.berkeley.edu 4222]
    set camera [new MashRemoteObject $socket new VCC3Camera]
    $camera pan 40
    $camera zoom 1
    free $camera

We are making calls to $camera as if it is a local object! This is cool because if you do not want to use client-server architecture and want to run your code on the machine that controls the camera, all you need to do is remove "dp_MakeRPCClient" and replace "new MashRemoteObject ..." with "new VCC3Camera". All the camera control code will work the same!

WARNING:

  • MashRemoteObject does not marshall/unmarshall data. So you can only pass by value.
  • Always keep in mind the cost of RPC when using MashRemoteObject. Even though the syntax is the same for remote calls and local calls, the cost are not the same!