diff --git a/swig/Makefile b/swig/Makefile index 08582fb312122b6dbf0ed583a8ddf3b7672373bb..8ca3262b87b9911c64a79f8c4059738dd8de8cbc 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -24,7 +24,8 @@ CBIN=libcorpustag.o \ libcorpustokenreader.o \ libcorpusiob.o \ libcorpusannotationchannel.o \ - libcorpusannotatedsentence.o + libcorpusannotatedsentence.o \ + libcorpusannotationview.o CBINOUT=_boost_shared_ptr.so \ _libcorpustag.so \ @@ -38,7 +39,8 @@ CBINOUT=_boost_shared_ptr.so \ _libcorpustokenreader.so \ _libcorpusiob.so \ _libcorpusannotationchannel.so \ - _libcorpusannotatedsentence.so + _libcorpusannotatedsentence.so \ + _libcorpusannotationview.so CWRAP=boost_shared_ptr_wrap.cxx \ libcorpustag_wrap.cxx \ @@ -52,7 +54,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \ libcorpustokenreader_wrap.cxx \ libcorpusiob_wrap.cxx \ libcorpusannotationchannel_wrap.cxx \ - libcorpusannotatedsentence_wrap.cxx + libcorpusannotatedsentence_wrap.cxx \ + libcorpusannotationview_wrap.cxx CWRAPBIN=boost_shared_ptr_wrap.o \ libcorpustag_wrap.o \ @@ -66,7 +69,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \ libcorpustokenreader_wrap.o \ libcorpusiob_wrap.o \ libcorpusannotationchannel_wrap.o \ - libcorpusannotatedsentence_wrap.o + libcorpusannotatedsentence_wrap.o \ + libcorpusannotationview_wrap.o PYMODULES=boost_shared_ptr.py \ libcorpustag.py \ @@ -80,7 +84,8 @@ PYMODULES=boost_shared_ptr.py \ libcorpustokenreader.py \ libcorpusiob.py \ libcorpusannotationchannel.py \ - libcorpusannotatedsentence.py + libcorpusannotatedsentence.py \ + libcorpusannotationview.py PYCBIN=boost_shared_ptr.pyc \ libcorpustag.pyc \ @@ -94,7 +99,8 @@ PYCBIN=boost_shared_ptr.pyc \ libcorpustokenreader.pyc \ libcorpusiob.pyc \ libcorpusannotationchannel.pyc \ - libcorpusannotatedsentence.pyc + libcorpusannotatedsentence.pyc \ + libcorpusannotationview.pyc # ----------------------------------------------------------------------------- all:boost_shared_ptr.o $(CBIN) @@ -198,6 +204,13 @@ libcorpusannotatedsentence.o: $(CPP) -shared libcorpusannotatedsentence_wrap.o \ $(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpusannotatedsentence.so +# AnnotationView +libcorpusannotationview.o: + $(SWIG) $(SWIGOPTS_LANG) libcorpusannotationview.i + $(CPP) -c libcorpusannotationview_wrap.cxx -I$(PYTHONDIR) $(CPPFLAGS) + $(CPP) -shared libcorpusannotationview_wrap.o \ + $(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpusannotationview.so + # ----------------------------------------------------------------------------- clean: rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN) diff --git a/swig/libcorpusannotationview.i b/swig/libcorpusannotationview.i new file mode 100644 index 0000000000000000000000000000000000000000..2f41a0aa98ca3cddf05575957f3d6d6e46090f24 --- /dev/null +++ b/swig/libcorpusannotationview.i @@ -0,0 +1,43 @@ +#ifndef SWIG_LIBCORPUS2_ANNOTATIONVIEW_I +#define SWIG_LIBCORPUS2_ANNOTATIONVIEW_I + +%module libcorpusannotationview +%{ + #include <libcorpus2/ann/view.h> +%} + +%include "libcorpussentence.i" +%include "libcorpusannotationchannel.i" +%include "libcorpusannotatedsentence.i" + +%include "std_string.i" +%include "boost_shared_ptr.i" + +// %template(AnnotatedSentencePtr) boost::shared_ptr<AnnotatedSentence>; + +%nodefaultctor Corpus2::TokenWriter; + +namespace Corpus2 { + class AnnotationView : public Corpus2::Sentence { + public: + AnnotationView(const boost::shared_ptr<AnnotatedSentence>& original, const std::string& ann_name_); + ~AnnotationView(); + + /* --------------------------------------------------------------------- */ + Ptr clone_shared() const; + + /* --------------------------------------------------------------------- */ + void commit(); + void commit_to( + const boost::shared_ptr<AnnotatedSentence>& original, + const std::string& ann_name); + + /* --------------------------------------------------------------------- */ + void release_original(); + }; +} + +using namespace std; +using namespace Corpus2; + +#endif /* SWIG_LIBCORPUS2_ANNOTATIONVIEW_I */