// -*-c++-*- // The server object header file. #ifndef __SERVER_H #define __SERVER_H #include "HPCxx_String.h" #include #define SERVER_REG_ID 340 // Some random unused number // All registration IDs, again randomly selected. These numbers must be // unique among all the functions registered in this context. #define RETURN_SERVER_GP_ID 180 #define SAY_HELLO_ID 181 #define KILL_ME_ID 182 class Server { public: Server() {} // The server object's API HPCxx_String sayHello(HPCxx_String); int killMe(); // This is required to figure out the server class' registration ID. This // is used by HPC++ for remote read / write on instances of the Server // class (not shown by this example). static int registrationID() { return SERVER_REG_ID; } static void registerAll(); // To register all of the server related functions // Pack and unpack functions for the server object. Again, if we were // doing remote read / write for instances of the server object, these // functions will determine what constitutes the object's data. friend void hpcxx_pack(HPCxx_Buffer& b, Server* p, int count); friend void hpcxx_unpack(HPCxx_Buffer& b, Server* p, int count); }; // To be called to get the first GP to the server context. In HPC++ // semantics, every context typically provides at least one global // functions that returns a global pointer to a server object. This // function is called first to get this global pointer, whihc can then be // used to invoke methods on the server object. HPCxx_GlobalPtr returnServerGp(); #endif // __SERVER_H