view tango/example/cluster/Add.d @ 133:44a95ac7368a trunk

[svn r137] Many fixes towards tango.io.Console working, but not quite there yet... In particular, assertions has been fixed to include file/line info, and much more!
author lindquist
date Mon, 14 Jan 2008 05:11:54 +0100
parents 1700239cab2e
children
line wrap: on
line source

/*******************************************************************************

*******************************************************************************/

public import tango.net.cluster.NetworkCall;


/*******************************************************************************
        
        a Task function

*******************************************************************************/

real add (real x, real y)
{
        return x + y;
}


/*******************************************************************************

        a Task function

*******************************************************************************/

int divide (int x, int y)
{
        return x / y;
}


/*******************************************************************************

        a verbose Task message

*******************************************************************************/

class Subtract : NetworkCall
{
        double  a,
                b,
                result;

        double opCall (double a, double b, IChannel channel = null)
        {
                this.a = a;
                this.b = b;
                send (channel);
                return result;
        }

        override void execute ()
        {
                result = a - b;
        }

        override void read  (IReader input)  {input (a)(b)(result);}

        override void write (IWriter output) {output (a)(b)(result);}
}