summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig/php/uscxml.i
blob: 0ab248e94e47535b93b6f37d3f847bfb1df0105f (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
%module(directors="1", allprotected="1") uscxmlNativePHP

// import swig typemaps
%include "stl.i"

// macros from cmake
%import "uscxml/config.h"

// disable warning related to unknown base class
#pragma SWIG nowarn=401

%rename(c_array) array;
%rename(equals) operator==; 
%rename(isValid) operator bool;
%ignore operator!=;
%ignore operator<;
%ignore operator=;

%template(StringMap) std::map<std::string, std::string>;
%template(StringVector) std::vector<std::string>;
%template(Params) std::map<std::string, std::vector<std::string> >;

//**************************************************
// This ends up in the generated wrapper code
//**************************************************

%{
#include "../../../uscxml/Message.h"
#include "../../../uscxml/Interpreter.h"
#include "../../../uscxml/concurrency/BlockingQueue.h"

using namespace uscxml;

%}

// Add this to the very top of the generated wrapper code

%insert("begin") %{
void*** tsrm_ls;
%}

%feature("director") uscxml::InterpreterMonitor;

%ignore uscxml::NumAttr;
%ignore uscxml::SCXMLParser;
%ignore uscxml::InterpreterImpl;

//***********************************************
// Beautify interpreter class
//***********************************************

%extend uscxml::Interpreter {
	std::vector<std::string> getConfiguration() {
		std::vector<std::string> config;
		Arabica::XPath::NodeSet<std::string> configNodes = self->getConfiguration();
		for (int i = 0; i < configNodes.size(); i++) {
			config.push_back(ATTR(configNodes[i], "id"));
		}
		return config;		
	}
}
%ignore uscxml::Interpreter::getConfiguration();

%extend uscxml::Interpreter {
	std::vector<std::string> getBasicConfiguration() {
		std::vector<std::string> config;
		Arabica::XPath::NodeSet<std::string> configNodes = self->getBasicConfiguration();
		for (int i = 0; i < configNodes.size(); i++) {
			config.push_back(ATTR(configNodes[i], "id"));
		}
		return config;		
	}
}
%ignore uscxml::Interpreter::getBasicConfiguration();

%extend uscxml::Interpreter {
	bool isAtomic(const std::string stateId) {
		Arabica::DOM::Node<std::string> state = self->getState(stateId);
		return self->isAtomic(state);
	}
}
%ignore uscxml::Interpreter::isAtomic(Arabica::DOM::Node<std::string>);

//***********************************************
// Parse the header file to generate wrappers
//***********************************************

%include "../../../uscxml/Message.h"
%include "../../../uscxml/Interpreter.h"
%include "../../../uscxml/concurrency/BlockingQueue.h"

%template(ParentQueue) uscxml::concurrency::BlockingQueue<uscxml::SendRequest>;