summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorGökçen Eraslan <gokcen.eraslan@gmail.com>2016-01-24 13:18:24 +0100
committerGökçen Eraslan <gokcen.eraslan@gmail.com>2016-01-24 13:18:24 +0100
commit49ff349b67c7fed35782bf6407242fe58ef654c7 (patch)
tree9dce696cff7ee716c22481a4c798338a1ee19121 /bindings
parent80bc5b91205dd48870e5134b0c71a78718253a95 (diff)
bindings: Fix DataManager ownership problems using DISOWN.
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/test1_position.py2
-rw-r--r--bindings/python/test2_selfplay.py2
-rw-r--r--bindings/quackle.i25
3 files changed, 16 insertions, 13 deletions
diff --git a/bindings/python/test1_position.py b/bindings/python/test1_position.py
index 3a95808..e04081a 100644
--- a/bindings/python/test1_position.py
+++ b/bindings/python/test1_position.py
@@ -16,14 +16,12 @@ def startUp(lexicon='twl06',
abc = quackle.AlphabetParameters.findAlphabetFile(alphabet)
abc2 = quackle.Util.stdStringToQString(abc) #convert to qstring
fa = quackle.FlexibleAlphabetParameters()
- fa.thisown = False
assert fa.load(abc2)
dm.setAlphabetParameters(fa)
# Set up the board
board = quackle.BoardParameters()
- board.thisown = False
dm.setBoardParameters(board)
# Find the lexicon
diff --git a/bindings/python/test2_selfplay.py b/bindings/python/test2_selfplay.py
index 1c41874..bb6e889 100644
--- a/bindings/python/test2_selfplay.py
+++ b/bindings/python/test2_selfplay.py
@@ -18,14 +18,12 @@ def startUp(lexicon='twl06',
abc = quackle.AlphabetParameters.findAlphabetFile(alphabet)
abc2 = quackle.Util.stdStringToQString(abc) #convert to qstring
fa = quackle.FlexibleAlphabetParameters()
- fa.thisown = False
assert fa.load(abc2)
dm.setAlphabetParameters(fa)
# Set up the board
board = quackle.BoardParameters()
- board.thisown = False
dm.setBoardParameters(board)
# Find the lexicon
diff --git a/bindings/quackle.i b/bindings/quackle.i
index cc8e390..e45eb88 100644
--- a/bindings/quackle.i
+++ b/bindings/quackle.i
@@ -37,21 +37,23 @@
#include "quackleio/gcgio.h"
%}
+
%include "std_string.i"
%include "std_vector.i"
+%include "typemaps.i"
+
+%include "fixedstring.h"
+%include "uv.h"
+%include "alphabetparameters.h"
/*Needed to generate proper iterable types */
%template(MoveVector) std::vector<Quackle::Move>;
%template(PlayerVector) std::vector<Quackle::Player>;
%template(ProbableRackList) std::vector<Quackle::ProbableRack>;
%template(PositionList) std::vector<Quackle::GamePosition>;
-
-%include "fixedstring.h"
-%include "uv.h"
-%include "alphabetparameters.h"
-
%template(LetterParameterVector) std::vector<Quackle::LetterParameter>;
%template(LetterStringVector) std::vector<Quackle::LetterString>;
+
%include "move.h"
%include "rack.h"
%include "bag.h"
@@ -61,10 +63,6 @@
%include "catchall.h"
%include "player.h"
-/* handle output arguments of PlayerList methods using cool SWIG typemaps */
-/* what we do here is just to tell SWIG that last bool& argument is an output argument */
-%include "typemaps.i"
-
using namespace std;
namespace Quackle
{
@@ -83,6 +81,15 @@ namespace Quackle
%include "sim.h"
%include "computerplayer.h"
%include "computerplayercollection.h"
+
+%apply SWIGTYPE *DISOWN {Quackle::AlphabetParameters *alphabetParameters};
+%apply SWIGTYPE *DISOWN {Quackle::BoardParameters *boardParameters};
+%apply SWIGTYPE *DISOWN {Quackle::StrategyParameters *lexiconParameters};
+%apply SWIGTYPE *DISOWN {Quackle::LexiconParameters *lexiconParameters};
+%apply SWIGTYPE *DISOWN {Quackle::Evaluator *evaluator};
+%apply SWIGTYPE *DISOWN {Quackle::GameParameters *parameters};
+%apply SWIGTYPE *DISOWN {const Quackle::PlayerList &playerList};
+
%include "datamanager.h"
%include "endgame.h"
%include "endgameplayer.h"