From bebcbaaedf1f2b7bad9d965760eafef8ac05b8ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <pawel.kedzia@pwr.wroc.pl>
Date: Tue, 26 Apr 2011 10:01:52 +0200
Subject: [PATCH] Wrapper for Corpus2::TagsetManager

---
 swig/Makefile                 | 25 ++++++++++++++++++------
 swig/libcorpustagsetmanager.i | 36 +++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 6 deletions(-)
 create mode 100644 swig/libcorpustagsetmanager.i

diff --git a/swig/Makefile b/swig/Makefile
index d2e51bd..c4b9c98 100644
--- a/swig/Makefile
+++ b/swig/Makefile
@@ -14,27 +14,33 @@ ANTLRLIB=/usr/lib/libantlr-pic.a
 CPPFLAGS=-fPIC -O2
 
 CBIN=libcorpustag.o \
-		 libcorpustagset.o
+		 libcorpustagset.o \
+		 libcorpustagsetmanager.o 
 
 CBINOUT=_boost_shared_ptr.so \
 				_libcorpustag.so \
-				_libcorpustagset.so
+				_libcorpustagset.so \
+				_libcorpustagsetmanager.so
 
 CWRAP=boost_shared_ptr_wrap.cxx \
 			libcorpustag_wrap.cxx \
-			libcorpustagset_wrap.cxx
+			libcorpustagset_wrap.cxx \
+			libcorpustagsetmanager_wrap.cxx
 
 CWRAPBIN=boost_shared_ptr_wrap.o \
 				 libcorpustag_wrap.o \
-				 libcorpustagset_wrap.o
+				 libcorpustagset_wrap.o \
+				 libcorpustagsetmanager_wrap.o
 
 PYMODULES=boost_shared_ptr.py \
 					libcorpustag.py \
-					libcorpustagset.py
+					libcorpustagset.py \
+					libcorpustagsetmanager.py
 
 PYCBIN=boost_shared_ptr.pyc \
 			 libcorpustag.pyc \
-			 libcorpustagset.pyc
+			 libcorpustagset.pyc \
+			 libcorpustagsetmanager.pyc
 
 # -----------------------------------------------------------------------------
 all:boost_shared_ptr.o $(CBIN)
@@ -68,6 +74,13 @@ libcorpustagset.o:
 	$(CPP) -shared libcorpustagset_wrap.o \
 		$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpustagset.so
 
+# TagsetManager
+libcorpustagsetmanager.o:
+	$(SWIG) $(SWIGOPTS_LANG) libcorpustagsetmanager.i
+	$(CPP) -c libcorpustagsetmanager_wrap.cxx -I$(PYTHONDIR) $(CPPFLAGS)
+	$(CPP) -shared libcorpustagsetmanager_wrap.o \
+		$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpustagsetmanager.so
+
 # -----------------------------------------------------------------------------
 clean:
 	rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN)
diff --git a/swig/libcorpustagsetmanager.i b/swig/libcorpustagsetmanager.i
new file mode 100644
index 0000000..eea54cb
--- /dev/null
+++ b/swig/libcorpustagsetmanager.i
@@ -0,0 +1,36 @@
+#ifndef SWIG_LIBCORPUS2_TAGSETMANAGER_I
+#define SWIG_LIBCORPUS2_TAGSETMANAGER_I
+
+%module libcorpustagsetmanager
+%{
+  #include <libcorpus2/tagsetmanager.h>
+%}
+
+%include "libcorpustagset.i"
+
+%include "std_string.i"
+%include "std_vector.i"
+
+%feature("notabstract") Corpus2::TagsetManager;
+
+namespace Corpus2 {
+  class TagsetManager {
+  public:
+    TagsetManager();
+    ~TagsetManager();
+
+    /* --------------------------------------------------------------------- */
+    const Tagset& get_tagset(const std::string& name);
+
+    // boost::shared_ptr<Tagset> get_cache_entry(const std::string& name);
+
+    /* --------------------------------------------------------------------- */
+  };
+
+  inline const Tagset& get_named_tagset(const std::string& name);
+}
+
+using namespace std;
+using namespace Corpus2;
+
+#endif /* SWIG_LIBCORPUS2_TAGSETMANAGER_I */
-- 
GitLab