From 10682d9c7c9a0d9b856e19fb797a4174616db7b1 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 25 Jan 2011 17:15:56 +0000 Subject: [PATCH] * ./crlcore: - Change: In RoutingLayerGauge, no longer throw exception when the position requested it outside the track grid. Instead returns first/last track index. --- crlcore/src/ccore/RoutingLayerGauge.cpp | 38 +++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/crlcore/src/ccore/RoutingLayerGauge.cpp b/crlcore/src/ccore/RoutingLayerGauge.cpp index 64df8ee5..25b15175 100644 --- a/crlcore/src/ccore/RoutingLayerGauge.cpp +++ b/crlcore/src/ccore/RoutingLayerGauge.cpp @@ -223,15 +223,19 @@ namespace CRL { trace << "depth := " << depth << endl; - if ( depth < 0 ) - throw Error ( negativeIndex - , getString(this).c_str() - , DbU::getValueString(position).c_str() - , DbU::getValueString(start).c_str() - , DbU::getValueString(stop).c_str() - ); + if ( depth < 0 ) { + trace_out (); + return 0; - if ( ( mode & Constant::Exact ) && ( modulo != 0 ) ) + // throw Error ( negativeIndex + // , getString(this).c_str() + // , DbU::getValueString(position).c_str() + // , DbU::getValueString(start).c_str() + // , DbU::getValueString(stop).c_str() + // ); + } + + if ( ( mode & Constant::Exact ) and ( modulo != 0 ) ) throw Error ( badExactPosition, getString(this).c_str(), DbU::getValueString(position).c_str() ); if ( mode & Constant::Superior ) { @@ -240,13 +244,17 @@ namespace CRL { if ( modulo > _pitch / 2 ) depth++; } - if ( (unsigned)depth >= getTrackNumber(start,stop) ) - throw Error ( overflowIndex - , getString(this).c_str() - , DbU::getValueString(position).c_str() - , DbU::getValueString(start).c_str() - , DbU::getValueString(stop).c_str() - ); + unsigned int tracksNumber = getTrackNumber(start,stop); + if ( (unsigned)depth >= tracksNumber ) { + trace_out (); + return (tracksNumber > 0) ? tracksNumber-1 : 0; + // throw Error ( overflowIndex + // , getString(this).c_str() + // , DbU::getValueString(position).c_str() + // , DbU::getValueString(start).c_str() + // , DbU::getValueString(stop).c_str() + // ); + } trace_out ();