- Add History::clear() to empty an existing history (equivalent

to removing all of its resources and all of its processes, but
faster)


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@887 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-16 21:25:08 +00:00
parent 0933d63344
commit 0b4db098eb
3 changed files with 14 additions and 0 deletions

View File

@ -290,6 +290,17 @@ ConcreteHistory::remove(SubRequest& subrequest)
} }
void
ConcreteHistory::clear()
{
for_each(_snapshots.begin(), _snapshots.end(),
deletor<ConcreteEnvironment>());
_snapshots.clear();
_snapshots.push_back(new ConcreteEnvironment());
assert(_snapshots.size() == 1);
}
ConcreteHistory::ResourcePair ConcreteHistory::ResourcePair
ConcreteHistory::add_resource(const Glib::ustring& name, ConcreteHistory::add_resource(const Glib::ustring& name,
bool preemptable, bool preemptable,

View File

@ -60,6 +60,7 @@ namespace sgpem
virtual void remove(Request& request); virtual void remove(Request& request);
virtual void remove(SubRequest& subrequest); virtual void remove(SubRequest& subrequest);
virtual void clear();
virtual ResourcePair add_resource(const Glib::ustring& name, virtual ResourcePair add_resource(const Glib::ustring& name,
bool preemptable = false, bool preemptable = false,

View File

@ -77,6 +77,8 @@ namespace sgpem
virtual void remove(Request& request) = 0; virtual void remove(Request& request) = 0;
virtual void remove(SubRequest& subrequest) = 0; virtual void remove(SubRequest& subrequest) = 0;
// \brief Clears the whole history
virtual void clear() = 0;
virtual ResourcePair add_resource(const Glib::ustring& name, virtual ResourcePair add_resource(const Glib::ustring& name,
bool preemptable = false, bool preemptable = false,