summaryrefslogtreecommitdiff
path: root/Examples/test-suite/director_frob.i
blob: f1d502dc23bdb20842fe3aba2881d1293daefd62 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%module(directors="1") director_frob;
#pragma SWIG nowarn=SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR

#ifdef SWIGSCILAB
%rename(cb) coreCallbacks;
%rename(On3dEngRedrawn) coreCallbacksOn3dEngineRedrawnData;
%rename (_On3dEngRedrawn) coreCallbacks_On3dEngineRedrawnData;
#endif

%header %{
#include <iostream>
%}

%feature("director");
%feature("nodirector") Bravo::abs_method();   // ok
%feature("director")   Charlie::abs_method(); // ok
%feature("nodirector") Delta::abs_method();   // ok

%inline %{

  struct Alpha
  {
    virtual ~Alpha() { };
    virtual const char* abs_method() = 0;
  };

  struct Bravo : Alpha
  {
    const char* abs_method()
    {
      return "Bravo::abs_method()";
    }
  };

  struct Charlie : Bravo
  {
    const char* abs_method()
    {
      return "Charlie::abs_method()";
    }
  };

  struct Delta : Charlie
  {
  };
%}

%rename(OpInt) operator int();
%rename(OpIntStarStarConst) operator int **() const;
%rename(OpIntAmp) operator int &();
%rename(OpIntStar) operator void *();
%rename(OpConstIntIntStar) operator const int *();

%inline %{
  class Ops {
  public:
    Ops() : num(0) {}
    virtual ~Ops() {}
#if !defined(__SUNPRO_CC)
    virtual operator int() { return 0; }
#endif
    virtual operator int **() const {
      return (int **) 0;
    }
    virtual operator int &() {
      return num;
    }
    virtual operator void *() {
      return (void *) this;
    }
    virtual operator const int *() {
      return &num;
    }
  private:
    int num;
  };

  struct Prims {
    virtual ~Prims() {}
    virtual unsigned long long ull(unsigned long long i, unsigned long long j) { return i + j; }
    unsigned long long callull(int i, int j) { return ull(i, j); }
  };
%}


// The similarity of the director class name and other symbol names were causing a problem in the code generation
%feature("director") coreCallbacks;

%inline %{
class corePoint3d {};

struct coreCallbacks_On3dEngineRedrawnData
{
	corePoint3d _eye;
	corePoint3d _at;
};

struct coreCallbacksOn3dEngineRedrawnData
{
	corePoint3d _eye;
	corePoint3d _at;
};

class coreCallbacks
{
public:
	coreCallbacks(void) {}
	virtual ~coreCallbacks(void) {}

	virtual void On3dEngineRedrawn(const coreCallbacks_On3dEngineRedrawnData& data){}
	virtual void On3dEngineRedrawn2(const coreCallbacksOn3dEngineRedrawnData& data){}
};
%}