view tango/example/cluster/Add.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
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);}
}