00001 #ifndef TAGCOLL_TAG_TO_STRING_H
00002 #define TAGCOLL_TAG_TO_STRING_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #pragma interface
00026
00027 #include <tagcoll/TagcollConsumer.h>
00028 #include <tagcoll/OpSet.h>
00029 #include <tagcoll/Tag.h>
00030
00031 namespace Tagcoll
00032 {
00033
00034 template<class T>
00035 class StringsToTags : public TagcollConsumer<T, std::string>
00036 {
00037 protected:
00038 FacetSet& vocab;
00039 TagcollConsumer<T, Tag>* consumer;
00040
00041 public:
00042 StringsToTags(FacetSet& vocab) throw () : vocab(vocab), consumer(0) {}
00043 StringsToTags(FacetSet& vocab, TagcollConsumer<T, Tag>* consumer) throw ()
00044 : vocab(vocab), consumer(consumer) {}
00045 virtual ~StringsToTags() throw () {}
00046
00047 TagcollConsumer<T, Tag>* getConsumer() throw () { return consumer; }
00048 void setConsumer(TagcollConsumer<T, Tag>* consumer) throw () { this->consumer = consumer; }
00049
00050
00051 virtual void consume(const T& item) throw ();
00052 virtual void consume(const T& item, const OpSet<std::string>& tags) throw ();
00053 virtual void consume(const OpSet<T>& items) throw ();
00054 virtual void consume(const OpSet<T>& items, const OpSet<std::string>& tags) throw ();
00055 };
00056
00057 template<class T>
00058 class TagsToStrings : public TagcollConsumer<T, Tag>
00059 {
00060 protected:
00061 TagcollConsumer<T, std::string>* consumer;
00062
00063 public:
00064 TagsToStrings() throw () : consumer(0) {}
00065 TagsToStrings(TagcollConsumer<T, std::string>* consumer) throw () : consumer(consumer) {}
00066 virtual ~TagsToStrings() throw () {}
00067
00068 TagcollConsumer<T, std::string>* getConsumer() throw () { return consumer; }
00069 void setConsumer(TagcollConsumer<T, std::string>* consumer) throw () { this->consumer = consumer; }
00070
00071
00072 virtual void consume(const T& item) throw ();
00073 virtual void consume(const T& item, const OpSet<Tag>& tags) throw ();
00074 virtual void consume(const OpSet<T>& items) throw ();
00075 virtual void consume(const OpSet<T>& items, const OpSet<Tag>& tags) throw ();
00076 };
00077
00078 };
00079
00080
00081 #endif