#include "HelloObject.H" #include /* I/O defs */ #include #include #include #include class HelloObjectImpl : public HelloObject_T_Hello { public: HelloObjectImpl(); // constructor virtual ~HelloObjectImpl(); // destructor // methods virtual ilu_CString hello (HelloObjectStatus *_status); // data slots private: }; HelloObjectImpl::HelloObjectImpl() { } HelloObjectImpl::~HelloObjectImpl() { } ilu_CString HelloObjectImpl::hello (HelloObjectStatus *_status) { char buf[1000]; sprintf(buf, "Hello Stanford DL Library from C++!"); _status->returnCode = HelloObjectReply_Success; return ((ilu_CString) strdup(buf)); } /***********************************************************************/ main (int ac, char **av) { /* first, make a server object */ class iluServer s((ac > 1) ? av[1] : (char *)NULL, NULL); /* Do this, instead of overriding i.ILUGetServer */ ilu::SetDefaultServer(&s); /* now, add the only port */ s.AddPort ( (ac > 2) ? av[2] : (char *)NULL, (ac > 3) ? av[3] : (char *)NULL, ilu_TRUE); /* create an instance of the HelloObjectImpl object */ class HelloObjectImpl *i = new HelloObjectImpl; if (!i->ILUPublish()) { printf ("*** Error, couldn't publish object\n"); exit(1); } /* better print out the SBH to pass as arg to rwhoClient... */ printf ("%s\n", i->ILUStringBindingHandle()); /* and let things run... */ iluServer::Run(); /* should never return, but just in case: */ return(1); }