- Write interface for History and ConcreteHistory

- Write interface for HistoryObserver
- Remove obsolete interfaces


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@690 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-02 15:27:30 +00:00
parent 759b90b017
commit b8f7083bfc
13 changed files with 236 additions and 431 deletions

View file

@ -29,15 +29,15 @@ void
ReadyQueue::swap(position a, position b)
throw (std::out_of_range)
{
size_t size = _scheds.size();
if(a > size || b > size)
throw std::out_of_range(_("Trying to access a Schedulable "
"with an index outside of the "
"queue limits."));
if(a == b) return;
Schedulable* temp = _scheds[a];
_scheds[a] = _scheds[b];
// Usage of "at()" isn't casual:
// at() checks indexes, "[]" doesn't.
// Once we've done the check once, we
// can assume it's safe to use "[]";
// this for performance reasons.
Schedulable* temp = _scheds.at(a);
_scheds[a] = _scheds.at(b);
_scheds[b] = temp;
}
@ -53,11 +53,8 @@ sgpem::Schedulable&
ReadyQueue::get_item_at(position index)
throw (std::out_of_range)
{
if(index > size())
throw std::out_of_range(_("Trying to access a Schedulable "
"with an index outside of the "
"queue limits."));
return *(_scheds[index]);
// Checks index access
return *_scheds.at(index);
}