summaryrefslogtreecommitdiff
path: root/Examples/test-suite/director_template.i
blob: fdc5bfbd1cedebb6e8c4c5cfab9226e00ab30d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%module(directors="1") director_template

%{
#include <vector>
%}

%include <std_vector.i>

%feature("director") HandleBytes;

%inline %{
  template <typename X, typename Y> class TwoTemplateParms {};
%}

%template(TT_int_double) TwoTemplateParms<int, double>;

%inline %{
  class HandleBytes {
  public:
    virtual void handle(const std::vector<unsigned char> data) = 0; // Note: not instantiated with %template
    virtual void handle2(TwoTemplateParms<int, double> data) = 0;
    virtual ~HandleBytes() {}
  };

  void bytes_wrapper(const std::vector<unsigned char> data, HandleBytes *handler) {
    handler->handle(data);
  }
%}