#include "templ.h" #include #include #include #include // The server object Server myServer; // Variables used by "Main.C" HPCxx_Sync *mywait; HPCxx_GlobalPtr returnServerGp() { cout << "Server context :: returnServerGp called\n"; cout.flush(); HPCxx_GlobalPtr gpServer(&myServer); return gpServer; } void Server::registerAll() { hpcxx_registerClass((Server *)NULL); hpcxx_register(returnServerGp, RETURN_SERVER_GP_ID); hpcxx_register(&Server::sayHello, SAY_HELLO_ID); hpcxx_register(&Server::killMe, KILL_ME_ID); } HPCxx_String Server::sayHello(HPCxx_String source) { cout << "Server::sayHello request received from: " << source << endl; cout.flush(); return HPCxx_String("Hello from Server !!\n"); } int Server::killMe() { cout << "Server ::killMe called\n"; cout.flush(); // Writes to the Sync variable so that the main thread waiting for "read" // from the Sync variable can continue thus finishing the server context. int x = 1; *mywait = x; return x; // return some dummy value } void hpcxx_pack(HPCxx_Buffer& b, Server* p, int count) {} void hpcxx_unpack(HPCxx_Buffer& b, Server* p, int count) {}