replacing cassert by boost asserts

This commit is contained in:
Dennis Luxen 2013-09-20 11:35:59 +02:00
parent 0cabc81693
commit c85f6c1228

View File

@ -28,9 +28,9 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "../Util/ContainerUtils.h" #include "../Util/ContainerUtils.h"
#include "../Util/SimpleLogger.h" #include "../Util/SimpleLogger.h"
#include <boost/assert.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <cassert>
#include <climits> #include <climits>
#include <stack> #include <stack>
@ -82,7 +82,7 @@ public:
const NodeID to = facade->GetTarget(edge); const NodeID to = facade->GetTarget(edge);
const int edgeWeight = data.distance; const int edgeWeight = data.distance;
assert( edgeWeight > 0 ); BOOST_ASSERT_MSG( edgeWeight > 0, "edgeWeight invalid" );
if(_forwardHeap.WasInserted( to )) { if(_forwardHeap.WasInserted( to )) {
if(_forwardHeap.GetKey( to ) + edgeWeight < distance) { if(_forwardHeap.GetKey( to ) + edgeWeight < distance) {
@ -100,7 +100,7 @@ public:
const NodeID to = facade->GetTarget(edge); const NodeID to = facade->GetTarget(edge);
const int edgeWeight = data.distance; const int edgeWeight = data.distance;
assert( edgeWeight > 0 ); BOOST_ASSERT_MSG( edgeWeight > 0, "edgeWeight invalid" );
const int toDistance = distance + edgeWeight; const int toDistance = distance + edgeWeight;
//New Node discovered -> Add to Heap + Node Info Storage //New Node discovered -> Add to Heap + Node Info Storage
@ -150,7 +150,7 @@ public:
} }
} }
} }
assert(smallestWeight != INT_MAX); BOOST_ASSERT_MSG(smallestWeight != INT_MAX, "edge id invalid");
const typename DataFacadeT::EdgeData& ed = facade->GetEdgeData(smallestEdge); const typename DataFacadeT::EdgeData& ed = facade->GetEdgeData(smallestEdge);
if(ed.shortcut) {//unpack if(ed.shortcut) {//unpack
@ -159,7 +159,7 @@ public:
recursionStack.push(std::make_pair(middle, edge.second)); recursionStack.push(std::make_pair(middle, edge.second));
recursionStack.push(std::make_pair(edge.first, middle)); recursionStack.push(std::make_pair(edge.first, middle));
} else { } else {
assert(!ed.shortcut); BOOST_ASSERT_MSG(!ed.shortcut, "edge must be a shortcut");
unpackedPath.push_back( unpackedPath.push_back(
_PathData( _PathData(
ed.id, ed.id,
@ -200,7 +200,7 @@ public:
} }
} }
} }
assert(smallestWeight != INT_MAX); BOOST_ASSERT_MSG(smallestWeight != INT_MAX, "edge weight invalid");
const typename DataFacadeT::EdgeData& ed = facade->GetEdgeData(smallestEdge); const typename DataFacadeT::EdgeData& ed = facade->GetEdgeData(smallestEdge);
if(ed.shortcut) {//unpack if(ed.shortcut) {//unpack
@ -209,7 +209,7 @@ public:
recursionStack.push(std::make_pair(middle, edge.second)); recursionStack.push(std::make_pair(middle, edge.second));
recursionStack.push(std::make_pair(edge.first, middle)); recursionStack.push(std::make_pair(edge.first, middle));
} else { } else {
assert(!ed.shortcut); BOOST_ASSERT_MSG(!ed.shortcut, "edge must be shortcut");
unpackedPath.push_back(edge.first ); unpackedPath.push_back(edge.first );
} }
} }