use exceptions instead of hard abort
This commit is contained in:
@@ -21,6 +21,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#ifndef EDGE_H
|
||||
#define EDGE_H
|
||||
|
||||
|
||||
#include "../Util/OSRMException.h"
|
||||
#include <cassert>
|
||||
|
||||
class NodeBasedEdge {
|
||||
@@ -40,8 +42,34 @@ public:
|
||||
return (source() < e.source());
|
||||
}
|
||||
|
||||
explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra, bool ig, bool ar, bool cf) :
|
||||
_source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _contraFlow(cf) { if(ty < 0) {ERR("Type: " << ty);}; }
|
||||
explicit NodeBasedEdge(
|
||||
NodeID s,
|
||||
NodeID t,
|
||||
NodeID n,
|
||||
EdgeWeight w,
|
||||
bool f,
|
||||
bool b,
|
||||
short ty,
|
||||
bool ra,
|
||||
bool ig,
|
||||
bool ar,
|
||||
bool cf
|
||||
) : _source(s),
|
||||
_target(t),
|
||||
_name(n),
|
||||
_weight(w),
|
||||
forward(f),
|
||||
backward(b),
|
||||
_type(ty),
|
||||
_roundabout(ra),
|
||||
_ignoreInGrid(ig),
|
||||
_accessRestricted(ar),
|
||||
_contraFlow(cf)
|
||||
{
|
||||
if(ty < 0) {
|
||||
throw OSRMException("negative edge type");
|
||||
}
|
||||
}
|
||||
|
||||
NodeID target() const {return _target; }
|
||||
NodeID source() const {return _source; }
|
||||
|
||||
@@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "PhantomNodes.h"
|
||||
#include "StaticRTree.h"
|
||||
#include "../Contractor/EdgeBasedGraphFactory.h"
|
||||
#include "../Util/OSRMException.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@@ -126,10 +127,14 @@ private:
|
||||
const std::string & nodes_file,
|
||||
const std::string & edges_file
|
||||
) {
|
||||
std::ifstream nodes_input_stream(nodes_file.c_str(), std::ios::binary);
|
||||
if(!nodes_input_stream) { ERR(nodes_file << " not found"); }
|
||||
std::ifstream edges_input_stream(edges_file.c_str(), std::ios::binary);
|
||||
if(!edges_input_stream) { ERR(edges_file << " not found"); }
|
||||
std::ifstream nodes_input_stream(nodes_file.c_str(), std::ios::binary);
|
||||
if(!nodes_input_stream) {
|
||||
throw OSRMException("nodes file not found");
|
||||
}
|
||||
std::ifstream edges_input_stream(edges_file.c_str(), std::ios::binary);
|
||||
if(!edges_input_stream) {
|
||||
throw OSRMException("edges file not found");
|
||||
}
|
||||
|
||||
DEBUG("Loading node data");
|
||||
NodeInfo b;
|
||||
|
||||
Reference in New Issue
Block a user