[Debtags-commits] [svn] r1760 - in tagcoll/2.0: . tagcoll tagcoll/coll tools

Enrico Zini enrico at costa.debian.org
Thu May 11 02:39:57 UTC 2006


Author: enrico
Date: Thu May 11 02:39:52 2006
New Revision: 1760

Added:
   tagcoll/2.0/tagcoll/coll/simple.tcc
Modified:
   tagcoll/2.0/   (props changed)
   tagcoll/2.0/tagcoll/Makefile.am
   tagcoll/2.0/tagcoll/coll/simple.cc
   tagcoll/2.0/tools/tagcoll.cc
Log:
 r2695 at viaza:  enrico | 2006-05-10 16:14:36 -0500
 Everything compiles!


Modified: tagcoll/2.0/tagcoll/Makefile.am
==============================================================================
--- tagcoll/2.0/tagcoll/Makefile.am	(original)
+++ tagcoll/2.0/tagcoll/Makefile.am	Thu May 11 02:39:52 2006
@@ -28,7 +28,7 @@
 		\
 		coll/base.h \
 		coll/simple.h \
-		coll/simple.cc \
+		coll/simple.tcc \
 		coll/fast.h \
 		coll/fast.tcc \
 		coll/patched.h \

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:39:52 2006
@@ -1,7 +1,7 @@
 /*
  * Merge tags of items appearing multiple times in a stream of tagged items
  *
- * Copyright (C) 2003  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006  Enrico Zini <enrico at debian.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,159 +18,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#include <tagcoll/coll/simple.h>
-#include <tagcoll/Patches.h>
-
-#include <wibble/operators.h>
-
-using namespace std;
-using namespace wibble::operators;
-
-namespace tagcoll {
-namespace coll {
-
-#if 0
-template<class T, class Tag>
-void Simple<T, Tag>::consumeItem(const T& item, const std::set<Tag>& tags)
-{
-	typename map< T, std::set<Tag> >::iterator i = coll.find(item);
-	if (i == coll.end())
-		coll.insert(make_pair(item, tags));
-	else
-		i->second |= tags;
-}
-#endif
-
-template<class ITEM, class TAG>
-std::set<TAG> Simple<ITEM, TAG>::getTagsOfItem(const ITEM& item) const
-{
-	typename map< ITEM, std::set<TAG> >::const_iterator i = coll.find(item);
-	
-	if (i == coll.end())
-		return std::set<TAG>();
-	else
-		return i->second;
-}
-
-template<class ITEM, class TAG>
-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();
-			i != coll.end(); i++)
-		if (i->second.find(tag) != i->second.end())
-			res |= i->first;
-	return res;
-}
-
-template<class ITEM, class TAG> template<typename TAGS>
-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();
-			i != coll.end(); i++)
-		if (utils::set_contains(i->second, tags))
-			res |= i->first;
-	return res;
-}
-
-#if 0
-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();
-			i != coll.end(); i++)
-	{
-		std::set<T> items;
-		items |= i->first;
-		consumer.consume(i->second, items);
-	}
-}
-#endif
-
-template<class ITEM, class TAG> template<typename TAGS, typename OUT>
-void Simple<ITEM, TAG>::outputHavingTags(const TAGS& ts, OUT out) const
-{
-	for (typename map< ITEM, std::set<TAG> >::const_iterator i = coll.begin();
-			i != coll.end(); ++i)
-		if (set_contains(i->second, ts))
-		{
-			*out = *i;
-			++out;
-		}
-}
-	
-
-
-template<class T, class Tag>
-void Simple<T, Tag>::applyChange(const PatchList<T, Tag>& change)
-{
-	for (typename PatchList<T, Tag>::const_iterator i = change.begin(); i != change.end(); i++)
-	{
-		typename map< T, std::set<Tag> >::iterator it = coll.find(i->first);
-		if (it == coll.end())
-		{
-			// If the item doesn't exist, create it
-			coll.insert(make_pair(i->first, i->second.getAdded()));
-		} else {
-			it->second = i->second.apply(it->second);
-		}
-	}
-}
-
-template<class T, class Tag>
-std::set<Tag> Simple<T, Tag>::getAllTags() const
-{
-	std::set<Tag> tags;
-
-	for (typename map< T, std::set<Tag> >::const_iterator i = coll.begin();
-			i != coll.end(); i++)
-		tags |= i->second;
-	
-	return tags;
-}
-
-template<class T, class Tag>
-std::set<Tag> Simple<T, Tag>::getCompanionTags(const std::set<Tag>& ts) const
-{
-	std::set<Tag> tags;
-
-	for (typename map< T, std::set<Tag> >::const_iterator i = coll.begin();
-			i != coll.end(); i++)
-		if (utils::set_contains(i->second, (ts)))
-			tags |= i->second - ts;
-	
-	return tags;
-}
-
-template<class T, class Tag>
-std::set<T> Simple<T, Tag>::getRelatedItems(const std::set<Tag>& tags, int maxdistance) const
-{
-	std::set<T> res;
-
-	for (typename map< T, std::set<Tag> >::const_iterator i = coll.begin();
-			i != coll.end(); i++)
-	{
-		int dist = utils::set_distance(tags, i->second);
-		if (dist >= 0 && dist <= maxdistance)
-			res |= i->first;
-	}
-	
-	return res;
-}
-
-template<class T, class Tag>
-unsigned int Simple<T, Tag>::itemCount() const
-{
-	return coll.size();
-}
-
-}
-}
-
-
 #ifdef COMPILE_TESTSUITE
 
+#include <tagcoll/coll/simple.h>
 #include <tests/test-utils.h>
 
 namespace wibble {

Modified: tagcoll/2.0/tools/tagcoll.cc
==============================================================================
--- tagcoll/2.0/tools/tagcoll.cc	(original)
+++ tagcoll/2.0/tools/tagcoll.cc	Thu May 11 02:39:52 2006
@@ -775,5 +775,6 @@
 #include <tagcoll/TextFormat.tcc>
 #include <tagcoll/Patches.tcc>
 #include <tagcoll/Implications.tcc>
+#include <tagcoll/coll/simple.tcc>
 
 // vim:set ts=4 sw=4:



More information about the Debtags-commits mailing list