[Debtags-commits] [svn] r1759 - in tagcoll/2.0: . bench tagcoll tagcoll/coll tagcoll/stream tools

Enrico Zini enrico at costa.debian.org
Thu May 11 02:37:07 UTC 2006


Author: enrico
Date: Thu May 11 02:35:54 2006
New Revision: 1759

Modified:
   tagcoll/2.0/   (props changed)
   tagcoll/2.0/bench/collection.cc
   tagcoll/2.0/tagcoll/Patches.tcc
   tagcoll/2.0/tagcoll/coll/base.h
   tagcoll/2.0/tagcoll/coll/fast.cc
   tagcoll/2.0/tagcoll/coll/fast.h
   tagcoll/2.0/tagcoll/coll/fast.tcc
   tagcoll/2.0/tagcoll/coll/intdiskindex.cc
   tagcoll/2.0/tagcoll/coll/intdiskindex.h
   tagcoll/2.0/tagcoll/coll/patched.cc
   tagcoll/2.0/tagcoll/coll/patched.h
   tagcoll/2.0/tagcoll/coll/simple.cc
   tagcoll/2.0/tagcoll/coll/simple.h
   tagcoll/2.0/tagcoll/stream/sink.h
   tagcoll/2.0/tagcoll/test-utils.tcc
   tagcoll/2.0/tools/tagcoll.cc
Log:
 r2694 at viaza:  enrico | 2006-05-10 16:10:51 -0500
 Renamed the getItems* and getTags* methods to have a (hopefully) easier to remember scheme.  I'm still not happy about it, though


Modified: tagcoll/2.0/bench/collection.cc
==============================================================================
--- tagcoll/2.0/bench/collection.cc	(original)
+++ tagcoll/2.0/bench/collection.cc	Thu May 11 02:35:54 2006
@@ -147,19 +147,19 @@
 	}{
 		Timer t = mktimer("getTags[item]");
 		for (size_t i = 0; i < items.size(); i++)
-			coll.getTags(items[i]);
+			coll.getTagsOfItem(items[i]);
 	}{
 		Timer t = mktimer("getTags[items]");
 		for (size_t i = 0; i < itemsets.size(); i++)
-			coll.getMergedTags(itemsets[i]);
+			coll.getTagsOfItems(itemsets[i]);
 	}{
 		Timer t = mktimer("getItems[tag]");
 		for (size_t i = 0; i < tags.size(); i++)
-			coll.getItems(tags[i]);
+			coll.getItemsHavingTag(tags[i]);
 	}{
 		Timer t = mktimer("getItems[tags]");
 		for (size_t i = 0; i < tagsets.size(); i++)
-			coll.getCommonItems(tagsets[i]);
+			coll.getItemsHavingTags(tagsets[i]);
 	}{
 		Timer t = mktimer("getTaggedItems");
 		coll.getTaggedItems();
@@ -361,4 +361,6 @@
 
 }
 
+#include <tagcoll/coll/simple.tcc>
+
 /* vim:set ts=4 sw=4: */

