diff options
Diffstat (limited to 'cpp/demo/book/lifecycle/Server.cpp')
-rw-r--r-- | cpp/demo/book/lifecycle/Server.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/cpp/demo/book/lifecycle/Server.cpp b/cpp/demo/book/lifecycle/Server.cpp new file mode 100644 index 00000000000..ec9131ff17c --- /dev/null +++ b/cpp/demo/book/lifecycle/Server.cpp @@ -0,0 +1,55 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <FilesystemI.h> + +using namespace std; +using namespace Filesystem; +using namespace FilesystemI; + +class FilesystemApp : virtual public Ice::Application { +public: + virtual int run(int, char * []) { + // Terminate cleanly on receipt of a signal + // + shutdownOnInterrupt(); + + // Create an object adapter. + // + Ice::ObjectAdapterPtr adapter = + communicator()->createObjectAdapterWithEndpoints( + "SimpleFilesystem", "default -p 10000"); + + // Create the root directory. + // + new DirectoryI(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; + } + + return 0; + }; +}; + +int +main(int argc, char* argv[]) +{ + FilesystemApp app; + return app.main(argc, argv); +} |