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/simple_filesystem/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/simple_filesystem/Server.cpp')
-rw-r--r-- | cpp/demo/book/simple_filesystem/Server.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/cpp/demo/book/simple_filesystem/Server.cpp b/cpp/demo/book/simple_filesystem/Server.cpp index 5bc72089edb..bde7861d29a 100644 --- a/cpp/demo/book/simple_filesystem/Server.cpp +++ b/cpp/demo/book/simple_filesystem/Server.cpp @@ -13,24 +13,30 @@ using namespace std; using namespace Filesystem; -class FilesystemApp : virtual public Ice::Application { +class FilesystemApp : virtual public Ice::Application +{ public: - virtual int run(int, char*[]) { + + virtual int run(int, char*[]) + { + // // Terminate cleanly on receipt of a signal // shutdownOnInterrupt(); + // // Create an object adapter. // Ice::ObjectAdapterPtr adapter = - communicator()->createObjectAdapterWithEndpoints( - "SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); + communicator()->createObjectAdapterWithEndpoints("SimpleFilesystem", "default -h 127.0.0.1 -p 10000"); + // // Create the root directory (with name "/" and no parent) // DirectoryIPtr root = new DirectoryI(communicator(), "/", 0); root->activate(adapter); + // // Create a file called "README" in the root directory // FileIPtr file = new FileI(communicator(), "README", root); @@ -39,11 +45,13 @@ public: file->write(text); file->activate(adapter); + // // Create a directory called "Coleridge" in the root directory // DirectoryIPtr coleridge = new DirectoryI(communicator(), "Coleridge", root); coleridge->activate(adapter); + // // Create a file called "Kubla_Khan" in the Coleridge directory // file = new FileI(communicator(), "Kubla_Khan", coleridge); @@ -56,20 +64,22 @@ public: file->write(text); file->activate(adapter); + // // All objects are created, allow client requests now // adapter->activate(); + // // Wait until we are done // communicator()->waitForShutdown(); - if (interrupted()) { - cerr << appName() - << ": received signal, shutting down" << endl; + if(interrupted()) + { + cerr << appName() << ": received signal, shutting down" << endl; } return 0; - }; + } }; int |