Modified: tagcoll/2.0/tagcoll/Patches.tcc
==============================================================================
--- tagcoll/2.0/tagcoll/Patches.tcc	(original)
+++ tagcoll/2.0/tagcoll/Patches.tcc	Thu May 11 02:35:54 2006
@@ -56,7 +56,7 @@
 	for (typename COLL1::const_iterator i1 = im1.begin();
 			i1 != im1.end(); ++i1)
 	{
-		std::set<TAG> ts2 = im2.getTags(i1->first);
+		std::set<TAG> ts2 = im2.getTagsOfItem(i1->first);
 		std::set<TAG> added = ts2 - i1->second;
 		std::set<TAG> removed = i1->second - ts2;
 		if (!added.empty() || !removed.empty())

Modified: tagcoll/2.0/tagcoll/coll/base.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/base.h	(original)
+++ tagcoll/2.0/tagcoll/coll/base.h	Thu May 11 02:35:54 2006
@@ -42,6 +42,8 @@
 template<typename Self>
 class ReadonlyCollection
 {
+	const Self& self() const { return *static_cast<const Self*>(this); }
+
 	/**
 	 * Get the items which are tagged with at least the tag `tag'
 	 *
@@ -72,7 +74,7 @@
 	 */
 	bool hasTag(const typename coll_traits<Self>::tag_type& tag) const
 	{
-		return !static_cast<const Self*>(this)->getItems(tag).empty();
+		return !self().getItemsHavingTag(tag).empty();
 	}
 
 	/**
@@ -90,13 +92,13 @@
 	 *   exist.
 	 */
 	template<typename ITEMS>
-	typename coll_traits<Self>::tagset_type getMergedTags(const ITEMS& items) const
+	typename coll_traits<Self>::tagset_type getTagsOfItems(const ITEMS& items) const
 	{
 		using namespace wibble::operators;
 		typename coll_traits<Self>::tagset_type res;
 		for (typename ITEMS::const_iterator i = items.begin();
 				i != items.end(); i++)
-			res |= static_cast<const Self*>(this)->getTags(*i);
+			res |= self().getTagsOfItem(*i);
 		return res;
 	}
 
@@ -113,17 +115,17 @@
 	 *   The items found, or an empty set if no items have that tag
 	 */
 	template<typename TAGS>
-	typename coll_traits<Self>::itemset_type getCommonItems(const TAGS& tags) const 
+	typename coll_traits<Self>::itemset_type getItemsHavingTags(const TAGS& tags) const 
 	{
 		using namespace wibble::operators;
 		if (tags.empty())
 			return typename coll_traits<Self>::itemset_type();
 
 		typename TAGS::const_iterator i = tags.begin();
-		typename coll_traits<Self>::itemset_type res = static_cast<const Self*>(this)->getItems(*i);
+		typename coll_traits<Self>::itemset_type res = self().getItemsHavingTag(*i);
 
 		for ( ; i != tags.end(); ++i)
-			res &= static_cast<const Self*>(this)->getItems(*i);
+			res &= self().getItemsHavingTag(*i);
 
 		return res;
 	}
@@ -143,7 +145,7 @@
 	 */
 	int getCardinality(const typename coll_traits<Self>::tag_type& tag) const
 	{
-		return getItemsHavingTag(tag).size();
+		return self().getItemsHavingTag(tag).size();
 	}
 
 	/**
@@ -163,7 +165,7 @@
 	typename coll_traits<Self>::tagset_type getCompanionTags(const TAGS& tags) const
 	{
 		using namespace wibble::operators;
-		return getMergedTags(getCommonItems(tags)) - tags;
+		return self().getTagsOfItems(self().getItemsHavingTags(tags)) - tags;
 	}
 
 	/**
@@ -207,12 +209,12 @@
 
 		// First get a list of packages that have a non-empty intersection with `tags'
 		for (typename TAGS::const_iterator i = tags.begin(); i != tags.end(); i++)
-			packages |= static_cast<const Self*>(this)->getItems(*i);
+			packages |= self().getItemsHavingTag(*i);
 
 		// Then keep only those within the given distance
 		for (typename coll_traits<Self>::itemset_type::const_iterator i = packages.begin(); i != packages.end(); i++)
 		{
-			int dist = utils::set_distance(tags, static_cast<const Self*>(this)->getTags(*i));
+			int dist = utils::set_distance(tags, self().getTagsOfItem(*i));
 			if (dist >= 0 && dist <= maxdistance)
 				res |= *i;
 		}
@@ -226,8 +228,8 @@
 	template<typename OUT>
 	void output(OUT out) const
 	{
-		for (typename Self::const_iterator i = static_cast<const Self*>(this)->begin();
-				i != static_cast<const Self*>(this)->end(); ++i)
+		for (typename Self::const_iterator i = self().begin();
+				i != self().end(); ++i)
 		{
 			*out = make_pair(wibble::singleton(i->first), i->second);
 			++out;
@@ -241,11 +243,11 @@
 	template<typename TAGS, typename OUT>
 	void outputHavingTags(const TAGS& tags, OUT out) const
 	{
-		typename coll_traits<Self>::itemset_type items = getItemsHavingTags(tags);
+		typename coll_traits<Self>::itemset_type items = self().getItemsHavingTags(tags);
 		for (typename coll_traits<Self>::itemset_type::const_iterator i = items.begin();
 				i != items.end(); ++i)
 		{
-			*out = std::make_pair(*i, getTagsOfItem(*i));
+			*out = std::make_pair(*i, self().getTagsOfItem(*i));
 			++out;
 		}
 	}

Modified: tagcoll/2.0/tagcoll/coll/fast.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/fast.cc	(original)
+++ tagcoll/2.0/tagcoll/coll/fast.cc	Thu May 11 02:35:54 2006
@@ -107,7 +107,7 @@
 	set<string> ts;
 	ts.insert("tomato"); ts.insert("mozzarella");
 
-	set<string> items = coll.getCommonItems(ts);
+	set<string> items = coll.getItemsHavingTags(ts);
 	ensure_equals(items.size(), 2u);
 	ensure_contains(items, string("margherita"));
 	ensure_contains(items, string("funghi"));

Modified: tagcoll/2.0/tagcoll/coll/fast.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/fast.h	(original)
+++ tagcoll/2.0/tagcoll/coll/fast.h	Thu May 11 02:35:54 2006
@@ -73,6 +73,8 @@
 	template<typename ITEMS, typename TAGS>
 	void insert(const ITEMS& items, const TAGS& tags)
 	{
+		using namespace wibble::operators;
+
 		if (tags.empty())
 			return;
 
@@ -97,8 +99,8 @@
 		}
 	}
 
-	std::set<TAG> getTags(const ITEM& item) const;
-	std::set<ITEM> getItems(const TAG& tag) const;
+	std::set<TAG> getTagsOfItem(const ITEM& item) const;
+	std::set<ITEM> getItemsHavingTag(const TAG& tag) const;
 
 	bool empty() const { return items.empty(); }
 
@@ -122,7 +124,7 @@
 	// Return the items which have the exact tagset 'tags'
 	std::set<ITEM> getItemsExactMatch(const std::set<TAG>& tags) const
 	{
-		std::set<ITEM> res = getCommonItems(tags);
+		std::set<ITEM> res = getItemsHavingTags(tags);
 		typename std::set<ITEM>::iterator i = res.begin();
 		while (i != res.end())
 		{

Modified: tagcoll/2.0/tagcoll/coll/fast.tcc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/fast.tcc	(original)
+++ tagcoll/2.0/tagcoll/coll/fast.tcc	Thu May 11 02:35:54 2006
@@ -33,7 +33,7 @@
 namespace coll {
 
 template<class ITEM, class TAG>
-std::set<ITEM> Fast<ITEM, TAG>::getItems(const TAG& tag) const
+std::set<ITEM> Fast<ITEM, TAG>::getItemsHavingTag(const TAG& tag) const
 {
 	typename map<TAG, std::set<ITEM> >::const_iterator i = tags.find(tag);
 	if (i != tags.end())
@@ -43,7 +43,7 @@
 }
 
 template<class ITEM, class TAG>
-std::set<TAG> Fast<ITEM, TAG>::getTags(const ITEM& item) const
+std::set<TAG> Fast<ITEM, TAG>::getTagsOfItem(const ITEM& item) const
 {
 	typename map<ITEM, std::set<TAG> >::const_iterator i = items.find(item);
 	if (i != items.end())
@@ -88,7 +88,7 @@
 	for (typename PatchList<ITEM, TAG>::const_iterator i = change.begin(); i != change.end(); i++)
 	{
 		// Save the previous tagset in `rev'
-		std::set<TAG> prevTags = getTags(i->first);
+		std::set<TAG> prevTags = getTagsOfItem(i->first);
 		std::set<TAG> nextTags = i->second.apply(prevTags);
 
 		// Set the new tagset in the item
@@ -98,7 +98,7 @@
 		std::set<TAG> t = prevTags - nextTags;
 		for (typename std::set<TAG>::const_iterator j = t.begin(); j != t.end(); j++)
 		{
-			std::set<TAG> items = getItems(*j) - i->first;
+			std::set<TAG> items = getItemsHavingTag(*j) - i->first;
 			if (items.empty())
 				tags.erase(*j);
 			else
@@ -115,7 +115,7 @@
 {
 	// tag1 implies tag2 if the itemset of tag1 is a subset of the itemset of tag2
 	std::set<TAG> res;
-	std::set<ITEM> itemsToCheck = getItems(tag);
+	std::set<ITEM> itemsToCheck = getItemsHavingTag(tag);
 	// TODO: choose which one is the most efficient implementation
 #if 0
 	// Roughly:
@@ -132,7 +132,7 @@
 	// O(ntags * n[items per tag])
 	for (typename std::map<TAG, std::set<ITEM> >::const_iterator i = tags.begin();
 			i != tags.end(); ++i)
-		if (utils::set_contains(itemsToCheck, getItems(i->first)))
+		if (utils::set_contains(itemsToCheck, getItemsHavingTag(i->first)))
 			res |= i->first;
 #endif
 	return res - tag;

Modified: tagcoll/2.0/tagcoll/coll/intdiskindex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/intdiskindex.cc	(original)
+++ tagcoll/2.0/tagcoll/coll/intdiskindex.cc	Thu May 11 02:35:54 2006
@@ -304,17 +304,17 @@
 	}
 };
 
-std::set<int> IntDiskIndex::getItems(const int& tag) const
+std::set<int> IntDiskIndex::getItemsHavingTag(const int& tag) const
 {
 	return std::set<int>(IntSetIterator(tagidx.data(tag), tagidx.size(tag)), IntSetIterator());
 }
 
-std::set<int> IntDiskIndex::getCommonItems(const std::set<int>& tags) const
+std::set<int> IntDiskIndex::getItemsHavingTags(const std::set<int>& tags) const
 {
 	if (tags.empty())
 		return std::set<int>();
 	if (tags.size() == 1)
-		return getItems(*tags.begin());
+		return getItemsHavingTag(*tags.begin());
 
 	// Create a vector with the item lists
 	IntSets items;
@@ -323,12 +323,12 @@
 	return items.intersect();
 }
 
-std::set<int> IntDiskIndex::getTags(const int& item) const
+std::set<int> IntDiskIndex::getTagsOfItem(const int& item) const
 {
 	return std::set<int>(IntSetIterator(pkgidx.data(item), pkgidx.size(item)), IntSetIterator());
 }
 
-std::set<int> IntDiskIndex::getMergedTags(const std::set<int>& items) const
+std::set<int> IntDiskIndex::getTagsOfItems(const std::set<int>& items) const
 {
 	if (items.empty())
 		return std::set<int>();
@@ -543,7 +543,7 @@
 
 		std::pair< std::string, std::set<std::string> > operator*() const
 		{
-			return std::make_pair(index.itemconv(idx), index.tagconv(index.index.getTags(idx)));
+			return std::make_pair(index.itemconv(idx), index.tagconv(index.index.getTagsOfItem(idx)));
 		}
 		std::pair< std::string, std::set<std::string> >* operator->() const
 		{
@@ -569,21 +569,21 @@
 	StringDiskIndex(const diskindex::MasterMMap& master, int pkgindex, int tagindex, BigMap& items, BigMap& tags)
 		: index(master, pkgindex, tagindex), items(items), tags(tags) {}
 
-	std::set<std::string> getItems(const std::string& tag) const
+	std::set<std::string> getItemsHavingTag(const std::string& tag) const
 	{
-		return itemconv(index.getItems(tagconv(tag)));
+		return itemconv(index.getItemsHavingTag(tagconv(tag)));
 	}
-	std::set<std::string> getCommonItems(const std::set<std::string>& tags) const
+	std::set<std::string> getItemsHavingTags(const std::set<std::string>& tags) const
 	{
-		return itemconv(index.getCommonItems(tagconv(tags)));
+		return itemconv(index.getItemsHavingTags(tagconv(tags)));
 	}
-	std::set<std::string> getTags(const std::string& item) const
+	std::set<std::string> getTagsOfItem(const std::string& item) const
 	{
-		return tagconv(index.getTags(itemconv(item)));
+		return tagconv(index.getTagsOfItem(itemconv(item)));
 	}
-	std::set<std::string> getMergedTags(const std::set<std::string>& items) const
+	std::set<std::string> getTagsOfItems(const std::set<std::string>& items) const
 	{
-		return tagconv(index.getMergedTags(itemconv(items)));
+		return tagconv(index.getTagsOfItems(itemconv(items)));
 	}
 
     bool hasTag(const std::string& tag) const

Modified: tagcoll/2.0/tagcoll/coll/intdiskindex.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/intdiskindex.h	(original)
+++ tagcoll/2.0/tagcoll/coll/intdiskindex.h	Thu May 11 02:35:54 2006
@@ -80,7 +80,7 @@
 
 		std::pair< int, std::set<int> > operator*() const
 		{
-			return std::make_pair(idx, index.getTags(idx));
+			return std::make_pair(idx, index.getTagsOfItem(idx));
 		}
 		std::pair< int, std::set<int> >* operator->() const
 		{
@@ -132,10 +132,10 @@
 		tagidx.init(master, tagindex);
 	}
 
-	std::set<int> getItems(const int& tag) const;
-	std::set<int> getCommonItems(const std::set<int>& tags) const;
-	std::set<int> getTags(const int& item) const;
-	std::set<int> getMergedTags(const std::set<int>& items) const;
+	std::set<int> getItemsHavingTag(const int& tag) const;
+	std::set<int> getItemsHavingTags(const std::set<int>& tags) const;
+	std::set<int> getTagsOfItem(const int& item) const;
+	std::set<int> getTagsOfItems(const std::set<int>& items) const;
 
     bool hasTag(const int& tag) const
 	{

Modified: tagcoll/2.0/tagcoll/coll/patched.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/patched.cc	(original)
+++ tagcoll/2.0/tagcoll/coll/patched.cc	Thu May 11 02:35:54 2006
@@ -30,9 +30,9 @@
 namespace coll {
 
 template<typename ROCOLL>
-typename coll_traits<ROCOLL>::itemset_type Patched<ROCOLL>::getItems(const Tag& tag) const
+typename coll_traits<ROCOLL>::itemset_type Patched<ROCOLL>::getItemsHavingTag(const Tag& tag) const
 {
-	ItemSet items(coll.getItems(tag));
+	ItemSet items(coll.getItemsHavingTag(tag));
 	ItemSet res;
 
 	// Check items in coll first
@@ -44,7 +44,7 @@
 	// Then check items in the patch
 	for (typename Patches::const_iterator i = m_changes.begin();
 			i != m_changes.end(); i++)
-		if (utils::set_contains(m_changes.patch(i->first, coll.getTags(i->first)), tag))
+		if (utils::set_contains(m_changes.patch(i->first, coll.getTagsOfItem(i->first)), tag))
 			res |= i->first;
 
 	return res;
@@ -84,7 +84,7 @@
 template<typename ROCOLL>
 bool Patched<ROCOLL>::hasTag(const Tag& tag) const
 {
-	ItemSet items(coll.getItems(tag));
+	ItemSet items(coll.getItemsHavingTag(tag));
 
 	// Check items in coll first
 	for (typename ItemSet::const_iterator i = items.begin();
@@ -176,7 +176,7 @@
 			i != change.end(); i++)
 	{
 		Patch newChange(i->second);
-		newChange.removeRedundant(getTags(i->first));
+		newChange.removeRedundant(getTagsOfItem(i->first));
 		m_changes.addPatch(newChange);
 	}
 }

Modified: tagcoll/2.0/tagcoll/coll/patched.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/patched.h	(original)
+++ tagcoll/2.0/tagcoll/coll/patched.h	Thu May 11 02:35:54 2006
@@ -195,29 +195,29 @@
 
     bool hasTag(const Tag& tag) const;
 
-	TagSet getTags(const Item& item) const
+	TagSet getTagsOfItem(const Item& item) const
 	{
-		return m_changes.patch(item, coll.getTags(item));
+		return m_changes.patch(item, coll.getTagsOfItem(item));
 	}
 	template<typename ITEMS>
-	TagSet getMergedTags(const ITEMS& items) const
+	TagSet getTagsOfItems(const ITEMS& items) const
 	{
 		using namespace wibble::operators;
 		TagSet res;
 		for (typename ITEMS::const_iterator i = items.begin();
 				i != items.end(); i++)
-			res |= getTags(*i);
+			res |= getTagsOfItem(*i);
 		return res;
 	}
-	ItemSet getItems(const typename coll_traits<ROCOLL>::tag_type& tag) const;
+	ItemSet getItemsHavingTag(const typename coll_traits<ROCOLL>::tag_type& tag) const;
 	template<typename TAGS>
-	ItemSet getCommonItems(const TAGS& tags) const
+	ItemSet getItemsHavingTags(const TAGS& tags) const
 	{
 		using namespace wibble::operators;
 		typename TAGS::const_iterator i = tags.begin();
-		ItemSet res = getItems(*i);
+		ItemSet res = getItemsHavingTag(*i);
 		for ( ; i != tags.end(); ++i)
-			res &= getItems(*i);
+			res &= getItemsHavingTag(*i);
 		return res;
 	}
 

Modified: tagcoll/2.0/tagcoll/coll/simple.cc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/simple.cc	(original)
+++ tagcoll/2.0/tagcoll/coll/simple.cc	Thu May 11 02:35:54 2006
@@ -42,7 +42,7 @@
 #endif
 
 template<class ITEM, class TAG>
-std::set<TAG> Simple<ITEM, TAG>::getTags(const ITEM& item) const
+std::set<TAG> Simple<ITEM, TAG>::getTagsOfItem(const ITEM& item) const
 {
 	typename map< ITEM, std::set<TAG> >::const_iterator i = coll.find(item);
 	
@@ -53,7 +53,7 @@
 }
 
 template<class ITEM, class TAG>
-std::set<ITEM> Simple<ITEM, TAG>::getItems(const TAG& tag) const
+std::set<ITEM> Simple<ITEM, TAG>::getItemsHavingTag(const TAG& tag) const
 {
 	std::set<ITEM> res;
 	for (typename map< ITEM, std::set<TAG> >::const_iterator i = coll.begin();
@@ -64,7 +64,7 @@
 }
 
 template<class ITEM, class TAG> template<typename TAGS>
-std::set<ITEM> Simple<ITEM, TAG>::getCommonItems(const TAGS& tags) const
+std::set<ITEM> Simple<ITEM, TAG>::getItemsHavingTags(const TAGS& tags) const
 {
 	std::set<ITEM> res;
 	for (typename map< ITEM, std::set<TAG> >::const_iterator i = coll.begin();
@@ -76,15 +76,6 @@
 
 #if 0
 template<class T, class Tag>
-void Simple<T, Tag>::output(Consumer<T, Tag>& consumer) const
-{
-	for (typename map< T, std::set<Tag> >::const_iterator i = coll.begin();
-			i != coll.end(); i++)
-		if (!i->second.empty())
-			consumer.consume(i->first, i->second);
-}
-
-template<class T, class Tag>
 void Simple<T, Tag>::outputReversed(Consumer<Tag, T>& consumer) const
 {
 	for (typename map< T, std::set<Tag> >::const_iterator i = coll.begin();

Modified: tagcoll/2.0/tagcoll/coll/simple.h
==============================================================================
--- tagcoll/2.0/tagcoll/coll/simple.h	(original)
+++ tagcoll/2.0/tagcoll/coll/simple.h	Thu May 11 02:35:54 2006
@@ -101,10 +101,10 @@
 
 	bool hasItem(const ITEM& item) const { return coll.find(item) != coll.end(); }
 
-	std::set<TAG> getTags(const ITEM& item) const;
-	std::set<ITEM> getItems(const TAG& tag) const;
+	std::set<TAG> getTagsOfItem(const ITEM& item) const;
+	std::set<ITEM> getItemsHavingTag(const TAG& tag) const;
 	template<typename TAGS>
-	std::set<ITEM> getCommonItems(const TAGS& tag) const;
+	std::set<ITEM> getItemsHavingTags(const TAGS& tag) const;
 
 	template<typename TAGS, typename OUT>
 	void outputHavingTags(const TAGS& tags, OUT out) const;

Modified: tagcoll/2.0/tagcoll/stream/sink.h
==============================================================================
--- tagcoll/2.0/tagcoll/stream/sink.h	(original)
+++ tagcoll/2.0/tagcoll/stream/sink.h	Thu May 11 02:35:54 2006
@@ -36,7 +36,7 @@
 {
 public:
 	template<typename Data>
-	Sink& operator=(const Data&) const { return *this; }
+	const Sink& operator=(const Data&) const { return *this; }
 };
 
 inline Sink sink()

Modified: tagcoll/2.0/tagcoll/test-utils.tcc
==============================================================================
--- tagcoll/2.0/tagcoll/test-utils.tcc	(original)
+++ tagcoll/2.0/tagcoll/test-utils.tcc	Thu May 11 02:35:54 2006
@@ -160,42 +160,42 @@
 	inner_ensure(tc.hasTag("rosemerry"));
 	inner_ensure(!tc.hasTag("ketchup"));
 
-	// getTags(item)
-	s = tc.getTags("funghi");
+	// getTagsOfItem(item)
+	s = tc.getTagsOfItem("funghi");
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_contains(s, string("mozzarella"));
 	inner_ensure_contains(s, string("mushrooms"));
 	inner_ensure_not_contains(s, string("garlic"));
 	inner_ensure_not_contains(s, string("rosemerry"));
 
-	s = tc.getTags("margherita");
+	s = tc.getTagsOfItem("margherita");
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_contains(s, string("mozzarella"));
 	inner_ensure_not_contains(s, string("mushrooms"));
 	inner_ensure_not_contains(s, string("garlic"));
 	inner_ensure_not_contains(s, string("rosemerry"));
 
-	s = tc.getTags("rosmarino");
+	s = tc.getTagsOfItem("rosmarino");
 	inner_ensure_not_contains(s, string("tomato"));
 	inner_ensure_not_contains(s, string("mozzarella"));
 	inner_ensure_not_contains(s, string("mushrooms"));
 	inner_ensure_contains(s, string("garlic"));
 	inner_ensure_contains(s, string("rosemerry"));
 
-	s = tc.getTags("marinara");
+	s = tc.getTagsOfItem("marinara");
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_not_contains(s, string("mozzarella"));
 	inner_ensure_not_contains(s, string("mushrooms"));
 	inner_ensure_contains(s, string("garlic"));
 	inner_ensure_not_contains(s, string("rosemerry"));
 
-	s = tc.getTags("gnocco");
+	s = tc.getTagsOfItem("gnocco");
 	inner_ensure(s.empty());
 
-	// getTags(items)
+	// getTagsOfitems(items)
 	s1.clear();
 	s1.insert("funghi"); s1.insert("margherita");
-	s = tc.getMergedTags(s1);
+	s = tc.getTagsOfItems(s1);
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_contains(s, string("mozzarella"));
 	inner_ensure_contains(s, string("mushrooms"));
@@ -204,7 +204,7 @@
 
 	s1.clear();
 	s1.insert("rosmarino"); s1.insert("margherita");
-	s = tc.getMergedTags(s1);
+	s = tc.getTagsOfItems(s1);
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_contains(s, string("mozzarella"));
 	inner_ensure_not_contains(s, string("mushrooms"));
@@ -213,53 +213,53 @@
 
 	s1.clear();
 	s1.insert("funghi"); s1.insert("margherita"); s1.insert("marinara");
-	s = tc.getMergedTags(s1);
+	s = tc.getTagsOfItems(s1);
 	inner_ensure_contains(s, string("tomato"));
 	inner_ensure_contains(s, string("mozzarella"));
 	inner_ensure_contains(s, string("mushrooms"));
 	inner_ensure_contains(s, string("garlic"));
 	inner_ensure_not_contains(s, string("rosemerry"));
 
-	// getItems(tag)
-	s = tc.getItems("tomato");
+	// getItemsHavingTag(tag)
+	s = tc.getItemsHavingTag("tomato");
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_contains(s, string("margherita"));
 	inner_ensure_contains(s, string("funghi"));
 	inner_ensure_not_contains(s, string("rosmarino"));
 	inner_ensure_contains(s, string("marinara"));
 
-	s = tc.getItems("mozzarella");
+	s = tc.getItemsHavingTag("mozzarella");
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_contains(s, string("margherita"));
 	inner_ensure_contains(s, string("funghi"));
 	inner_ensure_not_contains(s, string("rosmarino"));
 	inner_ensure_not_contains(s, string("marinara"));
 
-	s = tc.getItems("mushrooms");
+	s = tc.getItemsHavingTag("mushrooms");
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_not_contains(s, string("margherita"));
 	inner_ensure_contains(s, string("funghi"));
 	inner_ensure_not_contains(s, string("rosmarino"));
 	inner_ensure_not_contains(s, string("marinara"));
 
-	s = tc.getItems("garlic");
+	s = tc.getItemsHavingTag("garlic");
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_not_contains(s, string("margherita"));
 	inner_ensure_not_contains(s, string("funghi"));
 	inner_ensure_contains(s, string("rosmarino"));
 	inner_ensure_contains(s, string("marinara"));
 
-	s = tc.getItems("rosemerry");
+	s = tc.getItemsHavingTag("rosemerry");
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_not_contains(s, string("margherita"));
 	inner_ensure_not_contains(s, string("funghi"));
 	inner_ensure_contains(s, string("rosmarino"));
 	inner_ensure_not_contains(s, string("marinara"));
 
-	// getItems(tags)
+	// getItemsHavingTags(tags)
 	s1.clear();
 	s1.insert("tomato"); s1.insert("mozzarella");
-	s = tc.getCommonItems(s1);
+	s = tc.getItemsHavingTags(s1);
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_contains(s, string("margherita"));
 	inner_ensure_contains(s, string("funghi"));
@@ -268,7 +268,7 @@
 
 	s1.clear();
 	s1.insert("garlic"); s1.insert("rosemerry");
-	s = tc.getCommonItems(s1);
+	s = tc.getItemsHavingTags(s1);
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_not_contains(s, string("margherita"));
 	inner_ensure_not_contains(s, string("funghi"));
@@ -277,7 +277,7 @@
 
 	s1.clear();
 	s1.insert("tomato"); s1.insert("rosemerry");
-	s = tc.getCommonItems(s1);
+	s = tc.getItemsHavingTags(s1);
 	inner_ensure_not_contains(s, string("gnocco"));
 	inner_ensure_not_contains(s, string("margherita"));
 	inner_ensure_not_contains(s, string("funghi"));
@@ -314,7 +314,7 @@
 {
 	// Test handling of untagged items (they are not stored)
 	tc.insert(tss("untagged"), wibble::Empty<string>());
-	inner_ensure(tc.getTags("untagged").empty());
+	inner_ensure(tc.getTagsOfItem("untagged").empty());
 	
 	// Test handling of tagged items
 	std::set<string> tagset;
@@ -323,12 +323,12 @@
 	inner_ensure_contains(tc.getTaggedItems(), string("tagged"));
 	//inner_ensure(tc.hasTag("tag1"));
 	//inner_ensure(tc.hasTag("tag2"));
-	tagset = tc.getTags("tagged");
+	tagset = tc.getTagsOfItem("tagged");
 	inner_ensure_contains(tagset, string("tag1"));
 	inner_ensure_contains(tagset, string("tag2"));
-	std::set<string> itemset = tc.getItems("tag1");
+	std::set<string> itemset = tc.getItemsHavingTag("tag1");
 	inner_ensure_contains(itemset, string("tagged"));
-	itemset = tc.getItems("tag2");
+	itemset = tc.getItemsHavingTag("tag2");
 	inner_ensure_contains(itemset, string("tagged"));
 	tagset = tc.getAllTags();
 	inner_ensure_contains(tagset, string("tag1"));
@@ -350,19 +350,19 @@
 	tc.applyChange(change);
 	
 	// "tagged" should now be untagged
-	inner_ensure(tc.getTags("tagged").empty());
+	inner_ensure(tc.getTagsOfItem("tagged").empty());
 
 	tc.applyChange(change.getReverse());
 
 	// "tagged" should now be as before
 	//inner_ensure(tc.hasTag("tag1"));
 	//inner_ensure(tc.hasTag("tag2"));
-	tagset = tc.getTags("tagged");
+	tagset = tc.getTagsOfItem("tagged");
 	inner_ensure_contains(tagset, string("tag1"));
 	inner_ensure_contains(tagset, string("tag2"));
-	itemset = tc.getItems("tag1");
+	itemset = tc.getItemsHavingTag("tag1");
 	inner_ensure_contains(itemset, string("tagged"));
-	itemset = tc.getItems("tag2");
+	itemset = tc.getItemsHavingTag("tag2");
 	inner_ensure_contains(itemset, string("tagged"));
 	tagset = tc.getAllTags();
 	inner_ensure_contains(tagset, string("tag1"));
@@ -383,15 +383,15 @@
 	//inner_ensure(tc.hasTag("tag1"));
 	//inner_ensure(tc.hasTag("tag2"));
 	//inner_ensure(tc.hasTag("tag3"));
-	tagset = tc.getTags("tagged");
+	tagset = tc.getTagsOfItem("tagged");
 	inner_ensure_contains(tagset, string("tag1"));
 	inner_ensure_contains(tagset, string("tag2"));
 	inner_ensure_contains(tagset, string("tag3"));
-	itemset = tc.getItems("tag1");
+	itemset = tc.getItemsHavingTag("tag1");
 	inner_ensure_contains(itemset, string("tagged"));
-	itemset = tc.getItems("tag2");
+	itemset = tc.getItemsHavingTag("tag2");
 	inner_ensure_contains(itemset, string("tagged"));
-	itemset = tc.getItems("tag3");
+	itemset = tc.getItemsHavingTag("tag3");
 	inner_ensure_contains(itemset, string("tagged"));
 	tagset = tc.getAllTags();
 	inner_ensure_contains(tagset, string("tag1"));
@@ -413,18 +413,18 @@
 	change.addPatch(p);
 	tc.applyChange(change);
 
-	tagset = tc.getTags("tagged1");
+	tagset = tc.getTagsOfItem("tagged1");
 	inner_ensure_contains(tagset, string("tag1"));
 	inner_ensure_contains(tagset, string("tag2"));
 	inner_ensure_not_contains(tagset, string("tag3"));
 	inner_ensure_contains(tagset, string("tag4"));
-	itemset = tc.getItems("tag1");
+	itemset = tc.getItemsHavingTag("tag1");
 	inner_ensure_contains(itemset, string("tagged1"));
-	itemset = tc.getItems("tag2");
+	itemset = tc.getItemsHavingTag("tag2");
 	inner_ensure_contains(itemset, string("tagged1"));
-	itemset = tc.getItems("tag3");
+	itemset = tc.getItemsHavingTag("tag3");
 	inner_ensure_not_contains(itemset, string("tagged1"));
-	itemset = tc.getItems("tag4");
+	itemset = tc.getItemsHavingTag("tag4");
 	inner_ensure_not_contains(itemset, string("tagged"));
 	inner_ensure_contains(itemset, string("tagged1"));
 	tagset = tc.getAllTags();
@@ -443,13 +443,13 @@
 	// And reverse it
 	tc.applyChange(change.getReverse());
 
-	itemset = tc.getItems("tag1");
+	itemset = tc.getItemsHavingTag("tag1");
 	inner_ensure_not_contains(itemset, string("tagged1"));
-	itemset = tc.getItems("tag2");
+	itemset = tc.getItemsHavingTag("tag2");
 	inner_ensure_not_contains(itemset, string("tagged1"));
-	itemset = tc.getItems("tag3");
+	itemset = tc.getItemsHavingTag("tag3");
 	inner_ensure_not_contains(itemset, string("tagged1"));
-	inner_ensure(tc.getItems("tag4") == std::set<string>());
+	inner_ensure(tc.getItemsHavingTag("tag4") == std::set<string>());
 	tagset = tc.getAllTags();
 	inner_ensure_contains(tagset, string("tag1"));
 	inner_ensure_contains(tagset, string("tag2"));

Modified: tagcoll/2.0/tools/tagcoll.cc
==============================================================================
--- tagcoll/2.0/tools/tagcoll.cc	(original)
+++ tagcoll/2.0/tools/tagcoll.cc	Thu May 11 02:35:54 2006
@@ -668,9 +668,9 @@
 
 			// Get the tagset as the intersection of the tagsets of all input items
 			set<string>::const_iterator i = splititems.begin();
-			std::set<string> ts = merger.getTags(*i);
+			std::set<string> ts = merger.getTagsOfItem(*i);
 			for (++i; i != splititems.end(); i++)
-				ts = ts & merger.getTags(*i);
+				ts = ts & merger.getTagsOfItem(*i);
 
 			if (ts.empty())
 			{
@@ -733,7 +733,7 @@
 					for (std::set<string>::const_iterator j = items.begin();
 							j != items.end(); j++)
 					{
-						std::set<string> tags = coll.getTags(*j) & seen;
+						std::set<string> tags = coll.getTagsOfItem(*j) & seen;
 						if (tags.empty())
 							newItems |= *j;
 					}



More information about the Debtags-commits mailing list