- Fix JumpTo dialog the better I can. Now it should work.

- TODO: manage exceptions both in Simulation::jump_to()
and in JumpToDialog
- TODO: check the semantic of _target_instant, maybe its value
is 1 more than expected?


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1036 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-07 09:32:24 +00:00
parent eb0a49eeec
commit 3fe76dad2d
2 changed files with 58 additions and 12 deletions

View file

@ -19,6 +19,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "concrete_simulation.hh"
#include <sgpemv2/simulation_observer.hh>
#include <sgpemv2/scheduler.hh>
#include <sgpemv2/cpu_policies_gatekeeper.hh>
@ -61,7 +62,7 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
switch (_state)
{
case state_running:
// pauses the simulation (see below)
// pauses the simulation (done below)
break;
case state_stopped:
_history.set_front(0);
@ -72,7 +73,6 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
// Disable momentarily updates for registered observers on
// sgpem::Simulation too.
// See History for an example of how to implement this.
set_notify_enabled(false);
pause();
@ -83,8 +83,16 @@ ConcreteSimulation::jump_to(History::position p) throw(UserInterruptException, N
History::position increment = 0;
while (yet_to_finish && p > _history.get_front() + increment)
{
yet_to_finish = step();
increment++;
try
{
yet_to_finish = step();
increment++;
}
catch(...)
{
// FIXME: manage exceptions! Lookout that notifications
// have to be re-enabled.
}
}
get_history().set_front(std::min(p, _history.get_size()));
if (!yet_to_finish)