summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
blob: 0c82f6b9e635d0c076631417b3e8fd35aa895f13 (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
#include "uscxml/Common.h"
#include "JSCDataModel.h"
#include "uscxml/Message.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 JSCDataModelProvider() );
	return true;
}
#endif

JSCDataModel::JSCDataModel() {
}

boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter) {
	boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel());
	dm->_interpreter = interpreter;

	dm->setName(interpreter->getName());
	dm->setSessionId(interpreter->getSessionId());
	dm->eval("_ioprocessors = {};");
  dm->_ctx = JSGlobalContextCreate(NULL);

  JSObjectRef globalObject = JSContextGetGlobalObject(dm->_ctx);
  
	return dm;
}

void JSCDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) {
	assign("_ioprocessors['" + name + "']", ioprocessor.getDataModelVariables());
}

void JSCDataModel::setSessionId(const std::string& sessionId) {
	_sessionId = sessionId;
}

void JSCDataModel::setName(const std::string& name) {
	_name = name;
}

JSCDataModel::~JSCDataModel() {
//  JSGlobalContextRelease(_ctx);
}

void JSCDataModel::pushContext() {
}

void JSCDataModel::popContext() {
}

void JSCDataModel::initialize() {
}

void JSCDataModel::setEvent(const Event& event) {
}

Data JSCDataModel::getStringAsData(const std::string& content) {
}

bool JSCDataModel::validate(const std::string& location, const std::string& schema) {
	return true;
}

uint32_t JSCDataModel::getLength(const std::string& expr) {
}

void JSCDataModel::eval(const std::string& expr) {
}

bool JSCDataModel::evalAsBool(const std::string& expr) {
}

std::string JSCDataModel::evalAsString(const std::string& expr) {
}

void JSCDataModel::assign(const std::string& location, const Data& data) {
}

void JSCDataModel::assign(const std::string& location, const std::string& expr) {
}

}