PatchCollection.h

Go to the documentation of this file.
00001 #ifndef TAGCOLL_PATCHCOLLECTION_H
00002 #define TAGCOLL_PATCHCOLLECTION_H
00003 
00008 /*
00009  * Copyright (C) 2005  Enrico Zini <enrico@debian.org>
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00026 #include <tagcoll/Collection.h>
00027 #include <tagcoll/Patches.h>
00028 
00029 namespace Tagcoll
00030 {
00031 
00036 template<class ITEM, class TAG>
00037 class PatchCollection : public Collection<ITEM, TAG>
00038 {
00039 protected:
00040     const Collection<ITEM, TAG>& coll;
00041     PatchList<ITEM, TAG> changes;
00042 
00043     virtual void consumeItem(const ITEM& item, const OpSet<TAG>& tags);
00044 
00045     virtual OpSet<ITEM> getItemsHavingTag(const TAG& tag) const;
00046     virtual OpSet<TAG> getTagsOfItem(const ITEM& item) const;
00047 
00048 
00049 public:
00050     PatchCollection(const Collection<ITEM, TAG>& coll) : coll(coll) {}
00051     virtual ~PatchCollection() {}
00052 
00056     const PatchList<ITEM, TAG>& getChanges() const { return changes; }
00057 
00061     void setChanges(const PatchList<ITEM, TAG>& changes);
00062 
00063     virtual bool hasTag(const TAG& tag) const;
00064 
00065     virtual OpSet<ITEM> getTaggedItems() const;
00066     virtual OpSet<TAG> getAllTags() const;
00067 
00068     virtual int getCardinality(const TAG& tag) const;
00069 
00070     virtual void applyChange(const PatchList<ITEM, TAG>& change);
00071 
00072     virtual void output(Consumer<ITEM, TAG>& consumer) const;
00073 };
00074 
00075 };
00076 
00077 // vim:set ts=4 sw=4:
00078 #endif

Generated on Fri Mar 24 23:00:29 2006 for libtagcoll by  doxygen 1.4.6