- Added full-featured jumpto command.
- Minor fixes on the gui. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@901 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
d8694b2f5b
commit
df4b32f1ba
9 changed files with 339 additions and 68 deletions
|
@ -18,11 +18,18 @@
|
|||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "simulation.hh"
|
||||
#include "simulation_observer.hh"
|
||||
#include "concrete_simulation.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
// Do not include in header file:
|
||||
#include "singleton.tcc"
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
|
@ -37,3 +44,47 @@ Simulation::get_instance()
|
|||
{
|
||||
return Singleton<ConcreteSimulation>::get_instance();
|
||||
}
|
||||
|
||||
void
|
||||
Simulation::attach(SimulationObserver& observer)
|
||||
{
|
||||
_observers.push_back(&observer);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Simulation::detach(const SimulationObserver& observer)
|
||||
{
|
||||
_observers.erase(std::find(_observers.begin(),
|
||||
_observers.end(),
|
||||
&observer));
|
||||
}
|
||||
|
||||
unsigned int Simulation::get_front() const
|
||||
{
|
||||
return _front;
|
||||
}
|
||||
|
||||
void
|
||||
Simulation::notify_change()
|
||||
{
|
||||
//if (!_notify) return; // what's the purpose of this?
|
||||
|
||||
for (RegisteredObservers::iterator it = _observers.begin();
|
||||
it != _observers.end(); it++)
|
||||
(*it)->update(*this);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Simulation::set_notify_enabled(bool enabled)
|
||||
{
|
||||
bool old_value = _notify;
|
||||
_notify = enabled;
|
||||
|
||||
// Force notify if we re-enable it
|
||||
if (old_value == false && _notify == true)
|
||||
notify_change();
|
||||
|
||||
return old_value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue