00001 #ifndef TAGCOLL_INPUTMERGER_H
00002 #define TAGCOLL_INPUTMERGER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #pragma interface
00025
00026 #include <tagcoll/TagcollConsumer.h>
00027 #include <tagcoll/TagcollChange.h>
00028
00029 #include <map>
00030
00031 namespace Tagcoll
00032 {
00033
00034 template<class ITEM>
00035 class PatchList;
00036
00037
00038
00039 template<class T, class Tag>
00040 class InputMerger : public TagcollConsumer<T, Tag>
00041 {
00042 protected:
00043 std::map< T, OpSet<Tag> > coll;
00044
00045 public:
00046 virtual ~InputMerger<T, Tag>() throw () {}
00047
00048 virtual void consume(const T& item) throw ();
00049 virtual void consume(const T& item, const OpSet<Tag>& tags) throw ();
00050
00051
00052 bool hasItem(const T& item) const throw () { return coll.find(item) != coll.end(); }
00053
00054
00055 OpSet<Tag> getTagsetForItem(const T& item) const throw ();
00056
00057
00058 void output(TagcollConsumer<T, Tag>& consumer) const throw ();
00059
00060
00061
00062 TagcollChange<T, Tag> applyChange(const TagcollChange<T, Tag>& change) throw ();
00063
00064
00065 OpSet<Tag> getAllTags() const throw ();
00066
00067
00068
00069 OpSet<Tag> getCompanionTags(const OpSet<Tag>& ts) const throw ();
00070
00071
00072 OpSet<T> getRelatedItems(const T& item, int maxdistance = 1) const throw ();
00073
00074
00075 OpSet<T> getRelatedItems(const OpSet<Tag>& ts, int maxdistance = 1) const throw ();
00076
00077
00078 OpSet<T> getItemsContaining(const OpSet<Tag>& ts) const throw ();
00079
00080 friend class PatchList<T>;
00081 };
00082
00083 };
00084
00085
00086 #endif