diff options
author | Mark Spruiell <mes@zeroc.com> | 2010-01-05 20:17:33 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2010-01-05 20:17:33 -0800 |
commit | cf24e681e8c52cd20d81fe750ff258e67ee65734 (patch) | |
tree | 8411820ce3a257272d6ffa0d3dcdab9ce106609a /cpp/demo/book/printer/Server.cpp | |
parent | Fixed bug 4576 - add NPTL options only on Rhel4 (diff) | |
download | ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.tar.bz2 ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.tar.xz ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.zip |
bug 4495 - clean up book demos
Diffstat (limited to 'cpp/demo/book/printer/Server.cpp')
-rw-r--r-- | cpp/demo/book/printer/Server.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/cpp/demo/book/printer/Server.cpp b/cpp/demo/book/printer/Server.cpp index c4330b12499..e5018cc82ab 100644 --- a/cpp/demo/book/printer/Server.cpp +++ b/cpp/demo/book/printer/Server.cpp @@ -13,15 +13,16 @@ using namespace std; using namespace Demo; -class PrinterI : public Printer { +class PrinterI : public Printer +{ public: - virtual void printString(const string & s, - const Ice::Current &); + + virtual void printString(const string &, const Ice::Current&); }; void PrinterI:: -printString(const string & s, const Ice::Current &) +printString(const string &s, const Ice::Current&) { cout << s << endl; } @@ -31,27 +32,34 @@ main(int argc, char* argv[]) { int status = 0; Ice::CommunicatorPtr ic; - try { + try + { ic = Ice::initialize(argc, argv); - Ice::ObjectAdapterPtr adapter - = ic->createObjectAdapterWithEndpoints( - "SimplePrinterAdapter", "default -p 10000"); + Ice::ObjectAdapterPtr adapter = + ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000"); Ice::ObjectPtr object = new PrinterI; - adapter->add(object, - ic->stringToIdentity("SimplePrinter")); + adapter->add(object, ic->stringToIdentity("SimplePrinter")); adapter->activate(); ic->waitForShutdown(); - } catch (const Ice::Exception & e) { + } + catch(const Ice::Exception& e) + { cerr << e << endl; status = 1; - } catch (const char * msg) { + } + catch(const char* msg) + { cerr << msg << endl; status = 1; } - if (ic) { - try { + if(ic) + { + try + { ic->destroy(); - } catch (const Ice::Exception & e) { + } + catch(const Ice::Exception& e) + { cerr << e << endl; status = 1; } |