summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/latency/Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/Ice/latency/Client.cpp')
-rw-r--r--cpp/demo/Ice/latency/Client.cpp57
1 files changed, 18 insertions, 39 deletions
diff --git a/cpp/demo/Ice/latency/Client.cpp b/cpp/demo/Ice/latency/Client.cpp
index af9fc321628..549649a010e 100644
--- a/cpp/demo/Ice/latency/Client.cpp
+++ b/cpp/demo/Ice/latency/Client.cpp
@@ -7,16 +7,30 @@
//
// **********************************************************************
-#include <Ice/Ice.h>
+#include <Ice/Application.h>
#include <Latency.h>
using namespace std;
using namespace Demo;
+class LatencyClient : public Ice::Application
+{
+public:
+
+ virtual int run(int, char*[]);
+};
+
int
-run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+main(int argc, char* argv[])
{
- Ice::PropertiesPtr properties = communicator->getProperties();
+ LatencyClient app;
+ return app.main(argc, argv, "config");
+}
+
+int
+LatencyClient::run(int argc, char* argv[])
+{
+ Ice::PropertiesPtr properties = communicator()->getProperties();
const char* proxyProperty = "Latency.Ping";
std::string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
@@ -25,7 +39,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
return EXIT_FAILURE;
}
- Ice::ObjectPrx base = communicator->stringToProxy(proxy);
+ Ice::ObjectPrx base = communicator()->stringToProxy(proxy);
PingPrx ping = PingPrx::checkedCast(base);
if(!ping)
{
@@ -52,38 +66,3 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
return EXIT_SUCCESS;
}
-
-int
-main(int argc, char* argv[])
-{
- int status;
- Ice::CommunicatorPtr communicator;
-
- try
- {
- Ice::PropertiesPtr properties = Ice::createProperties();
- properties->load("config");
- communicator = Ice::initializeWithProperties(argc, argv, properties);
- status = run(argc, argv, communicator);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
-
- if(communicator)
- {
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
- }
-
- return status;
-}