[Debtags-commits] [svn] r1384 - in tagcoll/trunk: . tagcoll tests

Enrico Zini enrico at costa.debian.org
Tue Sep 27 15:27:42 UTC 2005


Author: enrico
Date: Tue Sep 27 15:27:41 2005
New Revision: 1384

Added:
   tagcoll/trunk/tests/mkgraph.cc
Modified:
   tagcoll/trunk/   (props changed)
   tagcoll/trunk/tagcoll/experiments.cc
   tagcoll/trunk/tagcoll/experiments.h
   tagcoll/trunk/tests/Makefile.am
Log:
 r5430 at viaza:  enrico | 2005-09-27 07:22:36 -0500
 Laid out structure for generating dot-formattable graphs


Modified: tagcoll/trunk/tagcoll/experiments.cc
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.cc	(original)
+++ tagcoll/trunk/tagcoll/experiments.cc	Tue Sep 27 15:27:41 2005
@@ -214,6 +214,28 @@
 	}
 }
 
+
+template<typename ITEM, typename TAG>
+int Graph<ITEM,TAG>::getHandle(const OpSet<TAG>& node)
+{
+	typename std::map< OpSet<TAG>, int >::iterator i = handles.find(node);
+	if (i == handles.end())
+	{
+		pair<typename std::map< OpSet<TAG>, int >::iterator, bool> p = handles.insert(make_pair(node, seq++));
+		i = p.first;
+	}
+	return i->second;
+}
+
+template<typename ITEM, typename TAG>
+void Graph<ITEM,TAG>::buildGraph(const OpSet<TAG>& node)
+{
+	cout << "node" << getHandle(node) << ";" << endl;
+
+	
+}
+
+
 }
 
 
@@ -223,6 +245,7 @@
 namespace Tagcoll {
 	    template class Normalizer<std::string, std::string>;
 	    template class Scores<std::string>;
+	    template class Graph<std::string, std::string>;
 }
 #endif
 

Modified: tagcoll/trunk/tagcoll/experiments.h
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.h	(original)
+++ tagcoll/trunk/tagcoll/experiments.h	Tue Sep 27 15:27:41 2005
@@ -105,6 +105,23 @@
 	void normalize();
 };
 
+template <typename ITEM, typename TAG>
+class Graph : public CardinalityStore<ITEM, TAG>
+{
+protected:
+	typedef CardinalityStore<ITEM, TAG> tagsets_t;
+	
+	unsigned int seq;
+	std::map< OpSet<TAG>, int > handles;
+
+	int getHandle(const OpSet<TAG>& node);
+
+public:
+	Graph() : seq(0) {}
+
+	void buildGraph(const OpSet<TAG>& node);
+};
+
 }
 
 // vim:set ts=4 sw=4:

Modified: tagcoll/trunk/tests/Makefile.am
==============================================================================
--- tagcoll/trunk/tests/Makefile.am	(original)
+++ tagcoll/trunk/tests/Makefile.am	Tue Sep 27 15:27:41 2005
@@ -3,7 +3,7 @@
 libtagcoll_test_SOURCES = tut-main.cpp test-textformat.cc test-tdbdiskindex.cc test-tdbreadonlydiskindex.cc
 libtagcoll_test_LDADD = -dlpreopen ../tagcoll/libtagcoll.la ../tagcoll/tagexpr/libtagexpr.la -ltdb
 
-noinst_PROGRAMS = dump-tdbdi normalize
+noinst_PROGRAMS = dump-tdbdi normalize mkgraph
 # test-tagset
 
 dump_tdbdi_SOURCES = \
@@ -14,6 +14,10 @@
 	normalize.cc
 normalize_LDADD = ../tagcoll/libtagcoll.la -ltdb
 
+mkgraph_SOURCES = \
+	mkgraph.cc
+mkgraph_LDADD = ../tagcoll/libtagcoll.la -ltdb
+
 #test_tagset_SOURCES = \
 	#test-tagset.cc
 #test_tagset_LDADD = ../tagcoll/libtagcoll.la



More information about the Debtags-commits mailing list