examples: add diagnostic printout
[charm.git] / examples / charm++ / sync_square / sync_square.cc
1 #include "sync_square.h"
2 #include <stdlib.h>
3
4 Driver::Driver(CkArgMsg* args) {
5     int value = 10;
6     if (args->argc > 1) value = strtol(args->argv[1], NULL, 10);
7     delete args;
8     s = CProxy_Squarer::ckNew();
9     thisProxy.get_square(value);
10 }
11
12 void Driver::get_square(int value)
13 {
14     int_message* square_message = s.square(value);
15     int square = square_message->value;
16     CkPrintf("%d^2 = %d\n", value, square);
17     CkFreeMsg(square_message);
18     CkExit();
19 }
20
21 int_message* Squarer::square(int x) {
22     return new int_message(x*x);
23 }
24
25
26 #include "sync_square.def.h"