9
#include "simodo/variable/Module_interface.h"
10
#include "simodo/variable/VariableSetWrapper.h"
11
#include "simodo/interpret/Interpret_interface.h"
19
#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION
22
#include <boost/dll/alias.hpp>
24
using namespace simodo;
28
variable::Value createConnection(variable::Module_interface * host, const variable::VariableSetWrapper & args);
29
variable::Value query(variable::Module_interface * host, const variable::VariableSetWrapper & args);
32
class Array_module : public variable::Module_interface
35
virtual version_t version() const override { return lib_version(); }
37
virtual variable::Value instantiate(std::shared_ptr<Module_interface> module_object) override
40
{u"createConnection", {variable::ValueType::Function, variable::Object {{
41
{u"@", variable::ExternalFunction {module_object, ::createConnection}},
42
{{}, variable::ValueType::Int},
43
{u"connection_parameters", variable::ValueType::Object},
45
{u"query", {variable::ValueType::Function, variable::Object {{
46
{u"@", variable::ExternalFunction {module_object, ::query}},
47
{{}, variable::ValueType::Array},
48
{u"connection_id", variable::ValueType::Int},
49
{u"query_string", variable::ValueType::String},
50
{u"query_parameters", variable::ValueType::Object},
56
static std::shared_ptr<Module_interface> create(interpret::Interpret_interface * ) {
57
return std::make_shared<Array_module>();
68
variable::Value createConnection(variable::Module_interface * host, const variable::VariableSetWrapper & args)
73
assert(args.size() == 1);
75
const variable::Value & connection_parameters = args[0].origin().value();
77
assert(connection_parameters.isObject());
84
variable::Value query(variable::Module_interface * host, const variable::VariableSetWrapper & args)
89
assert(args.size() == 3);
91
const variable::Value & connection_id = args[0].origin().value();
92
const variable::Value & query_string = args[1].origin().value();
93
const variable::Value & query_parameters = args[2].origin().value();
95
assert(connection_id.isInt());
96
assert(query_string.isString());
97
assert(query_parameters.isObject());
101
return variable::Object {};