-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include <algorithm>
#include <msp/time/units.h>
#include "block.h"
{
unsigned path = 1<<i;
endpoints[i].paths |= path;
- find_paths(TrackIter(endpoints[i].track, endpoints[i].track_ep), path);
+ find_paths(endpoints[i].track_iter(), path);
}
if(sensor_id && layout.has_driver())
const Block::Endpoint &Block::get_endpoint(unsigned i) const
{
if(i>=endpoints.size())
- throw InvalidParameterValue("Endpoint index out of range");
+ throw out_of_range("Block::get_endpoint");
return endpoints[i];
}
float Block::get_path_length(unsigned entry, const Route *route) const
{
if(entry>=endpoints.size())
- throw InvalidParameterValue("Endpoint index out of range");
+ throw out_of_range("Block::get_path_length");
- TrackIter t_iter(endpoints[entry].track, endpoints[entry].track_ep);
+ TrackIter t_iter = endpoints[entry].track_iter();
float result = 0;
while(t_iter && has_track(*t_iter))
Block *Block::get_link(unsigned epi) const
{
if(epi>=endpoints.size())
- throw InvalidParameterValue("Endpoint index out of range");
+ throw out_of_range("Block::get_link");
return endpoints[epi].link;
}
}
}
-void Block::find_paths(TrackIter track, unsigned path)
+void Block::find_paths(const TrackIter &track, unsigned path)
{
unsigned mask = track.endpoint().paths;
for(unsigned i=0; mask>>i; ++i)
paths(0)
{ }
+TrackIter Block::Endpoint::track_iter() const
+{
+ return TrackIter(track, track_ep);
+}
+
} // namespace R2C2