/* * ChangeTracker.cpp * * Created on: Mar 1, 2010 * Author: metzler */ #include "ChangeTracker.hpp" ChangeTracker* ChangeTracker::instance = NULL; ChangeTracker::ChangeTracker() { isConsistent = true; World::get()->signOn(this); } ChangeTracker::~ChangeTracker() { World::get()->signOff(this); } ChangeTracker* ChangeTracker::get() { if (instance == NULL) { instance = new ChangeTracker(); } return instance; } void ChangeTracker::destroy() { delete instance; instance = NULL; } void ChangeTracker::update(Observable *publisher) { isConsistent = false; } bool ChangeTracker::hasChanged() { return !isConsistent; } void ChangeTracker::saveStatus() { if (hasChanged()) { notifyAll(); } }