summaryrefslogtreecommitdiff
path: root/TAO/examples/Advanced/ch_8_and_10/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples/Advanced/ch_8_and_10/client.cpp')
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/client.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/TAO/examples/Advanced/ch_8_and_10/client.cpp b/TAO/examples/Advanced/ch_8_and_10/client.cpp
index 5843c985ac0..8d8203cf140 100644
--- a/TAO/examples/Advanced/ch_8_and_10/client.cpp
+++ b/TAO/examples/Advanced/ch_8_and_10/client.cpp
@@ -118,7 +118,7 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
return;
CCS::AssetType anum = tmstat->asset_num();
- try
+ try
{
std::cout << "Setting thermostat " << anum
<< " to " << new_temp << " degrees." << std::endl;
@@ -127,8 +127,8 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
<< old_nominal << std::endl;
std::cout << "New nominal temperature is: "
<< tmstat->get_nominal() << std::endl;
- }
- catch (const CCS::Thermostat::BadTemp & bt)
+ }
+ catch (const CCS::Thermostat::BadTemp & bt)
{
std::cerr << "Setting of nominal temperature failed." << std::endl;
std::cerr << bt.details << std::endl; // Overloaded <<
@@ -140,13 +140,13 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
- try
+ try
{
// Initialize the ORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// Check arguments
- if (argc != 2)
+ if (argc != 2)
{
std::cerr << "Usage: client IOR_string" << std::endl;
throw 0;
@@ -155,7 +155,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Get controller reference from argv
// and convert to object.
CORBA::Object_var obj = orb->string_to_object(argv[1]);
- if (CORBA::is_nil(obj.in()))
+ if (CORBA::is_nil(obj.in()))
{
std::cerr << "Nil controller reference" << std::endl;
throw 0;
@@ -163,18 +163,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Try to narrow to CCS::Controller.
CCS::Controller_var ctrl;
- try
+ try
{
ctrl = CCS::Controller::_narrow(obj.in());
- }
- catch (const CORBA::SystemException & se)
+ }
+ catch (const CORBA::SystemException & se)
{
std::cerr << "Cannot narrow controller reference: "
- //<< se
+ << se
<< std::endl;
throw 0;
}
- if (CORBA::is_nil(ctrl.in()))
+ if (CORBA::is_nil(ctrl.in()))
{
std::cerr << "Wrong type for controller ref." << std::endl;
throw 0;
@@ -207,23 +207,24 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Check that the location was updated
std::cout << "New details for device "
<< anum << " are:" << std::endl;
- std::cout << list[(CORBA::ULong) 0] << std::endl;
+ CCS::Thermometer_ptr tx = list[0u];
+ std::cout << tx << std::endl;
// Find first thermostat in list.
CCS::Thermostat_var tmstat;
for ( CORBA::ULong j = 0;
j < list->length() && CORBA::is_nil(tmstat.in());
- j++)
+ j++)
{
tmstat = CCS::Thermostat::_narrow(list[j]);
}
// Check that we found a thermostat on the list.
- if (CORBA::is_nil(tmstat.in()))
+ if (CORBA::is_nil(tmstat.in()))
{
std::cout << "No thermostat devices in list." << std::endl;
- }
- else
+ }
+ else
{
// Set temperature of thermostat to
// 50 degrees (should work).
@@ -255,7 +256,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// containing only thermostats.
std::cout << "Increasing thermostats by 40 degrees." << std::endl;
CCS::Controller::ThermostatSeq tss;
- for (CORBA::ULong l = 0; l < list->length(); l++)
+ for (CORBA::ULong l = 0; l < list->length(); l++)
{
tmstat = CCS::Thermostat::_narrow(list[l]);
if (CORBA::is_nil(tmstat.in()))
@@ -266,23 +267,23 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
// Try to change all thermostats.
- try
+ try
{
ctrl->change(tss, 40);
- }
- catch (const CCS::Controller::EChange & ec)
+ }
+ catch (const CCS::Controller::EChange & ec)
{
std::cerr << ec; // Overloaded <<
}
- }
- catch (const CORBA::Exception & e)
+ }
+ catch (const CORBA::Exception & e)
{
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
- }
- catch (...)
+ }
+ catch (...)
{
return 1;
}