1b45164742059b2d83636f99e38f187430d4510d
[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     CkFreeMsg(square_message);
17     CkExit();
18 }
19
20 int_message* Squarer::square(int x) {
21     return new int_message(x*x);
22 }
23
24
25 #include "sync_square.def.h"