diff options
author | Matthew Newhook <matthew@zeroc.com> | 2007-02-01 08:00:35 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2007-02-01 08:00:35 +0000 |
commit | ab6f712d5c8a4f0e30ea0a2f451a550008aac813 (patch) | |
tree | 53a788b918218cb33720d7085861af2875633424 /cpp/demo/IceStorm/clock/Subscriber.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1711 (diff) | |
download | ice-ab6f712d5c8a4f0e30ea0a2f451a550008aac813.tar.bz2 ice-ab6f712d5c8a4f0e30ea0a2f451a550008aac813.tar.xz ice-ab6f712d5c8a4f0e30ea0a2f451a550008aac813.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1711
Diffstat (limited to 'cpp/demo/IceStorm/clock/Subscriber.cpp')
-rw-r--r-- | cpp/demo/IceStorm/clock/Subscriber.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/cpp/demo/IceStorm/clock/Subscriber.cpp b/cpp/demo/IceStorm/clock/Subscriber.cpp index 2a67cc6e19b..f6082fef192 100644 --- a/cpp/demo/IceStorm/clock/Subscriber.cpp +++ b/cpp/demo/IceStorm/clock/Subscriber.cpp @@ -46,7 +46,7 @@ main(int argc, char* argv[]) void usage(const string& n) { - cerr << "Usage: " << n << " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]\n" << endl; + cerr << "Usage: " << n << " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]" << endl; } int @@ -113,23 +113,35 @@ Subscriber::run(int argc, char* argv[]) // // Set up the proxy. // + int optsSet = 0; if(opts.isSet("datagram")) { subscriber = subscriber->ice_datagram(); + ++optsSet; } - else if(opts.isSet("twoway")) + if(opts.isSet("twoway")) { - // Do nothing. + // Do nothing to the subscriber proxy. Its already twoway. + ++optsSet; } - else if(opts.isSet("ordered")) + if(opts.isSet("ordered")) { qos["reliability"] = "ordered"; - subscriber = subscriber->ice_datagram(); + // Do nothing to the subscriber proxy. Its already twoway. + ++optsSet; } - else // default. + if(opts.isSet("oneway") || optsSet == 0) { subscriber = subscriber->ice_oneway(); + ++optsSet; } + + if(optsSet != 1) + { + usage(appName()); + return EXIT_FAILURE; + } + if(opts.isSet("batch")) { if(opts.isSet("twoway") || opts.isSet("ordered")) @@ -153,9 +165,6 @@ Subscriber::run(int argc, char* argv[]) shutdownOnInterrupt(); communicator()->waitForShutdown(); - // - // Unsubscribe all subscribed objects. - // topic->unsubscribe(subscriber); return EXIT_SUCCESS; |