diff options
Diffstat (limited to 'cppe/demo/IceE/minimal/Client.cpp')
-rw-r--r-- | cppe/demo/IceE/minimal/Client.cpp | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/cppe/demo/IceE/minimal/Client.cpp b/cppe/demo/IceE/minimal/Client.cpp deleted file mode 100644 index 06dfe344bdd..00000000000 --- a/cppe/demo/IceE/minimal/Client.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. -// -// This copy of Ice-E is licensed to you under the terms described in the -// ICEE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#include <IceE/IceE.h> -#include <Hello.h> - -using namespace std; -using namespace Demo; - -void -menu() -{ - printf("usage:\nh: say hello\nx: exit\n?: help\n"); -} - -int -run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) -{ - if(argc > 1) - { - fprintf(stderr, "%s: too many arguments\n", argv[0]); - return EXIT_FAILURE; - } - - Ice::PropertiesPtr properties = communicator->getProperties(); - const char* proxyProperty = "Hello.Proxy"; - string proxy = properties->getProperty(proxyProperty); - if(proxy.empty()) - { - fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty); - return EXIT_FAILURE; - } - - HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy(proxy)); - if(!hello) - { - - fprintf(stderr, "%s: invalid proxy\n", argv[0]); - return EXIT_FAILURE; - } - - menu(); - - char c = EOF; - do - { - try - { - printf("==> "); - do - { - c = getchar(); - } - while(c != EOF && c == '\n'); - if(c == 'h') - { - hello->sayHello(); - } - else if(c == 'x') - { - // Nothing to do - } - else if(c == '?') - { - menu(); - } - else - { - printf("unknown command `%c'\n", c); - menu(); - } - } - catch(const Ice::Exception& ex) - { - fprintf(stderr, "%s\n", ex.toString().c_str()); - } - } - while(c != EOF && c != 'x'); - - return EXIT_SUCCESS; -} - -int -main(int argc, char* argv[]) -{ - - int status; - Ice::CommunicatorPtr communicator; - - try - { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(); - initData.properties->load("config"); - communicator = Ice::initialize(argc, argv, initData); - status = run(argc, argv, communicator); - } - catch(const Ice::Exception& ex) - { - fprintf(stderr, "%s\n", ex.toString().c_str()); - status = EXIT_FAILURE; - } - - if(communicator) - { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - fprintf(stderr, "%s\n", ex.toString().c_str()); - status = EXIT_FAILURE; - } - } - - return status; -} |