diff options
author | Matthew Newhook <matthew@zeroc.com> | 2012-11-20 14:38:30 -0330 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2012-11-20 14:38:30 -0330 |
commit | 4c69aa841a5e3ecba11c1383892b6b85f0f9408d (patch) | |
tree | dd0d795027edc70c867332c938212ac26edefec9 /cpp/demo/Ice/optional/Server.cpp | |
parent | Updated expect script for value demo (diff) | |
download | ice-4c69aa841a5e3ecba11c1383892b6b85f0f9408d.tar.bz2 ice-4c69aa841a5e3ecba11c1383892b6b85f0f9408d.tar.xz ice-4c69aa841a5e3ecba11c1383892b6b85f0f9408d.zip |
ICE-4962
Added new optional demo for C++.
Diffstat (limited to 'cpp/demo/Ice/optional/Server.cpp')
-rw-r--r-- | cpp/demo/Ice/optional/Server.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cpp/demo/Ice/optional/Server.cpp b/cpp/demo/Ice/optional/Server.cpp new file mode 100644 index 00000000000..c841342ef80 --- /dev/null +++ b/cpp/demo/Ice/optional/Server.cpp @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2012 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 <ContactDBI.h> + +using namespace std; + +class ContactServer : public Ice::Application +{ +public: + + virtual int run(int, char*[]); +}; + +int +main(int argc, char* argv[]) +{ + ContactServer app; + return app.main(argc, argv, "config.server"); +} + +int +ContactServer::run(int argc, char* argv[]) +{ + if(argc > 1) + { + cerr << appName() << ": too many arguments" << endl; + return EXIT_FAILURE; + } + + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ContactDB"); + Demo::ContactDBPtr contactdb = new ContactDBI; + adapter->add(contactdb, communicator()->stringToIdentity("contactdb")); + adapter->activate(); + communicator()->waitForShutdown(); + return EXIT_SUCCESS; +} |