void HTTPEngineSender::set_property(const URI& subject, const URI& predicate, const Atom& value) { Resource::Properties prop; prop.insert(make_pair(predicate, value)); put(subject, prop); }
void ClientUpdate::put_port(const PortImpl* port) { const URIs& uris = port->bufs().uris(); if (port->is_a(PortType::CONTROL) || port->is_a(PortType::CV)) { Resource::Properties props = port->properties(); props.erase(uris.ingen_value); props.insert(std::make_pair(uris.ingen_value, port->value())); put(port->uri(), props); } else { put(port->uri(), port->properties()); } }
CreatePort::CreatePort(Engine& engine, SPtr<Interface> client, int32_t id, SampleCount timestamp, const Raul::Path& path, bool is_output, const Resource::Properties& properties) : Event(engine, client, id, timestamp) , _path(path) , _port_type(PortType::UNKNOWN) , _buf_type(0) , _graph(NULL) , _graph_port(NULL) , _ports_array(NULL) , _old_ports_array(NULL) , _engine_port(NULL) , _properties(properties) , _is_output(is_output) { const Ingen::URIs& uris = _engine.world()->uris(); typedef Resource::Properties::const_iterator Iterator; typedef std::pair<Iterator, Iterator> Range; const Range types = properties.equal_range(uris.rdf_type); for (Iterator i = types.first; i != types.second; ++i) { const Atom& type = i->second; if (type == uris.lv2_AudioPort) { _port_type = PortType::AUDIO; } else if (type == uris.lv2_ControlPort) { _port_type = PortType::CONTROL; } else if (type == uris.lv2_CVPort) { _port_type = PortType::CV; } else if (type == uris.atom_AtomPort) { _port_type = PortType::ATOM; } } const Range buffer_types = properties.equal_range(uris.atom_bufferType); for (Iterator i = buffer_types.first; i != buffer_types.second; ++i) { if (i->second.type() == _engine.world()->forge().URI) { _buf_type = _engine.world()->uri_map().map_uri(i->second.ptr<char>()); } } }
void PatchPortModule::store_location() { const float x = static_cast<float>(property_x()); const float y = static_cast<float>(property_y()); const LV2URIMap& uris = App::instance().uris(); const Atom& existing_x = _model->get_property(uris.ingenui_canvas_x); const Atom& existing_y = _model->get_property(uris.ingenui_canvas_y); if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT || existing_x.get_float() != x || existing_y.get_float() != y) { Resource::Properties props; props.insert(make_pair(uris.ingenui_canvas_x, Atom(x))); props.insert(make_pair(uris.ingenui_canvas_y, Atom(y))); App::instance().engine()->put(_model->path(), props, Resource::INTERNAL); } }
void HTTPEngineSender::put(const URI& uri, const Resource::Properties& properties, Resource::Graph ctx) { const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str(); const string full_uri = _engine_url.str() + "/" + path; Sord::Model model(_world); for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i) model.add_statement(Sord::URI(_world, path), AtomRDF::atom_to_node(model, i->first), AtomRDF::atom_to_node(model, i->second)); const string str = model.write_to_string(""); SoupMessage* msg = soup_message_new(SOUP_METHOD_PUT, full_uri.c_str()); assert(msg); soup_message_set_request(msg, "application/x-turtle", SOUP_MEMORY_COPY, str.c_str(), str.length()); soup_session_send_message(_session, msg); }
void GraphPortModule::store_location(double ax, double ay) { const URIs& uris = app().uris(); const Atom x(app().forge().make(static_cast<float>(ax))); const Atom y(app().forge().make(static_cast<float>(ay))); if (x != _model->get_property(uris.ingen_canvasX) || y != _model->get_property(uris.ingen_canvasY)) { Resource::Properties remove; remove.insert(make_pair(uris.ingen_canvasX, Resource::Property(uris.patch_wildcard))); remove.insert(make_pair(uris.ingen_canvasY, Resource::Property(uris.patch_wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, Resource::Property(x, Resource::Graph::INTERNAL))); add.insert(make_pair(uris.ingen_canvasY, Resource::Property(y, Resource::Graph::INTERNAL))); app().interface()->delta(_model->uri(), remove, add); } }