summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-06-04 19:19:58 -0400
committerDavid Robillard <d@drobilla.net>2021-06-04 19:19:58 -0400
commitb760e11d5f9f4d25919a566ef727164da4376062 (patch)
tree6ade88a43041b62b03247bb73b73a481c7931053
parentfef4ce2b39b1a00609122fe37e2378be2fa9319f (diff)
downloadingen-b760e11d5f9f4d25919a566ef727164da4376062.tar.gz
ingen-b760e11d5f9f4d25919a566ef727164da4376062.tar.bz2
ingen-b760e11d5f9f4d25919a566ef727164da4376062.zip
Switch to C++14 and fix build with GCC 10
GCC was having problems with this make_unique overload, but I don't care about C++11 compatibility at this point anyway, so it's easiest to just remove it.
-rw-r--r--include/ingen/memory.hpp7
-rw-r--r--src/Serialiser.cpp145
-rw-r--r--src/World.cpp187
-rw-r--r--src/server/Engine.cpp7
-rw-r--r--src/server/Worker.cpp3
-rw-r--r--src/server/events/CreateGraph.cpp54
-rw-r--r--src/server/events/Delete.cpp5
-rw-r--r--src/server/events/Delta.cpp11
-rw-r--r--src/server/events/Disconnect.cpp10
-rw-r--r--src/server/ingen_lv2.cpp4
-rw-r--r--wscript2
11 files changed, 258 insertions, 177 deletions
diff --git a/include/ingen/memory.hpp b/include/ingen/memory.hpp
index 82e98bdf..6a62d317 100644
--- a/include/ingen/memory.hpp
+++ b/include/ingen/memory.hpp
@@ -29,13 +29,6 @@ void NullDeleter(T* ptr) {}
template <class T>
struct FreeDeleter { void operator()(T* const ptr) { free(ptr); } };
-template <typename T, typename... Args>
-std::unique_ptr<T>
-make_unique(Args&&... args)
-{
- return std::unique_ptr<T>{new T{std::forward<Args>(args)...}};
-}
-
} // namespace ingen
#endif // INGEN_MEMORY_HPP
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index aaf12f76..3dfa862b 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -29,7 +29,6 @@
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/filesystem.hpp"
-#include "ingen/memory.hpp"
#include "ingen/runtime_paths.hpp"
#include "lv2/core/lv2.h"
#include "lv2/state/state.h"
@@ -54,28 +53,27 @@
namespace ingen {
-struct Serialiser::Impl {
+struct Serialiser::Impl
+{
explicit Impl(World& world)
- : _root_path("/")
- , _mode(Mode::TO_FILE)
- , _world(world)
- , _model(nullptr)
- , _sratom(sratom_new(&_world.uri_map().urid_map()))
- {}
-
- ~Impl() {
- sratom_free(_sratom);
+ : _root_path("/")
+ , _mode(Mode::TO_FILE)
+ , _world(world)
+ , _model(nullptr)
+ , _sratom(sratom_new(&_world.uri_map().urid_map()))
+ {
}
+ ~Impl() { sratom_free(_sratom); }
+
Impl(const Impl&) = delete;
- Impl(Impl&&) = delete;
+ Impl(Impl&&) = delete;
Impl& operator=(const Impl&) = delete;
Impl& operator=(Impl&&) = delete;
enum class Mode { TO_FILE, TO_STRING };
- void start_to_file(const raul::Path& root,
- const FilePath& filename);
+ void start_to_file(const raul::Path& root, const FilePath& filename);
std::set<const Resource*>
serialise_graph(const std::shared_ptr<const Node>& graph,
@@ -89,8 +87,7 @@ struct Serialiser::Impl {
Resource::Graph context,
const Sord::Node& port_id);
- void serialise_properties(Sord::Node id,
- const Properties& props);
+ void serialise_properties(Sord::Node id, const Properties& props);
void write_bundle(const std::shared_ptr<const Node>& graph, const URI& uri);
@@ -116,9 +113,7 @@ struct Serialiser::Impl {
Sratom* _sratom;
};
-Serialiser::Serialiser(World& world)
- : me{make_unique<Impl>(world)}
-{}
+Serialiser::Serialiser(World& world) : me{std::make_unique<Impl>(world)} {}
Serialiser::~Serialiser() = default;
@@ -175,10 +170,12 @@ Serialiser::Impl::write_plugins(const FilePath& bundle_path,
if (minor.is_valid() && micro.is_valid()) {
_model->add_statement(Sord::URI(world, p->uri()),
Sord::URI(world, uris.lv2_minorVersion),
- Sord::Literal::integer(world, minor.get<int32_t>()));
+ Sord::Literal::integer(world,
+ minor.get<int32_t>()));
_model->add_statement(Sord::URI(world, p->uri()),
Sord::URI(world, uris.lv2_microVersion),
- Sord::Literal::integer(world, micro.get<int32_t>()));
+ Sord::Literal::integer(world,
+ micro.get<int32_t>()));
}
}
@@ -209,9 +206,9 @@ Serialiser::Impl::write_bundle(const std::shared_ptr<const Node>& graph,
start_to_file(graph->path(), main_file);
- std::set<const Resource*> plugins = serialise_graph(
- graph,
- Sord::URI(_model->world(), main_file, _base_uri));
+ std::set<const Resource*> plugins =
+ serialise_graph(graph,
+ Sord::URI(_model->world(), main_file, _base_uri));
finish();
write_manifest(path, graph);
@@ -268,7 +265,8 @@ Serialiser::Impl::finish()
SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE);
if (st) {
_world.log().error("Error writing file %1% (%2%)\n",
- _base_uri, serd_strerror(st));
+ _base_uri,
+ serd_strerror(st));
}
} else {
ret = _model->write_to_string(_base_uri, SERD_TURTLE);
@@ -296,17 +294,21 @@ Serialiser::serialise(const std::shared_ptr<const Node>& object,
Resource::Graph context)
{
if (!me->_model) {
- throw std::logic_error("serialise called without serialisation in progress");
+ throw std::logic_error(
+ "serialise called without serialisation in progress");
}
if (object->graph_type() == Node::GraphType::GRAPH) {
me->serialise_graph(object, me->path_rdf_node(object->path()));
} else if (object->graph_type() == Node::GraphType::BLOCK) {
const Sord::URI plugin_id(me->_model->world(), object->plugin()->uri());
- me->serialise_block(object, plugin_id, me->path_rdf_node(object->path()));
+ me->serialise_block(object,
+ plugin_id,
+ me->path_rdf_node(object->path()));
} else if (object->graph_type() == Node::GraphType::PORT) {
- me->serialise_port(
- object.get(), context, me->path_rdf_node(object->path()));
+ me->serialise_port(object.get(),
+ context,
+ me->path_rdf_node(object->path()));
} else {
me->serialise_properties(me->path_rdf_node(object->path()),
object->properties());
@@ -332,9 +334,10 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
Sord::URI(world, uris.lv2_extensionData),
Sord::URI(world, LV2_STATE__interface));
- _model->add_statement(graph_id,
- Sord::URI(world, LV2_UI__ui),
- Sord::URI(world, "http://drobilla.net/ns/ingen#GraphUIGtk2"));
+ _model->add_statement(
+ graph_id,
+ Sord::URI(world, LV2_UI__ui),
+ Sord::URI(world, "http://drobilla.net/ns/ingen#GraphUIGtk2"));
// If the graph has no doap:name (required by LV2), use the basename
if (graph->properties().find(uris.doap_name) == graph->properties().end()) {
@@ -361,13 +364,15 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
serd_uri_parse(reinterpret_cast<const uint8_t*>(_base_uri.c_str()),
&base_uri);
- const std::string sub_bundle_path = subgraph->path().substr(1) + ".ingen";
+ const std::string sub_bundle_path =
+ subgraph->path().substr(1) + ".ingen";
SerdURI subgraph_uri;
- SerdNode subgraph_node = serd_node_new_uri_from_string(
- reinterpret_cast<const uint8_t*>(sub_bundle_path.c_str()),
- &base_uri,
- &subgraph_uri);
+ SerdNode subgraph_node =
+ serd_node_new_uri_from_string(reinterpret_cast<const uint8_t*>(
+ sub_bundle_path.c_str()),
+ &base_uri,
+ &subgraph_uri);
const Sord::URI subgraph_id(world,
reinterpret_cast<const char*>(
@@ -407,7 +412,7 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
}
for (uint32_t i = 0; i < graph->num_ports(); ++i) {
- Node* p = graph->port(i);
+ Node* p = graph->port(i);
const Sord::Node port_id = path_rdf_node(p->path());
// Ensure lv2:name always exists so Graph is a valid LV2 plugin
@@ -444,7 +449,8 @@ Serialiser::Impl::serialise_block(const std::shared_ptr<const Node>& block,
Sord::URI(_model->world(), uris.lv2_prototype),
class_id);
- // Serialise properties, but remove possibly stale state:state (set again below)
+ // Serialise properties, but remove possibly stale state:state (set again
+ // below)
Properties props = block->properties();
props.erase(uris.state_state);
serialise_properties(block_id, props);
@@ -476,9 +482,9 @@ Serialiser::Impl::serialise_port(const Node* port,
Resource::Graph context,
const Sord::Node& port_id)
{
- URIs& uris = _world.uris();
- Sord::World& world = _model->world();
- Properties props = port->properties(context);
+ URIs& uris = _world.uris();
+ Sord::World& world = _model->world();
+ Properties props = port->properties(context);
if (context == Resource::Graph::INTERNAL) {
// Always write lv2:symbol for Graph ports (required for lv2:Plugin)
@@ -492,14 +498,14 @@ Serialiser::Impl::serialise_port(const Node* port,
if (context == Resource::Graph::INTERNAL &&
port->has_property(uris.rdf_type, uris.lv2_ControlPort) &&
- port->has_property(uris.rdf_type, uris.lv2_InputPort))
- {
+ port->has_property(uris.rdf_type, uris.lv2_InputPort)) {
const Atom& val = port->get_property(uris.ingen_value);
if (val.is_valid()) {
props.erase(uris.lv2_default);
props.emplace(uris.lv2_default, val);
} else {
- _world.log().warn("Control input has no value, lv2:default omitted.\n");
+ _world.log().warn(
+ "Control input has no value, lv2:default omitted.\n");
}
} else if (context != Resource::Graph::INTERNAL &&
!port->has_property(uris.rdf_type, uris.lv2_InputPort)) {
@@ -522,7 +528,7 @@ Serialiser::Impl::serialise_arc(const Sord::Node& parent,
{
if (!_model) {
throw std::logic_error(
- "serialise_arc called without serialisation in progress");
+ "serialise_arc called without serialisation in progress");
}
Sord::World& world = _model->world();
@@ -531,17 +537,11 @@ Serialiser::Impl::serialise_arc(const Sord::Node& parent,
const Sord::Node src = path_rdf_node(arc->tail_path());
const Sord::Node dst = path_rdf_node(arc->head_path());
const Sord::Node arc_id = Sord::Node::blank_id(*_world.rdf_world(), "arc");
- _model->add_statement(arc_id,
- Sord::URI(world, uris.ingen_tail),
- src);
- _model->add_statement(arc_id,
- Sord::URI(world, uris.ingen_head),
- dst);
+ _model->add_statement(arc_id, Sord::URI(world, uris.ingen_tail), src);
+ _model->add_statement(arc_id, Sord::URI(world, uris.ingen_head), dst);
if (parent.is_valid()) {
- _model->add_statement(parent,
- Sord::URI(world, uris.ingen_arc),
- arc_id);
+ _model->add_statement(parent, Sord::URI(world, uris.ingen_arc), arc_id);
} else {
_model->add_statement(arc_id,
Sord::URI(world, uris.rdf_type),
@@ -552,23 +552,20 @@ Serialiser::Impl::serialise_arc(const Sord::Node& parent,
static bool
skip_property(ingen::URIs& uris, const Sord::Node& predicate)
{
- return (predicate == INGEN__file ||
- predicate == uris.ingen_arc ||
- predicate == uris.ingen_block ||
- predicate == uris.lv2_port);
+ return (predicate == INGEN__file || predicate == uris.ingen_arc ||
+ predicate == uris.ingen_block || predicate == uris.lv2_port);
}
void
-Serialiser::Impl::serialise_properties(Sord::Node id,
- const Properties& props)
+Serialiser::Impl::serialise_properties(Sord::Node id, const Properties& props)
{
LV2_URID_Unmap* unmap = &_world.uri_map().urid_unmap();
SerdNode base = serd_node_from_string(SERD_URI,
reinterpret_cast<const uint8_t*>(
_base_uri.c_str()));
- SerdEnv* env = serd_env_new(&base);
- SordInserter* inserter = sord_inserter_new(_model->c_obj(), env);
+ SerdEnv* env = serd_env_new(&base);
+ SordInserter* inserter = sord_inserter_new(_model->c_obj(), env);
sratom_set_sink(_sratom,
_base_uri.c_str(),
@@ -589,16 +586,24 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
/* Value is a graph URI relative to the running engine.
Chop the prefix and save the path relative to the graph file.
This allows saving references to bundle resources. */
- sratom_write(_sratom, unmap, 0,
- sord_node_to_serd_node(id.c_obj()),
- sord_node_to_serd_node(key.c_obj()),
- p.second.type(), p.second.size(),
- reinterpret_cast<const char*>(p.second.get_body()) + 13);
+ sratom_write(
+ _sratom,
+ unmap,
+ 0,
+ sord_node_to_serd_node(id.c_obj()),
+ sord_node_to_serd_node(key.c_obj()),
+ p.second.type(),
+ p.second.size(),
+ reinterpret_cast<const char*>(p.second.get_body()) + 13);
} else {
- sratom_write(_sratom, unmap, 0,
+ sratom_write(_sratom,
+ unmap,
+ 0,
sord_node_to_serd_node(id.c_obj()),
sord_node_to_serd_node(key.c_obj()),
- p.second.type(), p.second.size(), p.second.get_body());
+ p.second.type(),
+ p.second.size(),
+ p.second.get_body());
}
}
}
diff --git a/src/World.cpp b/src/World.cpp
index eb1674fc..27d92632 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -33,7 +33,6 @@
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
#include "ingen/ingen.h"
-#include "ingen/memory.hpp"
#include "ingen/runtime_paths.hpp"
#include "lilv/lilv.h"
#include "lv2/log/log.h"
@@ -68,35 +67,37 @@ ingen_load_library(Log& log, const string& name)
const auto path = ingen_module_path(name);
if (path.empty()) {
log.error("Failed to find %1% (%2%)\n",
- name, Library::get_last_error());
+ name,
+ Library::get_last_error());
return nullptr;
}
- std::unique_ptr<Library> library = make_unique<Library>(path);
+ std::unique_ptr<Library> library = std::make_unique<Library>(path);
if (*library) {
return library;
}
log.error("Unable to load %1% from %2% (%3%)\n",
- name, path, Library::get_last_error());
+ name,
+ path,
+ Library::get_last_error());
return nullptr;
}
-class World::Impl {
+class World::Impl
+{
public:
- Impl(LV2_URID_Map* map,
- LV2_URID_Unmap* unmap,
- LV2_Log_Log* log_feature)
- : argc(nullptr)
- , argv(nullptr)
- , lv2_features(nullptr)
- , rdf_world(new Sord::World())
- , lilv_world(lilv_world_new(), lilv_world_free)
- , uri_map(log, map, unmap)
- , forge(uri_map)
- , uris(forge, &uri_map, lilv_world.get())
- , conf(forge)
- , log(log_feature, uris)
+ Impl(LV2_URID_Map* map, LV2_URID_Unmap* unmap, LV2_Log_Log* log_feature)
+ : argc(nullptr)
+ , argv(nullptr)
+ , lv2_features(nullptr)
+ , rdf_world(new Sord::World())
+ , lilv_world(lilv_world_new(), lilv_world_free)
+ , uri_map(log, map, unmap)
+ , forge(uri_map)
+ , uris(forge, &uri_map, lilv_world.get())
+ , conf(forge)
+ , log(log_feature, uris)
{
lv2_features = new LV2Features();
lv2_features->add_feature(uri_map.urid_map_feature());
@@ -107,25 +108,28 @@ public:
lilv_world_load_all(lilv_world.get());
// Set up RDF namespaces
- rdf_world->add_prefix("atom", "http://lv2plug.in/ns/ext/atom#");
- rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#");
+ rdf_world->add_prefix("atom", "http://lv2plug.in/ns/ext/atom#");
+ rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#");
rdf_world->add_prefix("ingen", INGEN_NS);
- rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
- rdf_world->add_prefix("midi", "http://lv2plug.in/ns/ext/midi#");
- rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#");
+ rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
+ rdf_world->add_prefix("midi", "http://lv2plug.in/ns/ext/midi#");
+ rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#");
rdf_world->add_prefix("patch", "http://lv2plug.in/ns/ext/patch#");
- rdf_world->add_prefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
- rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
- rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
+ rdf_world->add_prefix("rdf",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
+ rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
// Load internal 'plugin' information into lilv world
- LilvNode* rdf_type = lilv_new_uri(
- lilv_world.get(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
- LilvNode* ingen_Plugin = lilv_new_uri(
- lilv_world.get(), INGEN__Plugin);
- LilvNodes* internals = lilv_world_find_nodes(
- lilv_world.get(), nullptr, rdf_type, ingen_Plugin);
- LILV_FOREACH(nodes, i, internals) {
+ LilvNode* rdf_type =
+ lilv_new_uri(lilv_world.get(),
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+ LilvNode* ingen_Plugin = lilv_new_uri(lilv_world.get(), INGEN__Plugin);
+ LilvNodes* internals = lilv_world_find_nodes(lilv_world.get(),
+ nullptr,
+ rdf_type,
+ ingen_Plugin);
+ LILV_FOREACH (nodes, i, internals) {
const LilvNode* internal = lilv_nodes_get(internals, i);
lilv_world_load_resource(lilv_world.get(), internal);
}
@@ -163,21 +167,23 @@ public:
}
Impl(const Impl&) = delete;
- Impl(Impl&&) = delete;
+ Impl(Impl&&) = delete;
Impl& operator=(const Impl&) = delete;
Impl& operator=(Impl&&) = delete;
using Modules = std::map<std::string, Module*>;
Modules modules;
- using InterfaceFactories = std::map<const std::string, World::InterfaceFactory>;
+ using InterfaceFactories =
+ std::map<const std::string, World::InterfaceFactory>;
InterfaceFactories interface_factories;
using ScriptRunner = bool (*)(World& world, const char* filename);
using ScriptRunners = std::map<const std::string, ScriptRunner>;
ScriptRunners script_runners;
- using LilvWorldUPtr = std::unique_ptr<LilvWorld, decltype(&lilv_world_free)>;
+ using LilvWorldUPtr =
+ std::unique_ptr<LilvWorld, decltype(&lilv_world_free)>;
int* argc;
char*** argv;
@@ -199,7 +205,7 @@ public:
};
World::World(LV2_URID_Map* map, LV2_URID_Unmap* unmap, LV2_Log_Log* log)
- : _impl(new Impl(map, unmap, log))
+ : _impl(new Impl(map, unmap, log))
{
_impl->serialiser = std::make_shared<Serialiser>(*this);
_impl->parser = std::make_shared<Parser>();
@@ -246,26 +252,90 @@ World::set_store(const std::shared_ptr<Store>& s)
_impl->store = s;
}
-std::shared_ptr<EngineBase> World::engine() { return _impl->engine; }
-std::shared_ptr<Interface> World::interface() { return _impl->interface; }
-std::shared_ptr<Parser> World::parser() { return _impl->parser; }
-std::shared_ptr<Serialiser> World::serialiser() { return _impl->serialiser; }
-std::shared_ptr<Store> World::store() { return _impl->store; }
+std::shared_ptr<EngineBase>
+World::engine()
+{
+ return _impl->engine;
+}
+std::shared_ptr<Interface>
+World::interface()
+{
+ return _impl->interface;
+}
+std::shared_ptr<Parser>
+World::parser()
+{
+ return _impl->parser;
+}
+std::shared_ptr<Serialiser>
+World::serialiser()
+{
+ return _impl->serialiser;
+}
+std::shared_ptr<Store>
+World::store()
+{
+ return _impl->store;
+}
-int& World::argc() { return *_impl->argc; }
-char**& World::argv() { return *_impl->argv; }
-Configuration& World::conf() { return _impl->conf; }
-Log& World::log() { return _impl->log; }
+int&
+World::argc()
+{
+ return *_impl->argc;
+}
+char**&
+World::argv()
+{
+ return *_impl->argv;
+}
+Configuration&
+World::conf()
+{
+ return _impl->conf;
+}
+Log&
+World::log()
+{
+ return _impl->log;
+}
-std::mutex& World::rdf_mutex() { return _impl->rdf_mutex; }
+std::mutex&
+World::rdf_mutex()
+{
+ return _impl->rdf_mutex;
+}
-Sord::World* World::rdf_world() { return _impl->rdf_world.get(); }
-LilvWorld* World::lilv_world() { return _impl->lilv_world.get(); }
+Sord::World*
+World::rdf_world()
+{
+ return _impl->rdf_world.get();
+}
+LilvWorld*
+World::lilv_world()
+{
+ return _impl->lilv_world.get();
+}
-LV2Features& World::lv2_features() { return *_impl->lv2_features; }
-Forge& World::forge() { return _impl->forge; }
-URIs& World::uris() { return _impl->uris; }
-URIMap& World::uri_map() { return _impl->uri_map; }
+LV2Features&
+World::lv2_features()
+{
+ return *_impl->lv2_features;
+}
+Forge&
+World::forge()
+{
+ return _impl->forge;
+}
+URIs&
+World::uris()
+{
+ return _impl->uris;
+}
+URIMap&
+World::uri_map()
+{
+ return _impl->uri_map;
+}
bool
World::load_module(const char* name)
@@ -293,7 +363,8 @@ World::load_module(const char* name)
}
log().error("Failed to load module `%1%' (%2%)\n",
- name, lib->get_last_error());
+ name,
+ lib->get_last_error());
return false;
}
@@ -317,7 +388,7 @@ World::new_interface(const URI& engine_uri,
const std::shared_ptr<Interface>& respondee)
{
const Impl::InterfaceFactories::const_iterator i =
- _impl->interface_factories.find(std::string(engine_uri.scheme()));
+ _impl->interface_factories.find(std::string(engine_uri.scheme()));
if (i == _impl->interface_factories.end()) {
log().warn("Unknown URI scheme `%1%'\n", engine_uri.scheme());
return nullptr;
@@ -330,7 +401,8 @@ World::new_interface(const URI& engine_uri,
bool
World::run(const std::string& mime_type, const std::string& filename)
{
- const Impl::ScriptRunners::const_iterator i = _impl->script_runners.find(mime_type);
+ const Impl::ScriptRunners::const_iterator i =
+ _impl->script_runners.find(mime_type);
if (i == _impl->script_runners.end()) {
log().warn("Unknown script MIME type `%1%'\n", mime_type);
return false;
@@ -340,7 +412,8 @@ World::run(const std::string& mime_type, const std::string& filename)
}
void
-World::add_interface_factory(const std::string& scheme, InterfaceFactory factory)
+World::add_interface_factory(const std::string& scheme,
+ InterfaceFactory factory)
{
_impl->interface_factories.emplace(scheme, factory);
}
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index c72d98df..b48b291f 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -58,7 +58,6 @@
#include "ingen/URI.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/memory.hpp"
#include "lv2/buf-size/buf-size.h"
#include "lv2/state/state.h"
#include "raul/Maid.hpp"
@@ -114,9 +113,9 @@ Engine::Engine(ingen::World& world)
for (int i = 0; i < world.conf().option("threads").get<int32_t>(); ++i) {
_notifications.emplace_back(
- make_unique<raul::RingBuffer>(uint32_t(24 * event_queue_size())));
+ std::make_unique<raul::RingBuffer>(uint32_t(24 * event_queue_size())));
_run_contexts.emplace_back(
- make_unique<RunContext>(
+ std::make_unique<RunContext>(
*this, _notifications.back().get(), unsigned(i), i > 0));
}
@@ -189,7 +188,7 @@ void
Engine::listen()
{
#ifdef HAVE_SOCKET
- _listener = make_unique<SocketListener>(*this);
+ _listener = std::make_unique<SocketListener>(*this);
#endif
}
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 8e8f3e5e..77d98612 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -22,7 +22,6 @@
#include "ingen/Log.hpp"
#include "ingen/Node.hpp"
-#include "ingen/memory.hpp"
#include "lv2/core/lv2.h"
#include "lv2/worker/worker.h"
@@ -127,7 +126,7 @@ Worker::Worker(Log& log, uint32_t buffer_size, bool synchronous)
, _synchronous(synchronous)
{
if (!synchronous) {
- _thread = make_unique<std::thread>(&Worker::run, this);
+ _thread = std::make_unique<std::thread>(&Worker::run, this);
}
}
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index 6b85281d..2a74ddf0 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -34,7 +34,6 @@
#include "ingen/URI.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/memory.hpp"
#include "ingen/paths.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
@@ -61,7 +60,8 @@ CreateGraph::CreateGraph(Engine& engine,
, _properties(properties)
, _graph(nullptr)
, _parent(nullptr)
-{}
+{
+}
CreateGraph::~CreateGraph() = default;
@@ -84,30 +84,40 @@ CreateGraph::build_child_events()
in_properties.put(uris.lv2_index, uris.forge.make(0));
in_properties.put(uris.lv2_name, uris.forge.alloc("Control"));
in_properties.put(uris.rdf_type, uris.lv2_InputPort);
- in_properties.put(uris.ingen_canvasX, uris.forge.make(32.0f),
+ in_properties.put(uris.ingen_canvasX,
+ uris.forge.make(32.0f),
Resource::Graph::EXTERNAL);
- in_properties.put(uris.ingen_canvasY, uris.forge.make(32.0f),
+ in_properties.put(uris.ingen_canvasY,
+ uris.forge.make(32.0f),
Resource::Graph::EXTERNAL);
- _child_events.push_back(
- make_unique<events::CreatePort>(_engine, _request_client, -1, _time,
- _path.child(raul::Symbol("control")),
- in_properties));
+ _child_events.push_back(std::make_unique<events::CreatePort>(
+ _engine,
+ _request_client,
+ -1,
+ _time,
+ _path.child(raul::Symbol("control")),
+ in_properties));
// Add notify port (message respond)
Properties out_properties(control_properties);
out_properties.put(uris.lv2_index, uris.forge.make(1));
out_properties.put(uris.lv2_name, uris.forge.alloc("Notify"));
out_properties.put(uris.rdf_type, uris.lv2_OutputPort);
- out_properties.put(uris.ingen_canvasX, uris.forge.make(128.0f),
+ out_properties.put(uris.ingen_canvasX,
+ uris.forge.make(128.0f),
Resource::Graph::EXTERNAL);
- out_properties.put(uris.ingen_canvasY, uris.forge.make(32.0f),
+ out_properties.put(uris.ingen_canvasY,
+ uris.forge.make(32.0f),
Resource::Graph::EXTERNAL);
_child_events.push_back(
- make_unique<events::CreatePort>(_engine, _request_client, -1, _time,
- _path.child(raul::Symbol("notify")),
- out_properties));
+ std::make_unique<events::CreatePort>(_engine,
+ _request_client,
+ -1,
+ _time,
+ _path.child(raul::Symbol("notify")),
+ out_properties));
}
bool
@@ -151,24 +161,28 @@ CreateGraph::pre_process(PreProcessContext& ctx)
t = _properties.find(uris.lv2_prototype);
}
- if (t != _properties.end() &&
- uris.forge.is_uri(t->second) &&
+ if (t != _properties.end() && uris.forge.is_uri(t->second) &&
URI::is_valid(uris.forge.str(t->second, false)) &&
uri_is_path(URI(uris.forge.str(t->second, false)))) {
// Create a duplicate of an existing graph
const URI prototype(uris.forge.str(t->second, false));
GraphImpl* ancestor = dynamic_cast<GraphImpl*>(
- _engine.store()->get(uri_to_path(prototype)));
+ _engine.store()->get(uri_to_path(prototype)));
if (!ancestor) {
- return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND, prototype);
+ return Event::pre_process_done(Status::PROTOTYPE_NOT_FOUND,
+ prototype);
} else if (!(_graph = dynamic_cast<GraphImpl*>(
- ancestor->duplicate(_engine, symbol, _parent)))) {
+ ancestor->duplicate(_engine, symbol, _parent)))) {
return Event::pre_process_done(Status::CREATION_FAILED, _path);
}
} else {
// Create a new graph
- _graph = new GraphImpl(_engine, symbol, ext_poly, _parent,
- _engine.sample_rate(), int_poly);
+ _graph = new GraphImpl(_engine,
+ symbol,
+ ext_poly,
+ _parent,
+ _engine.sample_rate(),
+ int_poly);
_graph->add_property(uris.rdf_type, uris.ingen_Graph.urid_atom());
_graph->add_property(uris.rdf_type,
Property(uris.ingen_Block,
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 7b284902..3347b549 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -38,7 +38,6 @@
#include "ingen/URI.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/memory.hpp"
#include "ingen/paths.hpp"
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
@@ -114,13 +113,13 @@ Delete::pre_process(PreProcessContext& ctx)
if (_block) {
parent->remove_block(*_block);
_disconnect_event =
- make_unique<DisconnectAll>(_engine, parent, _block.get());
+ std::make_unique<DisconnectAll>(_engine, parent, _block.get());
_disconnect_event->pre_process(ctx);
_compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
} else if (_port) {
parent->remove_port(*_port);
_disconnect_event =
- make_unique<DisconnectAll>(_engine, parent, _port.get());
+ std::make_unique<DisconnectAll>(_engine, parent, _port.get());
_disconnect_event->pre_process(ctx);
_compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 034b2194..b4d46fb9 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -43,7 +43,6 @@
#include "ingen/Store.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/memory.hpp"
#include "ingen/paths.hpp"
#include "lilv/lilv.h"
#include "raul/Maid.hpp"
@@ -153,7 +152,7 @@ Delta::add_set_event(const char* port_symbol,
}
_set_events.emplace_back(
- make_unique<SetPortValue>(
+ std::make_unique<SetPortValue>(
_engine, _request_client, _request_id, _time,
port, Atom(size, type, value), false, true));
}
@@ -249,13 +248,13 @@ Delta::pre_process(PreProcessContext& ctx)
ingen::Resource::type(uris, _properties, is_graph, is_block, is_port, is_output);
if (is_graph) {
- _create_event = make_unique<CreateGraph>(
+ _create_event = std::make_unique<CreateGraph>(
_engine, _request_client, _request_id, _time, path, _properties);
} else if (is_block) {
- _create_event = make_unique<CreateBlock>(
+ _create_event = std::make_unique<CreateBlock>(
_engine, _request_client, _request_id, _time, path, _properties);
} else if (is_port) {
- _create_event = make_unique<CreatePort>(
+ _create_event = std::make_unique<CreatePort>(
_engine, _request_client, _request_id, _time,
path, _properties);
}
@@ -351,7 +350,7 @@ Delta::pre_process(PreProcessContext& ctx)
}
} else if (key == uris.ingen_value || key == uris.ingen_activity) {
_set_events.emplace_back(
- make_unique<SetPortValue>(
+ std::make_unique<SetPortValue>(
_engine, _request_client, _request_id, _time,
port, value, key == uris.ingen_activity));
} else if (key == uris.midi_binding) {
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index 93e271af..ea6bb8f0 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -35,13 +35,13 @@
#include "ingen/Node.hpp"
#include "ingen/Status.hpp"
#include "ingen/Store.hpp"
-#include "ingen/memory.hpp"
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include <cassert>
#include <cstdint>
+#include <memory>
#include <mutex>
#include <set>
#include <string>
@@ -167,10 +167,10 @@ Disconnect::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::PARENT_NOT_FOUND, _msg.head);
}
- _impl = make_unique<Impl>(_engine,
- _graph,
- dynamic_cast<PortImpl*>(tail),
- dynamic_cast<InputPort*>(head));
+ _impl = std::make_unique<Impl>(_engine,
+ _graph,
+ dynamic_cast<PortImpl*>(tail),
+ dynamic_cast<InputPort*>(head));
_compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index d709e41a..90b9d944 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -533,7 +533,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
auto* plugin = new IngenPlugin();
plugin->map = map;
- plugin->world = make_unique<ingen::World>(map, unmap, log);
+ plugin->world = std::make_unique<ingen::World>(map, unmap, log);
plugin->world->load_configuration(plugin->argc, plugin->argv);
LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength);
@@ -633,7 +633,7 @@ ingen_activate(LV2_Handle instance)
auto engine = std::static_pointer_cast<Engine>(me->world->engine());
const auto driver = std::static_pointer_cast<LV2Driver>(engine->driver());
engine->activate();
- me->main = make_unique<std::thread>(ingen_lv2_main, engine, driver);
+ me->main = std::make_unique<std::thread>(ingen_lv2_main, engine, driver);
}
static void
diff --git a/wscript b/wscript
index e110d719..1c6b07dc 100644
--- a/wscript
+++ b/wscript
@@ -50,7 +50,7 @@ def configure(conf):
conf.load('python', cache=True)
conf.load('autowaf', cache=True)
- autowaf.set_cxx_lang(conf, 'c++11')
+ autowaf.set_cxx_lang(conf, 'c++14')
if Options.options.strict:
# Check for programs used by lint target