Logo Search packages:      
Sourcecode: tagcoll version File versions  Download package

template<class ITEM, class TAG>
void CardinalityStore::applyChange ( const PatchList< ITEM, TAG > &  change  )  [inline, virtual]

Apply a patch to the collection


 void perform(const PatchList<ITEM, TAG>& change)

Implements Tagcoll::Collection< ITEM, TAG >.

Definition at line 57 of file CardinalityStore.cc.

References Tagcoll::Consumer< ITEM, TAG >::consume(), and Tagcoll::Collection< ITEM, TAG >::getTags().

      // Tagsets to be deleted because they became empty
      for (typename PatchList<ITEM, TAG>::const_iterator i = change.begin(); i != change.end(); i++)
            OpSet<TAG> oldts = getTags(i->first);
            OpSet<TAG> newts = i->second.apply(oldts);

            // Remove the item from the old tagset
            typename tagsets_t::iterator oldi = tagsets.find(oldts);
            if (oldi != tagsets.end())
                  oldi->second -= i->first;
                  if (oldi->second.empty())

                  // Decrement the tag cardinalities accordingly
                  for (typename OpSet<TAG>::const_iterator j = oldts.begin();
                              j != oldts.end(); j++)
                        tags.del(*j, 1);

            // Re-add the item with the new tagset
            if (!newts.empty())
                  consume(i->first, newts);

Generated by  Doxygen 1.6.0   Back to index