12 template <
typename TItemType>
16 bool m_cancellingAndRemovingAll;
19 typedef std::set<TItemType*> TContainer;
20 typedef typename TContainer::iterator TIterator;
21 typedef typename TContainer::size_type TSize;
27 : m_cancellingAndRemovingAll(
false)
32 CancelAndRemoveAllItems();
35 void InsertItem(TItemType& item)
37 std::pair<TIterator, bool> result = m_items.insert(&item);
38 Eegeo_ASSERT(result.second,
"Failed to insert item into PendingItemsContainer.\n");
41 void RemoveItem(TItemType& item)
43 if (!m_cancellingAndRemovingAll)
45 size_t numRemoved = m_items.erase(&item);
46 Eegeo_ASSERT(numRemoved == 1,
"Failed to remove item from PendingItemsContainer.\n");
50 void CancelAndRemoveAllItems()
52 m_cancellingAndRemovingAll =
true;
53 for(TIterator it = m_items.begin(); it != m_items.end(); ++ it)
55 TItemType& item = **it;
60 m_cancellingAndRemovingAll =
false;
65 return m_items.size();