summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp
blob: c90ef4d56b715bce776851ff1230dd5731e90823 (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
#include "USCXMLInvoker.h"
#include <glog/logging.h>

#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
#endif

namespace uscxml {

#ifdef BUILD_AS_PLUGINS
PLUMA_CONNECTOR
bool connect(pluma::Host& host) {
	host.add( new USCXMLInvokerProvider() );
	return true;
}
#endif

USCXMLInvoker::USCXMLInvoker() {
}


USCXMLInvoker::~USCXMLInvoker() {
	delete _invokedInterpreter;
};

InvokerImpl* USCXMLInvoker::create(Interpreter* interpreter) {
	USCXMLInvoker* invoker = new USCXMLInvoker();
	invoker->_parentInterpreter = interpreter;
	return invoker;
}

Data USCXMLInvoker::getDataModelVariables() {
	Data data;
	return data;
}

void USCXMLInvoker::send(const SendRequest& req) {
	assert(false);
}

void USCXMLInvoker::cancel(const std::string sendId) {
	assert(false);
}

void USCXMLInvoker::sendToParent(const SendRequest& req) {
  SendRequest parentReq = req;
	parentReq.invokeid = _invokeId;
	_parentInterpreter->receive(parentReq);
}

void USCXMLInvoker::invoke(const InvokeRequest& req) {
	_invokeId = req.invokeid;
	_invokedInterpreter = Interpreter::fromURI(req.src);
	DataModel dataModel(_invokedInterpreter->getDataModel());
	if (dataModel) {

	}
	_invokedInterpreter->setInvoker(boost::static_pointer_cast<InvokerImpl>(shared_from_this()));
	_invokedInterpreter->start();
}

}