diff options
author | Mark Spruiell <mes@zeroc.com> | 2005-06-01 23:28:22 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2005-06-01 23:28:22 +0000 |
commit | 4d37cb10011490fc9929c5cd1c8f672b4eebf651 (patch) | |
tree | ef71347e626d7a637286161b319edf406f9f04f4 /cpp/demo/Ice/value/Server.cpp | |
parent | Fix for bug 346. (diff) | |
download | ice-4d37cb10011490fc9929c5cd1c8f672b4eebf651.tar.bz2 ice-4d37cb10011490fc9929c5cd1c8f672b4eebf651.tar.xz ice-4d37cb10011490fc9929c5cd1c8f672b4eebf651.zip |
changing to use Ice::Application to fix bug 315
Diffstat (limited to 'cpp/demo/Ice/value/Server.cpp')
-rw-r--r-- | cpp/demo/Ice/value/Server.cpp | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/cpp/demo/Ice/value/Server.cpp b/cpp/demo/Ice/value/Server.cpp index a973947d99b..ea5fb5ea92e 100644 --- a/cpp/demo/Ice/value/Server.cpp +++ b/cpp/demo/Ice/value/Server.cpp @@ -12,48 +12,27 @@ using namespace std; -int -run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) +class ValueServer : public Ice::Application { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Value"); - Ice::ObjectPtr object = new InitialI(adapter); - adapter->add(object, Ice::stringToIdentity("initial")); - 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; - } - } + ValueServer app; + return app.main(argc, argv, "config"); +} - return status; +int +ValueServer::run(int argc, char* argv[]) +{ + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Value"); + Ice::ObjectPtr object = new InitialI(adapter); + adapter->add(object, Ice::stringToIdentity("initial")); + adapter->activate(); + communicator()->waitForShutdown(); + return EXIT_SUCCESS; } |