summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/hello/Server.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-09-09 07:05:32 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-09-09 07:05:32 +0000
commitd9e37798719846dd6ea7f25fcc4eb053db2c2efe (patch)
tree04dc91fdacae69db9adb3ba8c8d0872a7243662d /cpp/demo/Ice/hello/Server.cpp
parentFirst saving support (diff)
downloadice-d9e37798719846dd6ea7f25fcc4eb053db2c2efe.tar.bz2
ice-d9e37798719846dd6ea7f25fcc4eb053db2c2efe.tar.xz
ice-d9e37798719846dd6ea7f25fcc4eb053db2c2efe.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=335
Diffstat (limited to 'cpp/demo/Ice/hello/Server.cpp')
-rw-r--r--cpp/demo/Ice/hello/Server.cpp56
1 files changed, 17 insertions, 39 deletions
diff --git a/cpp/demo/Ice/hello/Server.cpp b/cpp/demo/Ice/hello/Server.cpp
index a3b113af11d..c6b439fcfc2 100644
--- a/cpp/demo/Ice/hello/Server.cpp
+++ b/cpp/demo/Ice/hello/Server.cpp
@@ -7,53 +7,31 @@
//
// **********************************************************************
-#include <Ice/Ice.h>
#include <HelloI.h>
+#include <Ice/Application.h>
using namespace std;
-int
-run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+class HelloServer : public Ice::Application
{
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
- Ice::ObjectPtr object = new HelloI;
- adapter->add(object, Ice::stringToIdentity("hello"));
- adapter->activate();
- communicator->waitForShutdown();
- return EXIT_SUCCESS;
-}
+public:
+
+ virtual int run(int, char*[]);
+};
int
main(int argc, char* argv[])
{
- int status;
- Ice::CommunicatorPtr communicator;
-
- try
- {
- Ice::PropertiesPtr properties = Ice::createProperties();
- properties->load("config");
- communicator = Ice::initializeWithProperties(argc, argv, properties);
- status = run(argc, argv, communicator);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
-
- if(communicator)
- {
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
- }
+ HelloServer app;
+ return app.main(argc, argv, "config");
+}
- return status;
+int
+HelloServer::run(int argc, char* argv[])
+{
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
+ adapter->add(new HelloI, Ice::stringToIdentity("hello"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
}