Add director typemaps for pointer const ref types

This commit is contained in:
William S Fulton 2017-10-24 23:12:04 +01:00
commit dafe2d6949
13 changed files with 126 additions and 36 deletions

View file

@ -18,6 +18,7 @@
* Base - Val(444.555)
* Base - Ref(444.555)
* Base - Ptr(444.555)
* Base - ConstPtrRef(444.555)
* Base - FullyOverloaded(int 10)
* Base - FullyOverloaded(bool 1)
* Base - SemiOverloaded(int -678)
@ -28,6 +29,7 @@
* Derived - Val(444.555)
* Derived - Ref(444.555)
* Derived - Ptr(444.555)
* Derived - ConstPtrRef(444.555)
* Derived - FullyOverloaded(int 10)
* Derived - FullyOverloaded(bool 1)
* Derived - SemiOverloaded(int -678)
@ -38,6 +40,7 @@
* DDerived - Val(444.555)
* DDerived - Ref(444.555)
* DDerived - Ptr(444.555)
* DDerived - ConstPtrRef(444.555)
* DDerived - FullyOverloaded(int 10)
* DDerived - FullyOverloaded(bool True)
* DDerived - SemiOverloaded(-678)
@ -57,7 +60,7 @@ import director_classes.Derived;
import director_classes.DoubleHolder;
void main() {
if (PrintDebug) Stdout.formatln("------------ Start ------------ ");
if (PrintDebug) Stdout.formatln("------------ Start ------------");
auto myCaller = new Caller();
@ -83,7 +86,7 @@ void main() {
makeCalls(myCaller, myBase);
}
if (PrintDebug) Stdout.formatln("------------ Finish ------------ ");
if (PrintDebug) Stdout.formatln("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase) {
@ -96,6 +99,7 @@ void makeCalls(Caller myCaller, Base myBase) {
if (myCaller.ValCall(dh).val != dh.val) throw new Exception("[1] failed");
if (myCaller.RefCall(dh).val != dh.val) throw new Exception("[2] failed");
if (myCaller.PtrCall(dh).val != dh.val) throw new Exception("[3] failed");
if (myCaller.ConstPtrRefCall(dh).val != dh.val) throw new Exception("[3] failed");
// Fully overloaded method test (all methods in base class are overloaded)
if (myCaller.FullyOverloadedCall(10) != myBaseType ~ "::FullyOverloaded(int)") throw new Exception("[4] failed");
@ -136,6 +140,11 @@ public class DDerived : Base {
return x;
}
public override DoubleHolder ConstPtrRef(DoubleHolder x) {
if (PrintDebug) Stdout.formatln("DDerived - ConstPtrRef({0:d3})", x.val);
return x;
}
public override char[] FullyOverloaded(int x) {
if (PrintDebug) Stdout.formatln("DDerived - FullyOverloaded(int {0})", x);
return "DDerived::FullyOverloaded(int)";

View file

@ -18,6 +18,7 @@
* Base - Val(444.555)
* Base - Ref(444.555)
* Base - Ptr(444.555)
* Base - ConstPtrRef(444.555)
* Base - FullyOverloaded(int 10)
* Base - FullyOverloaded(bool 1)
* Base - SemiOverloaded(int -678)
@ -28,6 +29,7 @@
* Derived - Val(444.555)
* Derived - Ref(444.555)
* Derived - Ptr(444.555)
* Derived - ConstPtrRef(444.555)
* Derived - FullyOverloaded(int 10)
* Derived - FullyOverloaded(bool 1)
* Derived - SemiOverloaded(int -678)
@ -38,6 +40,7 @@
* DDerived - Val(444.555)
* DDerived - Ref(444.555)
* DDerived - Ptr(444.555)
* DDerived - ConstPtrRef(444.555)
* DDerived - FullyOverloaded(int 10)
* DDerived - FullyOverloaded(bool true)
* DDerived - SemiOverloaded(-678)
@ -58,7 +61,7 @@ import director_classes.Derived;
import director_classes.DoubleHolder;
void main() {
if (PrintDebug) writeln("------------ Start ------------ ");
if (PrintDebug) writeln("------------ Start ------------");
auto myCaller = new Caller();
@ -84,7 +87,7 @@ void main() {
makeCalls(myCaller, myBase);
}
if (PrintDebug) writeln("------------ Finish ------------ ");
if (PrintDebug) writeln("------------ Finish ------------");
}
void makeCalls(Caller myCaller, Base myBase) {
@ -97,6 +100,7 @@ void makeCalls(Caller myCaller, Base myBase) {
enforce(myCaller.ValCall(dh).val == dh.val, "[1] failed");
enforce(myCaller.RefCall(dh).val == dh.val, "[2] failed");
enforce(myCaller.PtrCall(dh).val == dh.val, "[3] failed");
enforce(myCaller.ConstPtrRefCall(dh).val == dh.val, "[3] failed");
// Fully overloaded method test (all methods in base class are overloaded)
enforce(myCaller.FullyOverloadedCall(10) == myBaseType ~ "::FullyOverloaded(int)", "[4] failed");
@ -137,6 +141,11 @@ public class DDerived : Base {
return x;
}
public override DoubleHolder ConstPtrRef(DoubleHolder x) {
if (PrintDebug) writefln("DDerived - ConstPtrRef(%s)", x.val);
return x;
}
public override string FullyOverloaded(int x) {
if (PrintDebug) writefln("DDerived - FullyOverloaded(int %s)", x);
return "DDerived::FullyOverloaded(int)";