summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-28 23:57:20 +0000
committervishal <vishal@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-28 23:57:20 +0000
commit43fddf3d7698c1fbb9cad5d23bc7ed8bc3ce3748 (patch)
tree9853cf358b76ac7a01868f831eeda44337ed3d05
parent0692584ee09e489d26a786810226eb49fd02ea2f (diff)
downloadATCD-43fddf3d7698c1fbb9cad5d23bc7ed8bc3ce3748.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-99c7
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/TAO_TIO.cpp103
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp133
-rw-r--r--TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp48
4 files changed, 150 insertions, 141 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index d60abf10786..c41f216b24c 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,10 @@
+Sun Mar 28 17:55:10 1999 Vishal Kachroo <vishal@merengue.cs.wustl.edu>
+
+ Replaced the TAO exception macros with ACE exception macros.
+ * orbsvcs/orbsvcs/Time/Timer_Helper.cpp (handle_timeout):
+ * orbsvcs/orbsvcs/Time/TAO_UTO.cpp
+ * orbsvcs/orbsvcs/Time/TAO_TIO.cpp
+
Sun Mar 28 14:58:50 1999 Balachandran Natarajan <bala@cs.wustl.edu>
* tests/Param_Test/any.cpp
diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_TIO.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_TIO.cpp
index bd10df73bcf..321af53b610 100644
--- a/TAO/orbsvcs/orbsvcs/Time/TAO_TIO.cpp
+++ b/TAO/orbsvcs/orbsvcs/Time/TAO_TIO.cpp
@@ -33,30 +33,35 @@ TAO_TIO::time_interval (CORBA::Environment &)
CosTime::OverlapType
TAO_TIO::spans (CosTime::UTO_ptr uto,
CosTime::TIO_out overlap,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
TAO_TIO *tio = 0;
-
- TAO_TRY
+
+ ACE_TRY
{
TimeBase::TimeT lb1 =
- this->time_interval (TAO_TRY_ENV).lower_bound;
+ this->time_interval (ACE_TRY_ENV).lower_bound;
+ ACE_TRY_CHECK;
+
TimeBase::TimeT up1 =
- this->time_interval (TAO_TRY_ENV).upper_bound;
+ this->time_interval (ACE_TRY_ENV).upper_bound;
+ ACE_TRY_CHECK;
+
TimeBase::TimeT lb2 =
- uto->time (TAO_TRY_ENV) - uto->inaccuracy (TAO_TRY_ENV);
+ uto->time (ACE_TRY_ENV) - uto->inaccuracy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
TimeBase::TimeT up2 =
- uto->time (TAO_TRY_ENV) + uto->inaccuracy (TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
-
+ uto->time (ACE_TRY_ENV) + uto->inaccuracy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
if (lb1 == lb2 && up1 == up2)
{
ACE_NEW_RETURN (tio,
TAO_TIO (lb1, up1),
CosTime::OTNoOverlap);
overlap = tio->_this ();
-
+
return CosTime::OTOverlap;
}
else if (lb1 > lb2 && up1 < up2)
@@ -64,7 +69,7 @@ TAO_TIO::spans (CosTime::UTO_ptr uto,
ACE_NEW_RETURN (tio,
TAO_TIO (lb1, up1),
CosTime::OTNoOverlap);
-
+
overlap = tio->_this ();
return CosTime::OTContained;
@@ -122,11 +127,12 @@ TAO_TIO::spans (CosTime::UTO_ptr uto,
}
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception:");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV, "Exception:");
}
- TAO_ENDTRY;
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CosTime::OTNoOverlap);
return CosTime::OTNoOverlap;
}
@@ -140,22 +146,22 @@ TAO_TIO::spans (CosTime::UTO_ptr uto,
CosTime::OverlapType
TAO_TIO::overlaps (CosTime::TIO_ptr tio,
CosTime::TIO_out overlap,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
TAO_TIO *tio_i = 0;
-
- TAO_TRY
+
+ ACE_TRY
{
TimeBase::TimeT lb1 =
- this->time_interval (TAO_TRY_ENV).lower_bound;
+ this->time_interval (ACE_TRY_ENV).lower_bound;
TimeBase::TimeT up1 =
- this->time_interval (TAO_TRY_ENV).upper_bound;
+ this->time_interval (ACE_TRY_ENV).upper_bound;
TimeBase::TimeT lb2 =
- tio->time_interval (TAO_TRY_ENV).lower_bound;
+ tio->time_interval (ACE_TRY_ENV).lower_bound;
TimeBase::TimeT up2 =
- tio->time_interval (TAO_TRY_ENV).upper_bound;
+ tio->time_interval (ACE_TRY_ENV).upper_bound;
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
if (lb1 == lb2 && up1 == up2)
{
@@ -164,7 +170,7 @@ TAO_TIO::overlaps (CosTime::TIO_ptr tio,
CosTime::OTNoOverlap);
overlap = tio_i->_this ();
-
+
return CosTime::OTOverlap;
}
else if (lb1 > lb2 && up1 < up2)
@@ -174,7 +180,7 @@ TAO_TIO::overlaps (CosTime::TIO_ptr tio,
CosTime::OTNoOverlap);
overlap = tio_i->_this ();
-
+
return CosTime::OTContained;
}
else if (lb1 < lb2 && up1 > up2)
@@ -230,42 +236,31 @@ TAO_TIO::overlaps (CosTime::TIO_ptr tio,
}
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception:");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV,"Exception:");
}
- TAO_ENDTRY;
-
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CosTime::OTNoOverlap);
+
return CosTime::OTNoOverlap;
}
CosTime::UTO_ptr
-TAO_TIO::time (CORBA::Environment &TAO_IN_ENV)
+TAO_TIO::time (CORBA::Environment &ACE_TRY_ENV)
{
TAO_UTO *uto = 0;
-
- TAO_TRY
- {
- // @@ Vishal: I can't convert ACE_NEW_THROW_RETURN for you
- // because the code doesn't make any sense at all wrt exception
- // handling. You can't return from a try block directly. Please
- // ask me or Bala if you have any questions.
-
- ACE_NEW_THROW_RETURN (uto,
- TAO_UTO ((this->time_interval (TAO_TRY_ENV).upper_bound -
- this->time_interval (TAO_TRY_ENV).lower_bound) / 2,
- this->time_interval (TAO_TRY_ENV).upper_bound -
- this->time_interval (TAO_TRY_ENV).lower_bound,
- 0),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- CosTime::UTO::_nil ());
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Exception:");
- return CosTime::UTO::_nil ();
- }
- TAO_ENDTRY;
+
+ ACE_NEW_THROW_EX (uto,
+ TAO_UTO ((this->time_interval (ACE_TRY_ENV).upper_bound -
+ this->time_interval (ACE_TRY_ENV).lower_bound) / 2,
+ this->time_interval (ACE_TRY_ENV).upper_bound -
+ this->time_interval (ACE_TRY_ENV).lower_bound,
+ 0),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+
+ ACE_CHECK_RETURN (CosTime::UTO::_nil ());
+
return uto->_this ();
}
+
diff --git a/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp b/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp
index 43a7c96c251..c6461a5304a 100644
--- a/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp
+++ b/TAO/orbsvcs/orbsvcs/Time/TAO_UTO.cpp
@@ -90,62 +90,63 @@ TAO_UTO::absolute_time (CORBA::Environment &)
CosTime::TimeComparison
TAO_UTO::compare_time (CosTime::ComparisonType comparison_type,
CosTime::UTO_ptr uto,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
- TAO_TRY
+ ACE_TRY
{
if (comparison_type == CosTime::MidC)
{
- if (this->time (TAO_TRY_ENV) == uto->time (TAO_TRY_ENV))
+ if (this->time (ACE_TRY_ENV) == uto->time (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
return CosTime::TCEqualTo;
}
- else if (this->time (TAO_TRY_ENV) > uto->time (TAO_TRY_ENV))
+ else if (this->time (ACE_TRY_ENV) > uto->time (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
return CosTime::TCGreaterThan;
}
else
return CosTime::TCLessThan;
}
- else if (this->time (TAO_TRY_ENV) == uto->time (TAO_TRY_ENV))
+ else if (this->time (ACE_TRY_ENV) == uto->time (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
- if (this->inaccuracy (TAO_TRY_ENV) == 0 && uto->inaccuracy (TAO_TRY_ENV) == 0)
+ ACE_TRY_CHECK;
+ if (this->inaccuracy (ACE_TRY_ENV) == 0 && uto->inaccuracy (ACE_TRY_ENV) == 0)
{
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
return CosTime::TCEqualTo;
}
}
else
{
- if (this->time (TAO_TRY_ENV) > uto->time (TAO_TRY_ENV))
+ if (this->time (ACE_TRY_ENV) > uto->time (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
- if (this->time (TAO_TRY_ENV) - this->inaccuracy (TAO_TRY_ENV)
- > uto->time (TAO_TRY_ENV) - uto->inaccuracy (TAO_TRY_ENV))
+ ACE_TRY_CHECK;
+ if (this->time (ACE_TRY_ENV) - this->inaccuracy (ACE_TRY_ENV)
+ > uto->time (ACE_TRY_ENV) - uto->inaccuracy (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
return CosTime::TCGreaterThan;
}
}
- else if (this->time (TAO_TRY_ENV) + this->inaccuracy (TAO_TRY_ENV)
- < uto->time (TAO_TRY_ENV) - uto->inaccuracy (TAO_TRY_ENV))
+ else if (this->time (ACE_TRY_ENV) + this->inaccuracy (ACE_TRY_ENV)
+ < uto->time (ACE_TRY_ENV) - uto->inaccuracy (ACE_TRY_ENV))
{
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
return CosTime::TCLessThan;
}
}
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception:");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV, "Exception:");
}
- TAO_ENDTRY;
-
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CosTime::TCIndeterminate);
+
return CosTime::TCIndeterminate;
}
@@ -157,72 +158,74 @@ TAO_UTO::compare_time (CosTime::ComparisonType comparison_type,
CosTime::TIO_ptr
TAO_UTO::time_to_interval (CosTime::UTO_ptr uto,
- CORBA::Environment &TAO_IN_ENV)
+ CORBA::Environment &ACE_TRY_ENV)
{
TAO_TIO *tio = 0;
- // @@ Vishal: This code doesn't make any sense to me also.
-
- TAO_TRY
+ ACE_TRY
{
- if (this->time (TAO_TRY_ENV) > uto->time (TAO_TRY_ENV))
- ACE_NEW_THROW_RETURN (tio,
- TAO_TIO (uto->time (TAO_TRY_ENV),
- this->time (TAO_TRY_ENV)),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- CosTime::TIO::_nil ());
+ if (this->time (ACE_TRY_ENV) > uto->time (ACE_TRY_ENV))
+ {
+ ACE_NEW_THROW_EX (tio,
+ TAO_TIO (uto->time (ACE_TRY_ENV),
+ this->time (ACE_TRY_ENV)),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+
+ ACE_TRY_CHECK;
+ }
else
- ACE_NEW_THROW_RETURN (tio,
- TAO_TIO (this->time (TAO_TRY_ENV),
- uto->time (TAO_TRY_ENV)),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- CosTime::TIO::_nil ());
- TAO_CHECK_ENV;
-
+ {
+ ACE_NEW_THROW_EX (tio,
+ TAO_TIO (this->time (ACE_TRY_ENV),
+ uto->time (ACE_TRY_ENV)),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+
+ ACE_TRY_CHECK;
+ }
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception:");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV, "Exception:");
return CosTime::TIO::_nil ();
}
- TAO_ENDTRY;
-
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CosTime::TIO::_nil ());
+
return tio->_this ();
}
- // Returns a TIO object representing the error interval around the
- // time value in the UTO.
+// Returns a TIO object representing the error interval around the
+// time value in the UTO.
CosTime::TIO_ptr
-TAO_UTO::interval (CORBA::Environment &TAO_IN_ENV)
+TAO_UTO::interval (CORBA::Environment &ACE_TRY_ENV)
{
TAO_TIO *tio = 0;
-
- TAO_TRY
+
+ ACE_TRY
{
TimeBase::TimeT lower =
- this->time (TAO_TRY_ENV) - this->inaccuracy (TAO_TRY_ENV);
- TAO_CHECK_ENV;
+ this->time (ACE_TRY_ENV) - this->inaccuracy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
TimeBase::TimeT upper =
- this->time (TAO_TRY_ENV) + this->inaccuracy (TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // @@ Vishal: So is this code. You can't throw_return from a try
- // block.
- ACE_NEW_THROW_RETURN (tio,
- TAO_TIO (lower,
- upper),
- CORBA::NO_MEMORY (CORBA::COMPLETED_NO),
- CosTime::TIO::_nil ());
- TAO_CHECK_ENV;
+ this->time (ACE_TRY_ENV) + this->inaccuracy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_NEW_THROW_EX (tio,
+ TAO_TIO (lower,
+ upper),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
+ ACE_TRY_CHECK;
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception:");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV, "Exception:");
return CosTime::TIO::_nil ();
}
- TAO_ENDTRY;
-
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (CosTime::TIO::_nil ());
+
return tio->_this ();
}
+
diff --git a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp
index 286ca0088d4..334541a6d55 100644
--- a/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp
+++ b/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.cpp
@@ -29,7 +29,7 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &,
{
int no_of_servers = 0;
CORBA::ULongLong sum = 0;
-
+
// The following are used to keep a track of the inaccuracy
// in synchronization.
@@ -40,8 +40,9 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &,
#endif
CORBA::ULongLong highest_time = 0;
-
- TAO_TRY
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
{
IORS::TYPE* value;
for (IORS::ITERATOR server_iterator (this->clerk_->server_);
@@ -51,43 +52,45 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &,
// This is a remote call.
CosTime::UTO_var UTO_server =
- (*value)->universal_time (TAO_TRY_ENV);
+ (*value)->universal_time (ACE_TRY_ENV);
- TAO_CHECK_ENV;
+ ACE_TRY_CHECK;
#if defined (ACE_LACKS_LONGLONG_T)
ACE_DEBUG ((LM_DEBUG,
"\nTime = %Q\nInaccuracy = %Q\nTimeDiff = %d\nstruct.time = %Q\n"
"struct.inacclo = %d\nstruct.inacchi = %d\nstruct.Tdf = %d\n",
- ACE_U64_TO_U32 (UTO_server->time (TAO_TRY_ENV)),
- ACE_U64_TO_U32 (UTO_server->inaccuracy (TAO_TRY_ENV)),
- UTO_server->tdf (TAO_TRY_ENV),
+ ACE_U64_TO_U32 (UTO_server->time (ACE_TRY_ENV)),
+ ACE_U64_TO_U32 (UTO_server->inaccuracy (ACE_TRY_ENV)),
+ UTO_server->tdf (ACE_TRY_ENV),
ACE_U64_TO_U32 ((UTO_server->utc_time ()).time),
(UTO_server->utc_time ()).inacclo,
(UTO_server->utc_time ()).inacchi,
(UTO_server->utc_time ()).tdf));
-
+
#else
ACE_DEBUG ((LM_DEBUG,
"\nTime = %Q\nInaccuracy = %Q\nTimeDiff = %d\nstruct.time = %Q\n"
"struct.inacclo = %d\nstruct.inacchi = %d\nstruct.Tdf = %d\n",
- UTO_server->time (TAO_TRY_ENV),
- UTO_server->inaccuracy (TAO_TRY_ENV),
- UTO_server->tdf (TAO_TRY_ENV),
+ UTO_server->time (ACE_TRY_ENV),
+ UTO_server->inaccuracy (ACE_TRY_ENV),
+ UTO_server->tdf (ACE_TRY_ENV),
(UTO_server->utc_time ()).time,
(UTO_server->utc_time ()).inacclo,
(UTO_server->utc_time ()).inacchi,
(UTO_server->utc_time ()).tdf));
#endif
-
- CORBA::ULongLong curr_server_time = UTO_server->time (TAO_TRY_ENV);
+
+ CORBA::ULongLong curr_server_time = UTO_server->time (ACE_TRY_ENV);
+
+ ACE_TRY_CHECK;
sum += curr_server_time;
-
+
++no_of_servers;
-
+
// Set the highest time to the largest time seen so far.
if (curr_server_time > highest_time)
highest_time = curr_server_time;
@@ -95,13 +98,13 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &,
// Set the lowest time to the smallest time seen so far.
if (curr_server_time < lowest_time)
lowest_time = curr_server_time;
-
+
}
ACE_DEBUG ((LM_DEBUG,
"\nUpdated time from %d servers in the network",
no_of_servers));
-
+
// Return the average of the times retrieved from the various
// servers.
clerk_->time_ = sum / no_of_servers ;
@@ -125,13 +128,14 @@ Timer_Helper::handle_timeout (const ACE_Time_Value &,
+ ACE_OS::gettimeofday ().usec () * 10;
}
- TAO_CATCHANY
+ ACE_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Exception in the handle_timeout ()\n");
+ ACE_PRINT_EXCEPTION (ACE_TRY_ENV, "Exception in the handle_timeout ()\n");
return -1;
}
- TAO_ENDTRY;
-
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
return 0;
}