X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockiter.cpp;h=038600bbffa933a25c6e5022790b04437b4000dc;hb=54392d65e2053d1eacb4cfcc435f1013993f2973;hp=c39f88ed55ca595ac5e67c69d75b995c16ffac80;hpb=d15ac13f2e170f155b4bbd124df48400c339b644;p=r2c2.git diff --git a/source/libr2c2/blockiter.cpp b/source/libr2c2/blockiter.cpp index c39f88e..038600b 100644 --- a/source/libr2c2/blockiter.cpp +++ b/source/libr2c2/blockiter.cpp @@ -1,4 +1,3 @@ -#include #include "block.h" #include "blockiter.h" #include "route.h" @@ -19,7 +18,7 @@ BlockIter::BlockIter(Block *b, unsigned e): _entry(b ? e : 0) { if(_block && _entry>_block->get_endpoints().size()) - throw InvalidParameterValue("Endpoint index not valid for block"); + throw out_of_range("BlockIter::BlockIter"); } TrackIter BlockIter::track_iter() const @@ -27,14 +26,13 @@ TrackIter BlockIter::track_iter() const if(!_block) return TrackIter(); - const Block::Endpoint &ep = _block->get_endpoint(_entry); - return TrackIter(ep.track, ep.track_ep); + return _block->get_endpoint(_entry).track_iter(); } const Block::Endpoint &BlockIter::endpoint() const { if(!_block) - throw InvalidState("BlockIter is null"); + throw logic_error("null block"); return _block->get_endpoint(_entry); } @@ -47,7 +45,7 @@ int BlockIter::get_exit(const Route *route) const while(t_iter) { if(!_block->has_track(*t_iter)) - throw LogicError("Block traversal strayed out of the block"); + throw logic_error("internal error (block traversal escaped the block)"); unsigned path = (route ? route->get_path(*t_iter) : t_iter->get_active_path()); TrackIter t_exit = t_iter.reverse(path); @@ -105,7 +103,7 @@ BlockIter BlockIter::flip() const Block &BlockIter::operator*() const { if(!_block) - throw InvalidState("BlockIter is null"); + throw logic_error("null block"); return *_block; }