summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/optional/Server.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2012-11-20 14:38:30 -0330
committerMatthew Newhook <matthew@zeroc.com>2012-11-20 14:38:30 -0330
commit4c69aa841a5e3ecba11c1383892b6b85f0f9408d (patch)
treedd0d795027edc70c867332c938212ac26edefec9 /cpp/demo/Ice/optional/Server.cpp
parentUpdated expect script for value demo (diff)
downloadice-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.cpp44
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;
+}