Removed remove(iterator) (no longer needed), m_remove() simplified.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1688 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-09-25 12:39:06 +00:00
parent fb7a7ed849
commit e55997e614
2 changed files with 4 additions and 22 deletions

View File

@ -113,18 +113,9 @@ void ListenerManager::m_remove(index_t idx)
}
}
ListenerManager::iterator ListenerManager::m_remove(iterator it, bool skip_deletelist)
ListenerManager::iterator ListenerManager::m_remove(iterator it)
{
if (!skip_deletelist) {
// If skip_deletelist = true, m_remove was called from makeActive. Accordingly, we
// are not going to delete an listener, instead we are "moving" a listener object (= *it)
// from the buffer list to the fire-list. Therefore we only need to call the simulator's
// listener handler (onDeletion), if m_remove is called with the primary intention
// to *delete* (not "move") a listener.
(*it)->onDeletion();
m_DeleteList.push_back(*it);
}
(*it)->onDeletion();
// This has O(1) time complexity due to a underlying std::vector (-> random access iterator)
index_t dist = std::distance(begin(), it);
assert((*it)->getPerformanceBuffer() == NULL &&
@ -211,7 +202,7 @@ ListenerManager::iterator ListenerManager::makeActive(iterator it)
li->resetCounter();
// Note: This is the one and only situation in which remove() should NOT
// store the removed item in the delete-list.
iterator it_next = m_remove(it, true); // remove listener from buffer-list
iterator it_next = m_remove(it); // remove listener from buffer-list
m_FireList.push_back(li);
return it_next;
}

View File

@ -90,23 +90,14 @@ public:
* buffer-list implementation.
*/
void remove(BaseListener* li);
/**
* Behaves like remove(BaseListener*) and additionally updates the provided
* iterator.
* @param it the iterator pointing to the Listener object to be removed
* @return the updated iterator which will point to the next element
*/
iterator remove(iterator it) { return m_remove(it, false); }
private:
/**
* Internal implementation of remove(iterator it) that allows
* to skip the delete-list.
* @param it the iterator pointing to the Listener object to be removed
* @param skip_deletelist \c true to skip the deletion of the Listener object
* or \false to behave like \c remove(iterator)
* @return the updated iterator which will point to the next element
*/
iterator m_remove(iterator it, bool skip_deletelist);
iterator m_remove(iterator it);
/**
* Updates the buffer-list by "removing" the element located at index \c idx.
* This is done by replacing the element with the last element of the vector.