summaryrefslogtreecommitdiff
path: root/cpp/demo/IceStorm
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/IceStorm')
-rw-r--r--cpp/demo/IceStorm/clock/Publisher.cpp58
-rw-r--r--cpp/demo/IceStorm/clock/Subscriber.cpp84
-rw-r--r--cpp/demo/IceStorm/counter/Client.cpp78
-rw-r--r--cpp/demo/IceStorm/counter/CounterI.cpp2
-rw-r--r--cpp/demo/IceStorm/counter/Server.cpp28
-rw-r--r--cpp/demo/IceStorm/replicated/Publisher.cpp2
-rw-r--r--cpp/demo/IceStorm/replicated/Subscriber.cpp40
7 files changed, 146 insertions, 146 deletions
diff --git a/cpp/demo/IceStorm/clock/Publisher.cpp b/cpp/demo/IceStorm/clock/Publisher.cpp
index c779a97e0c7..166a2c8c3fa 100644
--- a/cpp/demo/IceStorm/clock/Publisher.cpp
+++ b/cpp/demo/IceStorm/clock/Publisher.cpp
@@ -52,22 +52,22 @@ Publisher::run(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
string topicName = "time";
if(!remaining.empty())
{
- topicName = remaining.front();
+ topicName = remaining.front();
}
//
@@ -76,19 +76,19 @@ Publisher::run(int argc, char* argv[])
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve(topicName);
+ topic = manager->retrieve(topicName);
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
}
//
@@ -99,38 +99,38 @@ Publisher::run(int argc, char* argv[])
int optsSet = 0;
if(opts.isSet("datagram"))
{
- publisher = publisher->ice_datagram();
- ++optsSet;
+ publisher = publisher->ice_datagram();
+ ++optsSet;
}
else if(opts.isSet("twoway"))
{
- // Do nothing.
- ++optsSet;
+ // Do nothing.
+ ++optsSet;
}
else if(opts.isSet("oneway") || optsSet == 0)
{
- publisher = publisher->ice_oneway();
- ++optsSet;
+ publisher = publisher->ice_oneway();
+ ++optsSet;
}
if(optsSet != 1)
{
- usage(appName());
- return EXIT_FAILURE;
+ usage(appName());
+ return EXIT_FAILURE;
}
ClockPrx clock = ClockPrx::uncheckedCast(publisher);
cout << "publishing tick events. Press ^C to terminate the application." << endl;
try
{
- while(true)
- {
- clock->tick(IceUtil::Time::now().toDateTime());
+ while(true)
+ {
+ clock->tick(IceUtil::Time::now().toDateTime());
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
- }
+ }
}
catch(const Ice::CommunicatorDestroyedException&)
{
- // Ignore
+ // Ignore
}
return EXIT_SUCCESS;
diff --git a/cpp/demo/IceStorm/clock/Subscriber.cpp b/cpp/demo/IceStorm/clock/Subscriber.cpp
index f6082fef192..abc593c8b0b 100644
--- a/cpp/demo/IceStorm/clock/Subscriber.cpp
+++ b/cpp/demo/IceStorm/clock/Subscriber.cpp
@@ -25,7 +25,7 @@ public:
virtual void
tick(const string& time, const Ice::Current&)
{
- cout << time << endl;
+ cout << time << endl;
}
};
@@ -66,41 +66,41 @@ Subscriber::run(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(appName());
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(appName());
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
string topicName = "time";
if(!remaining.empty())
{
- topicName = remaining.front();
+ topicName = remaining.front();
}
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve(topicName);
+ topic = manager->retrieve(topicName);
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Clock.Subscriber");
@@ -116,47 +116,47 @@ Subscriber::run(int argc, char* argv[])
int optsSet = 0;
if(opts.isSet("datagram"))
{
- subscriber = subscriber->ice_datagram();
- ++optsSet;
+ subscriber = subscriber->ice_datagram();
+ ++optsSet;
}
if(opts.isSet("twoway"))
{
- // Do nothing to the subscriber proxy. Its already twoway.
- ++optsSet;
+ // Do nothing to the subscriber proxy. Its already twoway.
+ ++optsSet;
}
if(opts.isSet("ordered"))
{
- qos["reliability"] = "ordered";
- // Do nothing to the subscriber proxy. Its already twoway.
- ++optsSet;
+ qos["reliability"] = "ordered";
+ // Do nothing to the subscriber proxy. Its already twoway.
+ ++optsSet;
}
if(opts.isSet("oneway") || optsSet == 0)
{
- subscriber = subscriber->ice_oneway();
- ++optsSet;
+ subscriber = subscriber->ice_oneway();
+ ++optsSet;
}
if(optsSet != 1)
{
- usage(appName());
- return EXIT_FAILURE;
+ usage(appName());
+ return EXIT_FAILURE;
}
if(opts.isSet("batch"))
{
- if(opts.isSet("twoway") || opts.isSet("ordered"))
- {
- cerr << appName() << ": batch can only be set with oneway or datagram" << endl;
- return EXIT_FAILURE;
- }
- if(opts.isSet("datagram"))
- {
- subscriber = subscriber->ice_batchDatagram();
- }
- else
- {
- subscriber = subscriber->ice_batchOneway();
- }
+ if(opts.isSet("twoway") || opts.isSet("ordered"))
+ {
+ cerr << appName() << ": batch can only be set with oneway or datagram" << endl;
+ return EXIT_FAILURE;
+ }
+ if(opts.isSet("datagram"))
+ {
+ subscriber = subscriber->ice_batchDatagram();
+ }
+ else
+ {
+ subscriber = subscriber->ice_batchOneway();
+ }
}
topic->subscribeAndGetPublisher(qos, subscriber);
diff --git a/cpp/demo/IceStorm/counter/Client.cpp b/cpp/demo/IceStorm/counter/Client.cpp
index 82fa66270c0..863b90f9bcd 100644
--- a/cpp/demo/IceStorm/counter/Client.cpp
+++ b/cpp/demo/IceStorm/counter/Client.cpp
@@ -40,15 +40,15 @@ Client::run(int argc, char* argv[])
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
+ return EXIT_FAILURE;
}
CounterPrx counter = CounterPrx::uncheckedCast(communicator()->stringToProxy(proxy));
if(!counter)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
MTPrinterPtr printer = new MTPrinter();
@@ -65,36 +65,36 @@ Client::run(int argc, char* argv[])
char c;
do
{
- try
- {
- printer->print("==> ");
- cin >> c;
- if(c == 'i')
- {
- counter->inc(1);
- }
- else if(c == 'd')
- {
- counter->inc(-1);
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu(printer);
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu(printer);
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ printer->print("==> ");
+ cin >> c;
+ if(c == 'i')
+ {
+ counter->inc(1);
+ }
+ else if(c == 'd')
+ {
+ counter->inc(-1);
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu(printer);
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu(printer);
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -107,9 +107,9 @@ void
Client::menu(const MTPrinterPtr& printer)
{
printer->print(
- "usage:\n"
- "i: increment the counter\n"
- "d: decrement the counter\n"
- "x: exit\n"
- "?: help\n");
+ "usage:\n"
+ "i: increment the counter\n"
+ "d: decrement the counter\n"
+ "x: exit\n"
+ "?: help\n");
}
diff --git a/cpp/demo/IceStorm/counter/CounterI.cpp b/cpp/demo/IceStorm/counter/CounterI.cpp
index 9391cec441f..ff9fad3d1f2 100644
--- a/cpp/demo/IceStorm/counter/CounterI.cpp
+++ b/cpp/demo/IceStorm/counter/CounterI.cpp
@@ -32,7 +32,7 @@ CounterI::subscribe(const CounterObserverPrx& observer, const Ice::Current&)
// the given subscriber.
//
CounterObserverPrx o = CounterObserverPrx::uncheckedCast(
- _topic->subscribeAndGetPublisher(IceStorm::QoS(), observer));
+ _topic->subscribeAndGetPublisher(IceStorm::QoS(), observer));
o->init(_value);
}
diff --git a/cpp/demo/IceStorm/counter/Server.cpp b/cpp/demo/IceStorm/counter/Server.cpp
index 33bbcb4c8aa..838b7d11efa 100644
--- a/cpp/demo/IceStorm/counter/Server.cpp
+++ b/cpp/demo/IceStorm/counter/Server.cpp
@@ -40,33 +40,33 @@ Server::run(int argc, char* argv[])
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy(proxy));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve("counter");
+ topic = manager->retrieve("counter");
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create("counter");
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": topic exists, please try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create("counter");
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": topic exists, please try again." << endl;
+ return EXIT_FAILURE;
+ }
}
//
diff --git a/cpp/demo/IceStorm/replicated/Publisher.cpp b/cpp/demo/IceStorm/replicated/Publisher.cpp
index c1d1d1ec52b..cf432841e02 100644
--- a/cpp/demo/IceStorm/replicated/Publisher.cpp
+++ b/cpp/demo/IceStorm/replicated/Publisher.cpp
@@ -54,7 +54,7 @@ Publisher::run(int argc, char* argv[])
catch(const IceStorm::NoSuchTopic&)
{
cerr << appName() << ": topics not created yet, run subscriber." << endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
//
diff --git a/cpp/demo/IceStorm/replicated/Subscriber.cpp b/cpp/demo/IceStorm/replicated/Subscriber.cpp
index 8755650cf9f..a6fbc11e35d 100644
--- a/cpp/demo/IceStorm/replicated/Subscriber.cpp
+++ b/cpp/demo/IceStorm/replicated/Subscriber.cpp
@@ -72,34 +72,34 @@ Subscriber::run(int argc, char* argv[])
Ice::ObjectProxySeq::const_iterator p;
for(p = managers.begin(); p != managers.end(); ++p)
{
- //
- // Add a Servant for the Ice Object.
- //
- IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(*p);
+ //
+ // Add a Servant for the Ice Object.
+ //
+ IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(*p);
- try
- {
+ try
+ {
topic = manager->retrieve(topicName);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
- }
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
+ }
}
Ice::ObjectProxySeq topics = query->findAllReplicas(topic);
for(p = topics.begin(); p != topics.end(); ++p)
{
topic = IceStorm::TopicPrx::uncheckedCast(*p);
- topic->subscribeAndGetPublisher(IceStorm::QoS(), clock);
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), clock);
}
adapter->activate();