diff options
author | Mark Spruiell <mes@zeroc.com> | 2005-10-10 20:51:09 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2005-10-10 20:51:09 +0000 |
commit | 5c820414d32245f8f23ad323787b72fb94f2782b (patch) | |
tree | 7b00c76b0c76606ed30740849b83e65921b8be84 /cpp/demo/IcePack/hello/Client.cpp | |
parent | adding IceGrid (diff) | |
download | ice-5c820414d32245f8f23ad323787b72fb94f2782b.tar.bz2 ice-5c820414d32245f8f23ad323787b72fb94f2782b.tar.xz ice-5c820414d32245f8f23ad323787b72fb94f2782b.zip |
bug 475: remove IcePack
Diffstat (limited to 'cpp/demo/IcePack/hello/Client.cpp')
-rw-r--r-- | cpp/demo/IcePack/hello/Client.cpp | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/cpp/demo/IcePack/hello/Client.cpp b/cpp/demo/IcePack/hello/Client.cpp deleted file mode 100644 index 8ded43dc78d..00000000000 --- a/cpp/demo/IcePack/hello/Client.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2005 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/Application.h> -#include <IcePack/Query.h> -#include <Hello.h> - -using namespace std; -using namespace Demo; - -class HelloClient : public Ice::Application -{ -public: - - virtual int run(int, char*[]); - -private: - - void menu(); -}; - -int -main(int argc, char* argv[]) -{ - HelloClient app; - return app.main(argc, argv, "config"); -} - -void -HelloClient::menu() -{ - cout << - "usage:\n" - "c: create a hello object\n" - "d: destroy the current hello object\n" - "s: set the current hello object\n" - "r: set the current hello object to a random hello object\n" - "S: show the name of the current hello object\n" - "t: send greeting\n" - "x: exit\n" - "?: help\n"; -} - -int -HelloClient::run(int argc, char* argv[]) -{ - Ice::PropertiesPtr properties = communicator()->getProperties(); - - IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator()->stringToProxy("IcePack/Query")); - - // - // Get an object implementing the HelloFactory interface. - // - HelloFactoryPrx factory = HelloFactoryPrx::checkedCast(query->findObjectByType("::Demo::HelloFactory")); - - // - // By default we create a Hello object named 'Foo'. - // - HelloPrx hello; - try - { - hello = factory->find("Foo"); - } - catch(const NameNotExistException&) - { - hello = factory->create("Foo"); - } - - menu(); - - char c; - do - { - try - { - cout << "==> "; - cin >> c; - if(c == 't') - { - hello->sayHello(); - } - else if(c == 'c') - { - string name; - - cout << "name: "; - cin >> name; - - if(!name.empty()) - { - try - { - hello = factory->find(name); - cout << "Hello object named '" << name << "' already exists" << endl; - } - catch(const NameNotExistException&) - { - factory = HelloFactoryPrx::checkedCast(query->findObjectByType("::Demo::HelloFactory")); - hello = factory->create(name); - } - } - } - else if(c == 'd') - { - if(Ice::identityToString(hello->ice_getIdentity()) == "Foo") - { - cout << "Can't delete the default Hello object named 'Foo'" << endl; - } - else - { - hello->destroy(); - - try - { - hello = factory->find("Foo"); - } - catch(const NameNotExistException&) - { - hello = factory->create("Foo"); - } - } - } - else if(c == 's') - { - string name; - - cout << "name: "; - cin >> name; - - try - { - hello = HelloPrx::checkedCast(factory->find(name)); - } - catch(const NameNotExistException&) - { - cout << "This name doesn't exist" << endl; - } - } - else if(c == 'r') - { - hello = HelloPrx::checkedCast(query->findObjectByType("::Demo::Hello")); - } - else if(c == 'S') - { - cout << Ice::identityToString(hello->ice_getIdentity()) << endl; - } - else if(c == 'x') - { - // Nothing to do - } - else if(c == '?') - { - menu(); - } - else - { - cout << "unknown command `" << c << "'" << endl; - menu(); - } - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - } - } - while(cin.good() && c != 'x'); - - return EXIT_SUCCESS; -} |