diff --git a/swig/Makefile b/swig/Makefile index 63c97ce43f8a04197c9f3b0d91c80e2a6cbb1d4c..2e94c98fc0996b51fff6a4d6fad95ab2c640080c 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -40,6 +40,7 @@ CBIN=libcclvalue.o \ libcclmatchrulesequence.o \ libcclfunctionalopsequence.o \ libccllexicon.o \ + libccllexicons.o \ libcclwcclfileopsections.o \ libcclwcclfile.o \ wccl.o @@ -69,6 +70,7 @@ CBINOUT=_libcclvalue.so \ _libcclmatchrulesequence.so \ _libcclfunctionalopsequence.so \ _libccllexicon.so \ + _libccllexicons.so \ _libcclwcclfileopsections.so \ _wccl.so \ _boost_shared_ptr.so @@ -98,6 +100,7 @@ CWRAP=libcclvalue_wrap.cxx \ libcclmatchrulesequence_wrap.cxx \ libcclfunctionalopsequence_wrap.cxx \ libccllexicon_wrap.cxx \ + libccllexicons_wrap.cxx \ libcclwcclfileopsections_wrap.cxx \ wccl_wrap.cxx \ boost_shared_ptr_wrap.cxx @@ -127,6 +130,7 @@ CWRAPBIN=libcclvalue_wrap.o \ libcclmatchrulesequence_wrap.o \ libcclfunctionalopsequence_wrap.o \ libccllexicon_wrap.o \ + libccllexicons_wrap.o \ libcclwcclfileopsections_wrap.o \ wccl_wrap.o \ boost_shared_ptr_wrap.o @@ -156,6 +160,7 @@ PYMODULES=libcclvalue.py \ libcclmatchrulesequence.py \ libcclfunctionalopsequence.py \ libccllexicon.py \ + libccllexicons.py \ libcclwcclfileopsections.py \ wccl.py \ boost_shared_ptr.py @@ -185,6 +190,7 @@ PYCBIN=libcclvalue.pyc \ libcclmatchrulesequence.pyc \ libcclfunctionalopsequence.pyc \ libccllexicon.pyc \ + libccllexicons.pyc \ libcclwcclfileopsections.pyc \ wccl.pyc \ boost_shared_ptr.pyc @@ -387,6 +393,13 @@ libccllexicon.o: $(CPP) -shared libccllexicon_wrap.o \ $(CCLBIN) $(ANTLRLIB) -o _libccllexicon.so +# Lexicons +libccllexicons.o: + $(SWIG) $(SWIGOPTS_LANG) libccllexicons.i + $(CPP) -c libccllexicons_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS) + $(CPP) -shared libccllexicons_wrap.o \ + $(CCLBIN) $(ANTLRLIB) -o _libccllexicons.so + # WcclFileOpSections libcclwcclfileopsections.o: $(SWIG) $(SWIGOPTS_LANG) libcclwcclfileopsections.i diff --git a/swig/libccllexicons.i b/swig/libccllexicons.i new file mode 100644 index 0000000000000000000000000000000000000000..95727b8d22a88268d7f8d8f600f3736f96fda9b7 --- /dev/null +++ b/swig/libccllexicons.i @@ -0,0 +1,48 @@ +#ifndef SWIG_LIBWCCL_LEXICONS_I +#define SWIG_LIBWCCL_LEXICONS_I + +%module libccllexicons +%{ + #include <libwccl/lexicon/lexicons.h> +%} + +%include "libccllexicon.i" + +%include "std_string.i" +%include "boost_shared_ptr.i" + +%rename(map_t) boost::unordered_map<std::string, boost::shared_ptr<Lexicon> >; + +namespace Wccl { + class Lexicons { + public: + typedef boost::unordered_map<std::string, boost::shared_ptr<Lexicon> > map_t; + + /* --------------------------------------------------------------------- */ + + Lexicons(); + + /* --------------------------------------------------------------------- */ + + bool has_lexicon(const std::string& name) const; + + /* --------------------------------------------------------------------- */ + + const Lexicon& get(const std::string& name) const; + boost::shared_ptr<const Lexicon> get_ptr(const std::string& name) const; + + /* --------------------------------------------------------------------- */ + + void insert(const boost::shared_ptr<Lexicon>& lexicon); + + /* --------------------------------------------------------------------- */ + + const map_t& get_lexicons() const; + }; +} + +using namespace boost; +using namespace Wccl; +using namespace std; + +#endif /* SWIG_LIBWCCL_LEXICONS_I */