summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.clang-tidy1
-rw-r--r--src/AtomReader.cpp3
-rw-r--r--src/AtomWriter.cpp1
-rw-r--r--src/ClashAvoider.cpp4
-rw-r--r--src/Configuration.cpp18
-rw-r--r--src/LV2Features.cpp2
-rw-r--r--src/Log.cpp8
-rw-r--r--src/Parser.cpp32
-rw-r--r--src/Serialiser.cpp19
-rw-r--r--src/SocketReader.cpp8
-rw-r--r--src/SocketWriter.cpp3
-rw-r--r--src/StreamWriter.cpp3
-rw-r--r--src/TurtleWriter.cpp1
-rw-r--r--src/URI.cpp55
-rw-r--r--src/URIMap.cpp10
-rw-r--r--src/URIs.cpp1
-rw-r--r--src/World.cpp1
-rw-r--r--src/client/ClientStore.cpp25
-rw-r--r--src/client/GraphModel.cpp2
-rw-r--r--src/client/ObjectModel.cpp2
-rw-r--r--src/client/PluginModel.cpp4
-rw-r--r--src/client/PluginUI.cpp18
-rw-r--r--src/gui/.clang-tidy1
-rw-r--r--src/gui/App.cpp4
-rw-r--r--src/gui/App.hpp5
-rw-r--r--src/gui/Arc.cpp16
-rw-r--r--src/gui/BreadCrumbs.cpp3
-rw-r--r--src/gui/ConnectWindow.cpp4
-rw-r--r--src/gui/ConnectWindow.hpp4
-rw-r--r--src/gui/GraphBox.cpp10
-rw-r--r--src/gui/GraphCanvas.cpp16
-rw-r--r--src/gui/GraphTreeWindow.cpp13
-rw-r--r--src/gui/GraphTreeWindow.hpp3
-rw-r--r--src/gui/GraphView.cpp5
-rw-r--r--src/gui/GraphWindow.cpp1
-rw-r--r--src/gui/GraphWindow.hpp1
-rw-r--r--src/gui/LoadGraphWindow.cpp5
-rw-r--r--src/gui/LoadPluginWindow.cpp11
-rw-r--r--src/gui/LoadPluginWindow.hpp1
-rw-r--r--src/gui/MessagesWindow.cpp10
-rw-r--r--src/gui/MessagesWindow.hpp1
-rw-r--r--src/gui/NewSubgraphWindow.cpp3
-rw-r--r--src/gui/NewSubgraphWindow.hpp2
-rw-r--r--src/gui/NodeMenu.cpp10
-rw-r--r--src/gui/NodeMenu.hpp6
-rw-r--r--src/gui/NodeModule.cpp7
-rw-r--r--src/gui/PluginMenu.cpp14
-rw-r--r--src/gui/Port.cpp10
-rw-r--r--src/gui/PortMenu.cpp2
-rw-r--r--src/gui/PortMenu.hpp3
-rw-r--r--src/gui/PropertiesWindow.cpp28
-rw-r--r--src/gui/PropertiesWindow.hpp1
-rw-r--r--src/gui/RDFS.cpp6
-rw-r--r--src/gui/RenameWindow.cpp1
-rw-r--r--src/gui/RenameWindow.hpp2
-rw-r--r--src/gui/ThreadedLoader.cpp11
-rw-r--r--src/gui/URIEntry.cpp5
-rw-r--r--src/gui/WidgetFactory.cpp1
-rw-r--r--src/gui/WidgetFactory.hpp4
-rw-r--r--src/gui/WindowFactory.cpp1
-rw-r--r--src/gui/ingen_gui.cpp2
-rw-r--r--src/gui/meson.build96
-rw-r--r--src/ingen/ingen.cpp3
-rw-r--r--src/meson.build6
-rw-r--r--src/server/.clang-tidy1
-rw-r--r--src/server/ArcImpl.hpp4
-rw-r--r--src/server/BlockFactory.cpp2
-rw-r--r--src/server/BlockImpl.cpp3
-rw-r--r--src/server/BlockImpl.hpp9
-rw-r--r--src/server/Broadcaster.cpp8
-rw-r--r--src/server/Broadcaster.hpp2
-rw-r--r--src/server/ClientUpdate.cpp1
-rw-r--r--src/server/CompiledGraph.cpp9
-rw-r--r--src/server/CompiledGraph.hpp14
-rw-r--r--src/server/ControlBindings.cpp7
-rw-r--r--src/server/Engine.cpp1
-rw-r--r--src/server/Engine.hpp7
-rw-r--r--src/server/GraphImpl.cpp10
-rw-r--r--src/server/GraphImpl.hpp12
-rw-r--r--src/server/InternalPlugin.cpp2
-rw-r--r--src/server/JackDriver.cpp1
-rw-r--r--src/server/LV2Block.cpp35
-rw-r--r--src/server/LV2Plugin.cpp4
-rw-r--r--src/server/PortImpl.cpp15
-rw-r--r--src/server/PortImpl.hpp1
-rw-r--r--src/server/PreProcessContext.hpp11
-rw-r--r--src/server/PreProcessor.cpp5
-rw-r--r--src/server/RunContext.cpp6
-rw-r--r--src/server/Task.hpp2
-rw-r--r--src/server/UndoStack.cpp11
-rw-r--r--src/server/Worker.cpp12
-rw-r--r--src/server/events/Connect.cpp8
-rw-r--r--src/server/events/Connect.hpp2
-rw-r--r--src/server/events/Copy.cpp14
-rw-r--r--src/server/events/Copy.hpp3
-rw-r--r--src/server/events/CreateBlock.cpp8
-rw-r--r--src/server/events/CreateBlock.hpp3
-rw-r--r--src/server/events/CreateGraph.cpp8
-rw-r--r--src/server/events/CreateGraph.hpp3
-rw-r--r--src/server/events/CreatePort.cpp2
-rw-r--r--src/server/events/Delete.cpp10
-rw-r--r--src/server/events/Delete.hpp4
-rw-r--r--src/server/events/Delta.cpp11
-rw-r--r--src/server/events/Delta.hpp6
-rw-r--r--src/server/events/Disconnect.cpp9
-rw-r--r--src/server/events/Disconnect.hpp2
-rw-r--r--src/server/events/DisconnectAll.cpp7
-rw-r--r--src/server/events/DisconnectAll.hpp3
-rw-r--r--src/server/events/Get.cpp4
-rw-r--r--src/server/events/Mark.cpp4
-rw-r--r--src/server/events/Mark.hpp9
-rw-r--r--src/server/events/Move.cpp4
-rw-r--r--src/server/events/SetPortValue.cpp8
-rw-r--r--src/server/ingen_engine.cpp4
-rw-r--r--src/server/ingen_lv2.cpp37
-rw-r--r--src/server/ingen_portaudio.cpp4
-rw-r--r--src/server/internals/Controller.cpp1
-rw-r--r--src/server/internals/Note.cpp1
-rw-r--r--src/server/internals/Time.cpp5
-rw-r--r--src/server/internals/Trigger.cpp1
-rw-r--r--src/server/meson.build38
121 files changed, 506 insertions, 471 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 8b9aa445..7b04d6c4 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -4,6 +4,7 @@ Checks: >
-*-vararg,
-android-cloexec-*,
-bugprone-easily-swappable-parameters,
+ -bugprone-unchecked-optional-access,
-cert-dcl50-cpp,
-cert-err33-c,
-cert-err34-c,
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 87c6f541..df9a8e4b 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -22,7 +22,6 @@
#include "ingen/Message.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
-#include "ingen/Status.hpp"
#include "ingen/URI.hpp"
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
@@ -38,6 +37,8 @@
namespace ingen {
+enum class Status;
+
AtomReader::AtomReader(URIMap& map, URIs& uris, Log& log, Interface& iface)
: _map(map)
, _uris(uris)
diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp
index 604bafdc..e18b48b8 100644
--- a/src/AtomWriter.cpp
+++ b/src/AtomWriter.cpp
@@ -67,7 +67,6 @@
#include <cassert>
#include <cstdint>
#include <map>
-#include <string>
#include <utility>
#include <variant>
diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp
index 9c1d8f28..b782bcc7 100644
--- a/src/ClashAvoider.cpp
+++ b/src/ClashAvoider.cpp
@@ -118,8 +118,8 @@ ClashAvoider::map_path(const raul::Path& in)
name = "_";
}
- raul::Symbol sym(name);
- std::string str = ss.str();
+ const raul::Symbol sym{name};
+ const std::string str{ss.str()};
auto i = _symbol_map.emplace(in, raul::Path(str));
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index aaf421cb..99675c7b 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -34,7 +34,6 @@
#include <cstring>
#include <filesystem>
#include <memory>
-#include <sstream>
#include <thread>
#include <utility>
#include <vector>
@@ -146,8 +145,8 @@ Configuration::set_value_from_string(Configuration::Option& option,
const std::string& value)
{
if (option.type == _forge.Int) {
- char* endptr = nullptr;
- int intval = static_cast<int>(strtol(value.c_str(), &endptr, 10));
+ char* endptr = nullptr;
+ const int intval = static_cast<int>(strtol(value.c_str(), &endptr, 10));
if (endptr && *endptr == '\0') {
option.value = _forge.make(intval);
} else {
@@ -247,8 +246,11 @@ Configuration::load(const FilePath& path)
SerdEnv* env = serd_env_new(&node);
model.load_file(env, SERD_TURTLE, uri, uri);
- Sord::Node nodemm(world, Sord::Node::URI, reinterpret_cast<const char*>(node.buf));
- Sord::Node nil;
+ const Sord::Node nodemm{world,
+ Sord::Node::URI,
+ reinterpret_cast<const char*>(node.buf)};
+
+ const Sord::Node nil;
for (auto i = model.find(nodemm, nil, nil); !i.end(); ++i) {
const auto& pred = i.get_predicate();
const auto& obj = i.get_object();
@@ -287,8 +289,8 @@ Configuration::save(URIMap& uri_map,
}
// Attempt to open file for writing
- std::unique_ptr<FILE, decltype(&fclose)> file{fopen(path.c_str(), "w"),
- &fclose};
+ const std::unique_ptr<FILE, int (*)(FILE*)> file{
+ fopen(path.c_str(), "w"), &fclose};
if (!file) {
throw FileError(fmt("Failed to open file %1% (%2%)",
path, strerror(errno)));
@@ -343,7 +345,7 @@ Configuration::save(URIMap& uri_map,
}
const std::string key(std::string("ingen:") + o.second.key);
- SerdNode pred = serd_node_from_string(
+ const SerdNode pred = serd_node_from_string(
SERD_CURIE, reinterpret_cast<const uint8_t*>(key.c_str()));
sratom_write(sratom, &uri_map.urid_unmap(), 0,
&base, &pred, value.type(), value.size(), value.get_body());
diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp
index 65fe6f6b..7d9003c0 100644
--- a/src/LV2Features.cpp
+++ b/src/LV2Features.cpp
@@ -71,7 +71,7 @@ LV2Features::lv2_features(World& world, Node* node) const
{
FeatureArray::FeatureVector vec;
for (const auto& f : _features) {
- std::shared_ptr<LV2_Feature> fptr = f->feature(world, node);
+ const std::shared_ptr<LV2_Feature> fptr = f->feature(world, node);
if (fptr) {
vec.push_back(fptr);
}
diff --git a/src/Log.cpp b/src/Log.cpp
index e05caa21..e17e1555 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -96,16 +96,16 @@ Log::vtprintf(LV2_URID type, const char* fmt, va_list args)
if (_log) {
ret = _log->vprintf(_log->handle, type, fmt, args);
} else if (type == _uris.log_Error) {
- ColorContext ctx(stderr, ColorContext::Color::RED);
+ const ColorContext ctx{stderr, ColorContext::Color::RED};
ret = vfprintf(stderr, fmt, args);
} else if (type == _uris.log_Warning) {
- ColorContext ctx(stderr, ColorContext::Color::YELLOW);
+ const ColorContext ctx{stderr, ColorContext::Color::YELLOW};
ret = vfprintf(stderr, fmt, args);
} else if (type == _uris.log_Note) {
- ColorContext ctx(stderr, ColorContext::Color::GREEN);
+ const ColorContext ctx{stderr, ColorContext::Color::GREEN};
ret = vfprintf(stdout, fmt, args);
} else if (_trace && type == _uris.log_Trace) {
- ColorContext ctx(stderr, ColorContext::Color::GREEN);
+ const ColorContext ctx{stderr, ColorContext::Color::GREEN};
ret = vfprintf(stderr, fmt, args);
} else {
fprintf(stderr, "Unknown log type %u\n", type);
diff --git a/src/Parser.cpp b/src/Parser.cpp
index 58801dba..2a22c31b 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -42,10 +42,8 @@
#include <filesystem>
#include <map>
#include <set>
-#include <sstream>
#include <string>
#include <string_view>
-#include <type_traits>
#include <utility>
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -91,7 +89,7 @@ Parser::find_resources(Sord::World& world,
static std::optional<raul::Path>
get_path(const URI& base, const URI& uri)
{
- const URI relative = uri.make_relative(base);
+ const URI relative = uri.make_relative(base, base);
const std::string uri_str = "/" + relative.string();
return raul::Path::is_valid(uri_str) ? raul::Path(uri_str)
: std::optional<raul::Path>();
@@ -284,8 +282,8 @@ parse_block(ingen::World& world,
serd_uri_parse(reinterpret_cast<const uint8_t*>(base_uri.c_str()),
&base_uri_parts);
- SerdURI ignored;
- SerdNode sub_uri =
+ SerdURI ignored;
+ const SerdNode sub_uri =
serd_node_new_uri_from_string(type_uri, &base_uri_parts, &ignored);
const std::string sub_uri_str =
@@ -300,7 +298,7 @@ parse_block(ingen::World& world,
sub_model.load_file(env, SERD_TURTLE, sub_file);
serd_env_free(env);
- Sord::URI sub_node(*world.rdf_world(), sub_file);
+ const Sord::URI sub_node{*world.rdf_world(), sub_file};
parse_graph(world,
target,
sub_model,
@@ -358,7 +356,7 @@ parse_graph(ingen::World& world,
}
// Create graph
- Properties props = get_properties(world, model, subject, ctx, data);
+ const Properties props = get_properties(world, model, subject, ctx, data);
target.put(path_to_uri(graph_path), props, ctx);
// For each port on this graph
@@ -397,8 +395,8 @@ parse_graph(ingen::World& world,
// For each block in this graph
for (auto n = model.find(subject, ingen_block, nil); !n.end(); ++n) {
- Sord::Node node = n.get_object();
- URI node_uri = node;
+ const Sord::Node node = n.get_object();
+ const URI node_uri = node;
assert(!node_uri.path().empty() && node_uri.path() != "/");
const raul::Path block_path = graph_path.child(
raul::Symbol(FilePath(node_uri.path()).stem().string()));
@@ -583,19 +581,19 @@ parse(ingen::World& world,
symbol,
data);
} else if (types.find(block_class) != types.end()) {
- const raul::Path rel_path(*get_path(base_uri, s));
+ const raul::Path rel_path{*get_path(base_uri, s)};
const raul::Path path = parent ? parent->child(rel_path) : rel_path;
ret = parse_block(world, target, model, base_uri, s, path, data);
} else if (types.find(in_port_class) != types.end() ||
types.find(out_port_class) != types.end()) {
- const raul::Path rel_path(*get_path(base_uri, s));
+ const raul::Path rel_path{*get_path(base_uri, s)};
const raul::Path path = parent ? parent->child(rel_path) : rel_path;
const Properties properties =
get_properties(world, model, s, Resource::Graph::DEFAULT, data);
target.put(path_to_uri(path), properties);
ret = path;
} else if (types.find(arc_class) != types.end()) {
- raul::Path parent_path(parent ? parent.value() : raul::Path("/"));
+ const raul::Path parent_path{parent ? parent.value() : raul::Path("/")};
parse_arc(world, target, model, base_uri, s, parent_path);
} else {
world.log().error("Subject has no known types\n");
@@ -624,7 +622,7 @@ Parser::parse_file(ingen::World& world,
const FilePath manifest_path =
(is_bundle ? file_path / "manifest.ttl" : file_path);
- URI manifest_uri(manifest_path);
+ const URI manifest_uri{manifest_path};
// Find graphs in manifest
const std::set<ResourceRecord> resources =
@@ -659,10 +657,10 @@ Parser::parse_file(ingen::World& world,
}
// Initialise parsing environment
- const URI file_uri = URI(file_path);
- const auto* uri_c_str = reinterpret_cast<const uint8_t*>(uri.c_str());
- SerdNode base_node = serd_node_from_string(SERD_URI, uri_c_str);
- SerdEnv* env = serd_env_new(&base_node);
+ const URI file_uri = URI(file_path);
+ const auto* uri_c_str = reinterpret_cast<const uint8_t*>(uri.c_str());
+ const SerdNode base_node = serd_node_from_string(SERD_URI, uri_c_str);
+ SerdEnv* env = serd_env_new(&base_node);
// Load graph into model
Sord::Model model(*world.rdf_world(),
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index 7bfa4211..e5d3cb15 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -44,10 +44,8 @@
#include <cstdint>
#include <cstring>
#include <filesystem>
-#include <map>
#include <memory>
#include <set>
-#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
@@ -204,7 +202,7 @@ Serialiser::Impl::write_bundle(const std::shared_ptr<const Node>& graph,
start_to_file(graph->path(), main_file);
- std::set<const Resource*> plugins =
+ const std::set<const Resource*> plugins =
serialise_graph(graph,
Sord::URI(_model->world(), main_file, _base_uri));
@@ -260,7 +258,7 @@ Serialiser::Impl::finish()
{
std::string ret;
if (_mode == Mode::TO_FILE) {
- SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE);
+ const SerdStatus st = _model->write_to_file(_base_uri, SERD_TURTLE);
if (st) {
_world.log().error("Error writing file %1% (%2%)\n",
_base_uri,
@@ -356,7 +354,7 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
}
if (n->second->graph_type() == Node::GraphType::GRAPH) {
- std::shared_ptr<Node> subgraph = n->second;
+ const std::shared_ptr<Node> subgraph = n->second;
SerdURI base_uri;
serd_uri_parse(reinterpret_cast<const uint8_t*>(_base_uri.c_str()),
@@ -377,7 +375,7 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
subgraph_node.buf));
// Save our state
- URI my_base_uri = _base_uri;
+ const URI my_base_uri = _base_uri;
Sord::Model* my_model = _model;
// Write child bundle within this bundle
@@ -396,7 +394,7 @@ Serialiser::Impl::serialise_graph(const std::shared_ptr<const Node>& graph,
serd_node_free(&subgraph_node);
} else if (n->second->graph_type() == Node::GraphType::BLOCK) {
- std::shared_ptr<const Node> block = n->second;
+ const std::shared_ptr<const Node> block = n->second;
const Sord::URI class_id(world, block->plugin()->uri());
const Sord::Node block_id(path_rdf_node(n->second->path()));
@@ -480,7 +478,7 @@ Serialiser::Impl::serialise_port(const Node* port,
Resource::Graph context,
const Sord::Node& port_id)
{
- URIs& uris = _world.uris();
+ const URIs& uris = _world.uris();
Sord::World& world = _model->world();
Properties props = port->properties(context);
@@ -558,9 +556,8 @@ void
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()));
+ const 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);
diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp
index 83854bf9..93677c6c 100644
--- a/src/SocketReader.cpp
+++ b/src/SocketReader.cpp
@@ -123,7 +123,7 @@ SocketReader::run()
AtomForge forge(map);
{
// Lock RDF world
- std::lock_guard<std::mutex> lock(_world.rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_world.rdf_mutex()};
// Use <ingen:/> as base URI, so relative URIs are like bundle paths
base_uri = sord_new_uri(world->c_obj(),
@@ -174,10 +174,10 @@ SocketReader::run()
}
// Lock RDF world
- std::lock_guard<std::mutex> lock(_world.rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_world.rdf_mutex()};
// Read until the next '.'
- SerdStatus st = serd_reader_read_chunk(reader);
+ const SerdStatus st = serd_reader_read_chunk(reader);
if (st == SERD_FAILURE || !_msg_node) {
continue; // Read nothing, e.g. just whitespace
}
@@ -200,7 +200,7 @@ SocketReader::run()
}
// Lock RDF world
- std::lock_guard<std::mutex> lock(_world.rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_world.rdf_mutex()};
// Destroy everything
sord_inserter_free(_inserter);
diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp
index 6bbab6cb..e736eec8 100644
--- a/src/SocketWriter.cpp
+++ b/src/SocketWriter.cpp
@@ -16,7 +16,6 @@
#include "ingen/SocketWriter.hpp"
-#include "ingen/URI.hpp"
#include "raul/Socket.hpp"
#include <memory>
@@ -52,7 +51,7 @@ SocketWriter::message(const Message& message)
size_t
SocketWriter::text_sink(const void* buf, size_t len)
{
- ssize_t ret = send(_socket->fd(), buf, len, MSG_NOSIGNAL);
+ const ssize_t ret = send(_socket->fd(), buf, len, MSG_NOSIGNAL);
if (ret < 0) {
return 0;
}
diff --git a/src/StreamWriter.cpp b/src/StreamWriter.cpp
index d8a93a0b..f23a6205 100644
--- a/src/StreamWriter.cpp
+++ b/src/StreamWriter.cpp
@@ -17,7 +17,6 @@
#include "ingen/StreamWriter.hpp"
#include "ingen/ColorContext.hpp"
-#include "ingen/URI.hpp"
namespace ingen {
@@ -34,7 +33,7 @@ StreamWriter::StreamWriter(URIMap& map,
size_t
StreamWriter::text_sink(const void* buf, size_t len)
{
- ColorContext ctx(_stream, _color);
+ const ColorContext ctx{_stream, _color};
return fwrite(buf, 1, len, _stream);
}
diff --git a/src/TurtleWriter.cpp b/src/TurtleWriter.cpp
index 1f5b0529..61f8b543 100644
--- a/src/TurtleWriter.cpp
+++ b/src/TurtleWriter.cpp
@@ -19,6 +19,7 @@
#include "ingen/URIMap.hpp"
#include "lv2/atom/atom.h"
#include "serd/serd.h"
+#include "sratom/sratom.h"
#include <utility>
diff --git a/src/URI.cpp b/src/URI.cpp
index cc40a9a3..c4020c4d 100644
--- a/src/URI.cpp
+++ b/src/URI.cpp
@@ -24,10 +24,7 @@
namespace ingen {
-URI::URI()
- : _uri(SERD_URI_NULL)
- , _node(SERD_NODE_NULL)
-{}
+URI::URI() : _uri(SERD_URI_NULL), _node(SERD_NODE_NULL) {}
URI::URI(const std::string& str)
: _uri(SERD_URI_NULL)
@@ -35,14 +32,16 @@ URI::URI(const std::string& str)
str.c_str()),
nullptr,
&_uri))
-{}
+{
+}
URI::URI(const char* str)
: _uri(SERD_URI_NULL)
, _node(serd_node_new_uri_from_string(reinterpret_cast<const uint8_t*>(str),
nullptr,
&_uri))
-{}
+{
+}
URI::URI(const std::string& str, const URI& base)
: _uri(SERD_URI_NULL)
@@ -50,25 +49,22 @@ URI::URI(const std::string& str, const URI& base)
str.c_str()),
&base._uri,
&_uri))
-{}
+{
+}
URI::URI(SerdNode node)
- : _uri(SERD_URI_NULL)
- , _node(serd_node_new_uri_from_node(&node, nullptr, &_uri))
+ : _uri(SERD_URI_NULL)
+ , _node(serd_node_new_uri_from_node(&node, nullptr, &_uri))
{
assert(node.type == SERD_URI);
}
-URI::URI(SerdNode node, SerdURI uri)
- : _uri(uri)
- , _node(node)
+URI::URI(SerdNode node, SerdURI uri) : _uri(uri), _node(node)
{
assert(node.type == SERD_URI);
}
-URI::URI(const Sord::Node& node)
- : URI(*node.to_serd_node())
-{}
+URI::URI(const Sord::Node& node) : URI(*node.to_serd_node()) {}
URI::URI(const FilePath& path)
: _uri(SERD_URI_NULL)
@@ -77,12 +73,13 @@ URI::URI(const FilePath& path)
nullptr,
&_uri,
true))
-{}
+{
+}
URI::URI(const URI& uri)
- : _uri(SERD_URI_NULL)
- , _node(serd_node_new_uri(&uri._uri, nullptr, &_uri))
-{}
+ : _uri(SERD_URI_NULL), _node(serd_node_new_uri(&uri._uri, nullptr, &_uri))
+{
+}
URI&
URI::operator=(const URI& uri)
@@ -95,9 +92,7 @@ URI::operator=(const URI& uri)
return *this;
}
-URI::URI(URI&& uri) noexcept
- : _uri(uri._uri)
- , _node(uri._node)
+URI::URI(URI&& uri) noexcept : _uri(uri._uri), _node(uri._node)
{
uri._node = SERD_NODE_NULL;
uri._uri = SERD_URI_NULL;
@@ -123,8 +118,20 @@ URI::~URI()
URI
URI::make_relative(const URI& base) const
{
- SerdURI uri;
- SerdNode node = serd_node_new_relative_uri(&_uri, &base._uri, nullptr, &uri);
+ SerdURI uri;
+ const SerdNode node =
+ serd_node_new_relative_uri(&_uri, &base._uri, nullptr, &uri);
+
+ return {node, uri};
+}
+
+URI
+URI::make_relative(const URI& base, const URI& root) const
+{
+ SerdURI uri;
+ const SerdNode node =
+ serd_node_new_relative_uri(&_uri, &base._uri, &root._uri, &uri);
+
return {node, uri};
}
diff --git a/src/URIMap.cpp b/src/URIMap.cpp
index 0d6654a5..bb484529 100644
--- a/src/URIMap.cpp
+++ b/src/URIMap.cpp
@@ -50,9 +50,9 @@ LV2_URID
URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle h,
const char* c_uri)
{
- auto* const map(static_cast<URIMap*>(h));
- std::string uri(c_uri);
- std::lock_guard<std::mutex> lock(map->_mutex);
+ auto* const map{static_cast<URIMap*>(h)};
+ std::string uri{c_uri};
+ const std::lock_guard<std::mutex> lock{map->_mutex};
auto record = map->_map.emplace(uri, map->_map.size() + 1);
const auto id = record.first->second;
@@ -92,8 +92,8 @@ const char*
URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle h,
LV2_URID urid)
{
- auto* const map(static_cast<URIMap*>(h));
- std::lock_guard<std::mutex> lock(map->_mutex);
+ auto* const map{static_cast<URIMap*>(h)};
+ const std::lock_guard<std::mutex> lock{map->_mutex};
return (urid > 0 && urid <= map->_unmap.size()
? map->_unmap[urid - 1].c_str()
diff --git a/src/URIs.cpp b/src/URIs.cpp
index 41706868..27e2e8f1 100644
--- a/src/URIs.cpp
+++ b/src/URIs.cpp
@@ -18,6 +18,7 @@
#include "ingen/Forge.hpp"
#include "ingen/ingen.h"
+#include "lilv/lilv.h"
#include "lv2/atom/atom.h"
#include "lv2/buf-size/buf-size.h"
#include "lv2/core/lv2.h"
diff --git a/src/World.cpp b/src/World.cpp
index c03641f5..03a47773 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -43,7 +43,6 @@
#include <list>
#include <map>
#include <memory>
-#include <sstream>
#include <string>
#include <utility>
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index c492d3e6..7cfd439d 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -19,7 +19,6 @@
#include "ingen/Atom.hpp"
#include "ingen/Forge.hpp"
#include "ingen/Log.hpp"
-#include "ingen/Node.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
#include "ingen/URIs.hpp"
@@ -75,7 +74,7 @@ ClientStore::add_object(const std::shared_ptr<ObjectModel>& object)
std::dynamic_pointer_cast<ObjectModel>(existing->second)->set(object);
} else {
if (!object->path().is_root()) {
- std::shared_ptr<ObjectModel> parent = _object(object->path().parent());
+ const std::shared_ptr<ObjectModel> parent = _object(object->path().parent());
if (parent) {
assert(object->path().is_child_of(parent->path()));
object->set_parent(parent);
@@ -200,7 +199,7 @@ ClientStore::resource(const URI& uri) const
void
ClientStore::add_plugin(const std::shared_ptr<PluginModel>& pm)
{
- std::shared_ptr<PluginModel> existing = _plugin(pm->uri());
+ const std::shared_ptr<PluginModel> existing = _plugin(pm->uri());
if (existing) {
existing->set(pm);
} else {
@@ -285,7 +284,7 @@ ClientStore::operator()(const Put& msg)
if (_uris.ingen_Graph == type) {
is_graph = true;
} else if (_uris.ingen_Internal == type || _uris.lv2_Plugin == type) {
- std::shared_ptr<PluginModel> p(new PluginModel(uris(), uri, type, properties));
+ const std::shared_ptr<PluginModel> p{new PluginModel(uris(), uri, type, properties)};
add_plugin(p);
return;
}
@@ -309,7 +308,7 @@ ClientStore::operator()(const Put& msg)
}
if (is_graph) {
- std::shared_ptr<GraphModel> model(new GraphModel(uris(), path));
+ const std::shared_ptr<GraphModel> model{new GraphModel(uris(), path)};
model->set_properties(properties);
add_object(model);
} else if (is_block) {
@@ -330,14 +329,14 @@ ClientStore::operator()(const Put& msg)
add_plugin(plug);
}
- std::shared_ptr<BlockModel> bm(new BlockModel(uris(), plug, path));
+ const std::shared_ptr<BlockModel> bm{new BlockModel(uris(), plug, path)};
bm->set_properties(properties);
add_object(bm);
} else {
_log.warn("Block %1% has no prototype\n", path.c_str());
}
} else if (is_port) {
- PortModel::Direction pdir = (is_output)
+ const PortModel::Direction pdir = (is_output)
? PortModel::Direction::OUTPUT
: PortModel::Direction::INPUT;
uint32_t index = 0;
@@ -346,7 +345,7 @@ ClientStore::operator()(const Put& msg)
index = i->second.get<int32_t>();
}
- std::shared_ptr<PortModel> p(new PortModel(uris(), path, index, pdir));
+ const std::shared_ptr<PortModel> p{new PortModel(uris(), path, index, pdir)};
p->set_properties(properties);
add_object(p);
} else {
@@ -370,7 +369,7 @@ ClientStore::operator()(const Delta& msg)
const raul::Path path(uri_to_path(uri));
- std::shared_ptr<ObjectModel> obj = _object(path);
+ const std::shared_ptr<ObjectModel> obj = _object(path);
if (obj) {
obj->remove_properties(msg.remove);
obj->add_properties(msg.add);
@@ -391,7 +390,7 @@ ClientStore::operator()(const SetProperty& msg)
predicate.c_str(), _uris.forge.str(value, false));
return;
}
- std::shared_ptr<Resource> subject = _resource(subject_uri);
+ const std::shared_ptr<Resource> subject = _resource(subject_uri);
if (subject) {
if (predicate == _uris.ingen_activity) {
/* Activity is transient, trigger any live actions (like GUI
@@ -401,7 +400,7 @@ ClientStore::operator()(const SetProperty& msg)
subject->set_property(predicate, value, msg.ctx);
}
} else {
- std::shared_ptr<PluginModel> plugin = _plugin(subject_uri);
+ const std::shared_ptr<PluginModel> plugin = _plugin(subject_uri);
if (plugin) {
plugin->set_property(predicate, value);
} else if (predicate != _uris.ingen_activity) {
@@ -449,8 +448,8 @@ ClientStore::attempt_connection(const raul::Path& tail_path,
auto head = std::dynamic_pointer_cast<PortModel>(_object(head_path));
if (tail && head) {
- std::shared_ptr<GraphModel> graph = connection_graph(tail_path, head_path);
- std::shared_ptr<ArcModel> arc(new ArcModel(tail, head));
+ const std::shared_ptr<GraphModel> graph = connection_graph(tail_path, head_path);
+ const std::shared_ptr<ArcModel> arc(new ArcModel(tail, head));
graph->add_arc(arc);
return true;
}
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index 2a998fdf..45d0eb31 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -134,7 +134,7 @@ GraphModel::add_arc(const std::shared_ptr<ArcModel>& arc)
assert(arc->head()->parent().get() == this
|| arc->head()->parent()->parent().get() == this);
- std::shared_ptr<ArcModel> existing = get_arc(
+ const std::shared_ptr<ArcModel> existing = get_arc(
arc->tail().get(), arc->head().get());
if (existing) {
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index 86ffa821..0c3bf517 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -22,6 +22,8 @@
#include "ingen/Resource.hpp"
#include "ingen/URIs.hpp"
#include "ingen/paths.hpp"
+#include "raul/Path.hpp"
+#include "raul/Symbol.hpp"
#include <cassert>
#include <cstdint>
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4371132c..333bf568 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -18,7 +18,9 @@
#include "ingen/Atom.hpp"
#include "ingen/client/PluginUI.hpp"
+#include "lilv/lilv.h"
#include "lv2/core/lv2.h"
+#include "raul/Symbol.hpp"
#include <cctype>
#include <cstring>
@@ -106,7 +108,7 @@ PluginModel::get_property(const URI& key) const
}
str = str.substr(last_delim + 1);
- std::string symbol = raul::Symbol::symbolify(str);
+ const std::string symbol = raul::Symbol::symbolify(str);
set_property(_uris.lv2_symbol, _uris.forge.alloc(symbol));
return get_property(key);
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index f0c3834a..61813cab 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -24,10 +24,12 @@
#include "ingen/World.hpp"
#include "ingen/client/BlockModel.hpp"
#include "ingen/client/PortModel.hpp"
+#include "lilv/lilv.h"
#include "lv2/atom/atom.h"
#include "lv2/core/lv2.h"
#include "lv2/ui/ui.h"
#include "raul/Symbol.hpp"
+#include "suil/suil.h"
#include <sigc++/signal.h>
@@ -88,9 +90,9 @@ lv2_ui_write(SuilController controller,
} else if (format == uris.atom_eventTransfer.urid()) {
const auto* atom = static_cast<const LV2_Atom*>(buffer);
- Atom val = Forge::alloc(atom->size,
- atom->type,
- LV2_ATOM_BODY_CONST(atom));
+ const Atom val =
+ Forge::alloc(atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
+
ui->signal_property_changed()(port->uri(),
uris.ingen_activity,
val,
@@ -122,8 +124,8 @@ lv2_ui_subscribe(SuilController controller,
uint32_t protocol,
const LV2_Feature* const* features)
{
- auto* const ui = static_cast<PluginUI*>(controller);
- std::shared_ptr<const PortModel> port = get_port(ui, port_index);
+ auto* const ui = static_cast<PluginUI*>(controller);
+ const std::shared_ptr<const PortModel> port = get_port(ui, port_index);
if (!port) {
return 1;
}
@@ -173,7 +175,7 @@ PluginUI::PluginUI(ingen::World& world,
PluginUI::~PluginUI()
{
- for (uint32_t i : _subscribed_ports) {
+ for (const uint32_t i : _subscribed_ports) {
lv2_ui_unsubscribe(this, i, 0, nullptr);
}
suil_instance_free(_instance);
@@ -259,7 +261,7 @@ PluginUI::instantiate()
plugin_uri, lilv_node_as_string(_ui_node));
} else if (!strcmp(lilv_node_as_uri(plug), plugin_uri.c_str())) {
// Notification is valid and for this plugin
- uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
+ const uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym));
if (index != LV2UI_INVALID_PORT_INDEX) {
lv2_ui_subscribe(this, index, 0, nullptr);
_subscribed_ports.insert(index);
@@ -293,7 +295,7 @@ PluginUI::instantiate()
if (!_instance) {
_world.log().error("Failed to instantiate LV2 UI\n");
// Cancel any subscriptions
- for (uint32_t i : _subscribed_ports) {
+ for (const uint32_t i : _subscribed_ports) {
lv2_ui_unsubscribe(this, i, 0, nullptr);
}
return false;
diff --git a/src/gui/.clang-tidy b/src/gui/.clang-tidy
index acd4db6e..4dc4facc 100644
--- a/src/gui/.clang-tidy
+++ b/src/gui/.clang-tidy
@@ -25,5 +25,6 @@ Checks: >
-google-runtime-references,
-hicpp-multiway-paths-covered,
-hicpp-vararg,
+ -llvm-header-guard,
-readability-convert-member-functions-to-static,
InheritParentConfig: true
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index bbad8d0b..5ae1c8d9 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -31,11 +31,11 @@
#include "ingen/ColorContext.hpp"
#include "ingen/Configuration.hpp"
#include "ingen/EngineBase.hpp"
-#include "ingen/FilePath.hpp"
#include "ingen/Forge.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
#include "ingen/QueuedInterface.hpp"
+#include "ingen/Status.hpp"
#include "ingen/StreamWriter.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
@@ -45,6 +45,7 @@
#include "ingen/client/SigClientInterface.hpp"
#include "ingen/runtime_paths.hpp"
#include "lilv/lilv.h"
+#include "lv2/urid/urid.h"
#include "suil/suil.h"
#include <glib.h>
@@ -66,7 +67,6 @@
#include <cassert>
#include <cstdio>
#include <exception>
-#include <functional>
#include <iostream>
#include <map>
#include <memory>
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index bb17e126..d7776896 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -20,7 +20,6 @@
#include "ingen/Message.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
-#include "ingen/Status.hpp"
#include "ingen/URI.hpp"
#include "ingen/World.hpp"
#include "ingen/ingen.h"
@@ -42,6 +41,8 @@ class Window;
namespace ingen {
+enum class Status;
+
class Atom;
class Forge;
class Interface;
@@ -97,7 +98,7 @@ public:
bool signal() const { return _enable_signal; }
void enable_signals(bool b) { _enable_signal = b; }
bool disable_signals() {
- bool old = _enable_signal;
+ const bool old = _enable_signal;
_enable_signal = false;
return old;
}
diff --git a/src/gui/Arc.cpp b/src/gui/Arc.cpp
index c9260d12..17cd57df 100644
--- a/src/gui/Arc.cpp
+++ b/src/gui/Arc.cpp
@@ -19,6 +19,7 @@
#include "ingen/URI.hpp"
#include "ingen/client/ArcModel.hpp"
#include "ingen/client/BlockModel.hpp"
+#include "ingen/client/ObjectModel.hpp"
#include "ingen/client/PortModel.hpp"
#include <glib-object.h>
@@ -27,13 +28,7 @@
#define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#"
-namespace ingen {
-
-namespace client {
-class ObjectModel;
-} // namespace client
-
-namespace gui {
+namespace ingen::gui {
Arc::Arc(Ganv::Canvas& canvas,
const std::shared_ptr<const client::ArcModel>& model,
@@ -41,8 +36,8 @@ Arc::Arc(Ganv::Canvas& canvas,
Ganv::Node* dst)
: Ganv::Edge(canvas, src, dst), _arc_model(model)
{
- std::shared_ptr<const client::ObjectModel> tparent = model->tail()->parent();
- std::shared_ptr<const client::BlockModel> tparent_block;
+ const std::shared_ptr<const client::ObjectModel> tparent = model->tail()->parent();
+ std::shared_ptr<const client::BlockModel> tparent_block;
if ((tparent_block = std::dynamic_pointer_cast<const client::BlockModel>(tparent))) {
if (tparent_block->plugin_uri() == NS_INTERNALS "BlockDelay") {
g_object_set(_gobj, "dash-length", 4.0, nullptr);
@@ -51,5 +46,4 @@ Arc::Arc(Ganv::Canvas& canvas,
}
}
-} // namespace gui
-} // namespace ingen
+} // namespace ingen::gui
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 2033457d..076a259f 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -20,6 +20,7 @@
#include "GraphView.hpp"
#include "ingen/client/SigClientInterface.hpp"
+#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
#include <glibmm/signalproxy.h>
@@ -64,7 +65,7 @@ void
BreadCrumbs::build(const raul::Path& path,
const std::shared_ptr<GraphView>& view)
{
- bool old_enable_signal = _enable_signal;
+ const bool old_enable_signal = _enable_signal;
_enable_signal = false;
if (!_breadcrumbs.empty() && (path.is_parent_of(_full_path) || path == _full_path)) {
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 2fd3be8c..f49b8788 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -27,6 +27,7 @@
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
#include "ingen/QueuedInterface.hpp"
+#include "ingen/Status.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/client/ClientStore.hpp"
@@ -43,6 +44,7 @@
#include <glibmm/ustring.h>
#include <gtkmm/builder.h>
#include <gtkmm/button.h>
+#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
#include <gtkmm/enums.h>
#include <gtkmm/image.h>
@@ -195,7 +197,7 @@ ConnectWindow::connect_remote(const URI& uri)
auto sci = std::make_shared<client::SigClientInterface>();
auto qi = std::make_shared<QueuedInterface>(sci);
- std::shared_ptr<ingen::Interface> iface(world.new_interface(uri, qi));
+ const std::shared_ptr<ingen::Interface> iface{world.new_interface(uri, qi)};
if (iface) {
world.set_interface(iface);
_app->attach(qi);
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index b0e03850..269a4d76 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -20,12 +20,10 @@
#include "Window.hpp"
#include "ingen/Message.hpp"
-#include "ingen/Status.hpp"
#include "ingen/URI.hpp"
#include <glibmm/refptr.h>
#include <gtkmm/builder.h>
-#include <gtkmm/dialog.h>
#include <cstdint>
#include <memory>
@@ -43,6 +41,8 @@ class SpinButton;
namespace ingen {
+enum class Status;
+
class Interface;
class World;
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 14258a5a..9efba2ee 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -228,7 +228,7 @@ GraphBox::GraphBox(BaseObjectType* cobject,
_menu_view_graph_properties->signal_activate().connect(
sigc::mem_fun(this, &GraphBox::event_show_properties));
- Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
+ const Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
clipboard->signal_owner_change().connect(
sigc::mem_fun(this, &GraphBox::event_clipboard_changed));
@@ -250,8 +250,12 @@ std::shared_ptr<GraphBox>
GraphBox::create(App& app, const std::shared_ptr<const GraphModel>& graph)
{
GraphBox* result = nullptr;
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win");
+ const Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("graph_win");
xml->get_widget_derived("graph_win_vbox", result);
+ if (!result) {
+ return {};
+ }
+
result->init_box(app);
result->set_graph(graph, nullptr);
@@ -535,7 +539,7 @@ GraphBox::event_show_engine()
void
GraphBox::event_clipboard_changed(GdkEventOwnerChange* ev)
{
- Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
+ const Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
_menu_paste->set_sensitive(clipboard->wait_is_text_available());
}
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 74542c87..896cbf1f 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -58,6 +58,7 @@
#include "ingen/client/PluginModel.hpp"
#include "ingen/client/PortModel.hpp"
#include "ingen/paths.hpp"
+#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
#include "sord/sordmm.hpp"
@@ -77,7 +78,6 @@
#include <gtkmm/menu.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menuitem.h>
-#include <gtkmm/menushell.h>
#include <gtkmm/object.h>
#include <gtkmm/stock.h>
#include <sigc++/adaptors/bind.h>
@@ -131,7 +131,7 @@ GraphCanvas::GraphCanvas(App& app,
, _app(app)
, _graph(std::move(graph))
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("canvas_menu");
+ const Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("canvas_menu");
xml->get_widget("canvas_menu", _menu);
xml->get_widget("canvas_menu_add_audio_input", _menu_add_audio_input);
@@ -302,7 +302,7 @@ GraphCanvas::build()
static void
show_module_human_names(GanvNode* node, void* data)
{
- bool b = *static_cast<bool*>(data);
+ const bool b = *static_cast<bool*>(data);
if (GANV_IS_MODULE(node)) {
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
auto* nmod = dynamic_cast<NodeModule*>(module);
@@ -688,7 +688,7 @@ serialise_arc(GanvEdge* arc, void* data)
void
GraphCanvas::copy_selection()
{
- std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_app.world().rdf_mutex()};
Serialiser serialiser(_app.world());
serialiser.start_to_string(_graph->path(), _graph->base_uri());
@@ -696,7 +696,7 @@ GraphCanvas::copy_selection()
for_each_selected_node(serialise_node, &serialiser);
for_each_selected_edge(serialise_arc, &serialiser);
- Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
+ const Glib::RefPtr<Gtk::Clipboard> clipboard = Gtk::Clipboard::get();
clipboard->set_text(serialiser.finish());
_paste_count = 0;
}
@@ -704,7 +704,7 @@ GraphCanvas::copy_selection()
void
GraphCanvas::paste()
{
- std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_app.world().rdf_mutex()};
const Glib::ustring str = Gtk::Clipboard::get()->wait_for_text();
auto parser = _app.loader()->parser();
@@ -888,8 +888,8 @@ GraphCanvas::load_plugin(const std::weak_ptr<PluginModel>& weak_plugin)
return;
}
- raul::Symbol symbol = plugin->default_block_symbol();
- unsigned offset = _app.store()->child_name_offset(_graph->path(), symbol);
+ raul::Symbol symbol = plugin->default_block_symbol();
+ const unsigned offset = _app.store()->child_name_offset(_graph->path(), symbol);
if (offset != 0) {
std::stringstream ss;
ss << symbol << "_" << offset;
diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp
index 53defd75..b6c55b24 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -27,6 +27,7 @@
#include "ingen/URIs.hpp"
#include "ingen/client/ClientStore.hpp"
#include "ingen/client/GraphModel.hpp"
+#include "ingen/client/ObjectModel.hpp"
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
@@ -159,7 +160,7 @@ GraphTreeWindow::find_graph(Gtk::TreeModel::Children root,
const std::shared_ptr<client::ObjectModel>& graph)
{
for (auto c = root.begin(); c != root.end(); ++c) {
- std::shared_ptr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col];
+ const std::shared_ptr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col];
if (graph == pm) {
return c;
}
@@ -198,7 +199,7 @@ GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path,
const auto active = _graph_treestore->get_iter(path);
auto row = *active;
- std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col];
+ const std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col];
_app->window_factory()->present_graph(pm);
}
@@ -206,11 +207,11 @@ GraphTreeWindow::event_graph_activated(const Gtk::TreeModel::Path& path,
void
GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str)
{
- Gtk::TreeModel::Path path(path_str);
- auto active = _graph_treestore->get_iter(path);
- auto row = *active;
+ const Gtk::TreeModel::Path path{path_str};
+ auto active = _graph_treestore->get_iter(path);
+ auto row = *active;
- std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col];
+ const std::shared_ptr<GraphModel> pm = row[_graph_tree_columns.graph_model_col];
assert(pm);
if (_enable_signal) {
diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp
index 8534d66c..16eb4647 100644
--- a/src/gui/GraphTreeWindow.hpp
+++ b/src/gui/GraphTreeWindow.hpp
@@ -29,7 +29,6 @@
#include <gtkmm/treeselection.h>
#include <gtkmm/treestore.h>
#include <gtkmm/treeview.h>
-#include <gtkmm/window.h>
#include <memory>
@@ -119,7 +118,7 @@ public:
void set_window(GraphTreeWindow* win) { _window = win; }
bool on_button_press_event(GdkEventButton* ev) override {
- bool ret = Gtk::TreeView::on_button_press_event(ev);
+ const bool ret = Gtk::TreeView::on_button_press_event(ev);
if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) {
_window->show_graph_menu(ev);
diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp
index a5ca7dd1..969e0add 100644
--- a/src/gui/GraphView.cpp
+++ b/src/gui/GraphView.cpp
@@ -120,8 +120,9 @@ GraphView::set_graph(const std::shared_ptr<const GraphModel>& graph)
std::shared_ptr<GraphView>
GraphView::create(App& app, const std::shared_ptr<const GraphModel>& graph)
{
- GraphView* result = nullptr;
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win");
+ GraphView* result = nullptr;
+ const Glib::RefPtr<Gtk::Builder> xml =
+ WidgetFactory::create("warehouse_win");
xml->get_widget_derived("graph_view_box", result);
if (!result) {
diff --git a/src/gui/GraphWindow.cpp b/src/gui/GraphWindow.cpp
index 4efaf4ae..a6978e46 100644
--- a/src/gui/GraphWindow.cpp
+++ b/src/gui/GraphWindow.cpp
@@ -25,6 +25,7 @@
#include <glibmm/refptr.h>
#include <gtkmm/builder.h>
#include <gtkmm/layout.h>
+#include <gtkmm/window.h>
namespace ingen::gui {
diff --git a/src/gui/GraphWindow.hpp b/src/gui/GraphWindow.hpp
index d1361ca5..05c555a5 100644
--- a/src/gui/GraphWindow.hpp
+++ b/src/gui/GraphWindow.hpp
@@ -21,7 +21,6 @@
#include "Window.hpp"
#include <gdk/gdk.h>
-#include <gtkmm/window.h>
#include <memory>
#include <string>
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index 61796de4..c9c18ae9 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -30,6 +30,7 @@
#include "ingen/client/GraphModel.hpp"
#include "ingen/runtime_paths.hpp"
#include "raul/Path.hpp"
+#include "raul/Symbol.hpp"
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
@@ -198,7 +199,7 @@ LoadGraphWindow::ok_clicked()
true, FilePath(get_filename()), parent, symbol, _initial_data);
} else {
- std::list<Glib::ustring> uri_list = get_filenames();
+ const std::list<Glib::ustring> uri_list = get_filenames();
for (const auto& u : uri_list) {
// Cascade
Atom& x = _initial_data.find(uris.ingen_canvasX)->second;
@@ -244,7 +245,7 @@ LoadGraphWindow::symbol_from_filename(const Glib::ustring& filename)
raul::Symbol
LoadGraphWindow::avoid_symbol_clash(const raul::Symbol& symbol)
{
- unsigned offset = _app->store()->child_name_offset(
+ const unsigned offset = _app->store()->child_name_offset(
_graph->path(), symbol);
if (offset != 0) {
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index 940f09b1..6a4d998c 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -45,6 +45,7 @@
#include <gtkmm/treeiter.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treeviewcolumn.h>
+#include <gtkmm/window.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
#include <sigc++/signal.h>
@@ -351,7 +352,7 @@ LoadPluginWindow::plugin_activated(const Gtk::TreeModel::Path& path,
void
LoadPluginWindow::plugin_selection_changed()
{
- size_t n_selected = _selection->get_selected_rows().size();
+ const size_t n_selected = _selection->get_selected_rows().size();
if (n_selected == 0) {
_name_offset = 0;
_name_entry->set_text("");
@@ -405,7 +406,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
const URIs& uris = _app->uris();
auto row = *iter;
auto plugin = row.get_value(_plugins_columns._col_plugin);
- bool polyphonic = _polyphonic_checkbutton->get_active();
+ const bool polyphonic = _polyphonic_checkbutton->get_active();
string name = _name_entry->get_text();
if (name.empty()) {
@@ -420,8 +421,8 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
dialog.run();
} else {
- raul::Path path = _graph->path().child(raul::Symbol::symbolify(name));
- Properties props = _initial_data;
+ const raul::Path path = _graph->path().child(raul::Symbol::symbolify(name));
+ Properties props = _initial_data;
props.emplace(uris.rdf_type, Property(uris.ingen_Block));
props.emplace(uris.lv2_prototype, _app->forge().make_urid(plugin->uri()));
props.emplace(uris.ingen_polyphonic, _app->forge().make(polyphonic));
@@ -457,7 +458,7 @@ LoadPluginWindow::filter_changed()
// Get selected criteria
const auto row = *(_filter_combo->get_active());
- CriteriaColumns::Criteria criteria = row[_criteria_columns._col_criteria];
+ const CriteriaColumns::Criteria criteria = row[_criteria_columns._col_criteria];
string field;
diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp
index 7a9313e2..2f98b3ae 100644
--- a/src/gui/LoadPluginWindow.hpp
+++ b/src/gui/LoadPluginWindow.hpp
@@ -30,7 +30,6 @@
#include <gtkmm/treemodel.h>
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/treeselection.h>
-#include <gtkmm/window.h>
#include <map>
#include <memory>
diff --git a/src/gui/MessagesWindow.cpp b/src/gui/MessagesWindow.cpp
index 7a382d51..db32af91 100644
--- a/src/gui/MessagesWindow.cpp
+++ b/src/gui/MessagesWindow.cpp
@@ -84,7 +84,7 @@ MessagesWindow::init_window(App& app)
void
MessagesWindow::post_error(const string& msg)
{
- Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
+ const Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
text_buf->insert_with_tag(text_buf->end(), msg, _error_tag);
text_buf->insert(text_buf->end(), "\n");
@@ -101,7 +101,7 @@ MessagesWindow::post_error(const string& msg)
int
MessagesWindow::log(LV2_URID type, const char* fmt, va_list args)
{
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
#if USE_VASPRINTF
char* buf = nullptr;
@@ -125,7 +125,7 @@ MessagesWindow::flush()
std::string line;
{
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
if (!_stream.rdbuf()->in_avail()) {
return;
}
@@ -133,7 +133,7 @@ MessagesWindow::flush()
std::getline(_stream, line, '\0');
}
- Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
+ const Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
auto t = _tags.find(type);
if (t != _tags.end()) {
@@ -151,7 +151,7 @@ MessagesWindow::flush()
void
MessagesWindow::clear_clicked()
{
- Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
+ const Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
text_buf->erase(text_buf->begin(), text_buf->end());
_clear_button->set_sensitive(false);
}
diff --git a/src/gui/MessagesWindow.hpp b/src/gui/MessagesWindow.hpp
index 97b6187c..27b6a417 100644
--- a/src/gui/MessagesWindow.hpp
+++ b/src/gui/MessagesWindow.hpp
@@ -23,7 +23,6 @@
#include <glibmm/refptr.h>
#include <gtkmm/texttag.h>
-#include <gtkmm/window.h>
#include <cstdarg>
#include <map>
diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp
index 086159a5..f10f8049 100644
--- a/src/gui/NewSubgraphWindow.cpp
+++ b/src/gui/NewSubgraphWindow.cpp
@@ -40,6 +40,7 @@
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/spinbutton.h>
+#include <gtkmm/window.h>
#include <sigc++/functors/mem_fun.h>
#include <cstdint>
@@ -93,7 +94,7 @@ NewSubgraphWindow::set_graph(std::shared_ptr<const client::GraphModel> graph)
void
NewSubgraphWindow::name_changed()
{
- std::string name = _name_entry->get_text();
+ const std::string name = _name_entry->get_text();
if (!raul::Symbol::is_valid(name)) {
_message_label->set_text("Name contains invalid characters.");
_ok_button->property_sensitive() = false;
diff --git a/src/gui/NewSubgraphWindow.hpp b/src/gui/NewSubgraphWindow.hpp
index be660da5..acb6c977 100644
--- a/src/gui/NewSubgraphWindow.hpp
+++ b/src/gui/NewSubgraphWindow.hpp
@@ -21,8 +21,6 @@
#include "ingen/Properties.hpp"
-#include <gtkmm/window.h>
-
#include <memory>
namespace Glib {
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 2ebc223d..0b511fc1 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -46,9 +46,9 @@
#include <gtkmm/filechooserdialog.h>
#include <gtkmm/image.h>
#include <gtkmm/label.h>
+#include <gtkmm/menu.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menuitem.h>
-#include <gtkmm/menushell.h>
#include <gtkmm/object.h>
#include <gtkmm/separatormenuitem.h>
#include <gtkmm/stock.h>
@@ -160,6 +160,12 @@ NodeMenu::init(App& app, const std::shared_ptr<const client::BlockModel>& block)
_enable_signal = true;
}
+std::shared_ptr<const client::BlockModel>
+NodeMenu::block() const
+{
+ return std::dynamic_pointer_cast<const client::BlockModel>(_object);
+}
+
void
NodeMenu::add_preset(const URI& uri, const std::string& label)
{
@@ -245,7 +251,7 @@ NodeMenu::on_save_preset_activated()
const std::string real_path = Glib::build_filename(dirname, bundle, file);
const std::string real_uri = Glib::filename_to_uri(real_path);
- Properties props{
+ const Properties props{
{ _app->uris().rdf_type,
_app->uris().pset_Preset },
{ _app->uris().rdfs_label,
diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp
index f109c3e4..7168bc7a 100644
--- a/src/gui/NodeMenu.hpp
+++ b/src/gui/NodeMenu.hpp
@@ -21,7 +21,6 @@
#include "ingen/URI.hpp"
-#include <gtkmm/menu.h>
#include <sigc++/connection.h>
#include <sigc++/signal.h>
@@ -35,6 +34,7 @@ template <class T> class RefPtr;
namespace Gtk {
class Builder;
class CheckMenuItem;
+class Menu;
class MenuItem;
} // namespace Gtk
@@ -66,9 +66,7 @@ public:
sigc::signal<void, bool> signal_embed_gui;
protected:
- std::shared_ptr<const client::BlockModel> block() const {
- return std::dynamic_pointer_cast<const client::BlockModel>(_object);
- }
+ std::shared_ptr<const client::BlockModel> block() const;
void add_preset(const URI& uri, const std::string& label);
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 1b090c4f..223c0832 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -207,7 +207,7 @@ NodeModule::show_human_names(bool b)
if (name_property.type() == uris.forge.String) {
label = name_property.ptr<char>();
} else {
- Glib::ustring hn = block()->plugin_model()->port_human_name(
+ const Glib::ustring hn = block()->plugin_model()->port_human_name(
port->model()->index());
if (!hn.empty()) {
label = hn;
@@ -532,9 +532,10 @@ NodeModule::on_selected(gboolean selected)
if (selected && win->documentation_is_visible()) {
std::string doc;
- bool html = false;
#if USE_WEBKIT
- html = true;
+ const bool html = true;
+#else
+ const bool html = false;
#endif
if (block()->plugin_model()) {
doc = block()->plugin_model()->documentation(html);
diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp
index ac3c3981..53917b1e 100644
--- a/src/gui/PluginMenu.cpp
+++ b/src/gui/PluginMenu.cpp
@@ -20,11 +20,11 @@
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/client/PluginModel.hpp"
+#include "lilv/lilv.h"
#include <glibmm/ustring.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menuitem.h>
-#include <gtkmm/menushell.h>
#include <gtkmm/object.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
@@ -126,7 +126,7 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu,
return 0;
}
- Gtk::Menu_Helpers::MenuElem menu_elem = Gtk::Menu_Helpers::MenuElem(
+ const Gtk::Menu_Helpers::MenuElem menu_elem = Gtk::Menu_Helpers::MenuElem(
std::string("_") + sub_label_str);
menu->items().push_back(menu_elem);
Gtk::MenuItem* menu_item = &(menu->items().back());
@@ -134,7 +134,7 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu,
Gtk::Menu* submenu = Gtk::manage(new Gtk::Menu());
menu_item->set_submenu(*submenu);
- size_t num_child_items = build_plugin_class_menu(
+ const size_t num_child_items = build_plugin_class_menu(
submenu, c, classes, children, ancestors);
_class_menus.emplace(sub_uri_str, MenuRecord(menu_item, submenu));
@@ -158,10 +158,10 @@ PluginMenu::add_plugin_to_menu(MenuRecord& menu,
LilvNode* ingen_Graph = lilv_new_uri(lworld, uris.ingen_Graph.c_str());
LilvNode* rdf_type = lilv_new_uri(lworld, uris.rdf_type.c_str());
- bool is_graph = lilv_world_ask(lworld,
- lilv_plugin_get_uri(p->lilv_plugin()),
- rdf_type,
- ingen_Graph);
+ const bool is_graph = lilv_world_ask(lworld,
+ lilv_plugin_get_uri(p->lilv_plugin()),
+ rdf_type,
+ ingen_Graph);
menu.menu->items().push_back(
Gtk::Menu_Helpers::MenuElem(
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 89b86184..7b5988b7 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -50,7 +50,6 @@
#include <gtkmm/menu.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menuitem.h>
-#include <gtkmm/menushell.h>
#include <gtkmm/object.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
@@ -265,7 +264,7 @@ Port::build_enum_menu()
auto block = std::dynamic_pointer_cast<BlockModel>(model()->parent());
Gtk::Menu* menu = Gtk::manage(new Gtk::Menu());
- PluginModel::ScalePoints points = block->plugin_model()->port_scale_points(
+ const PluginModel::ScalePoints points = block->plugin_model()->port_scale_points(
model()->index());
for (const auto& p : points) {
menu->items().push_back(Gtk::Menu_Helpers::MenuElem(p.second));
@@ -316,7 +315,7 @@ Port::build_uri_menu()
rdfs::classes(world, ranges, false);
// Get all objects in range
- rdfs::Objects values = rdfs::instances(world, ranges);
+ const rdfs::Objects values = rdfs::instances(world, ranges);
// Add a menu item for each such class
for (const auto& v : values) {
@@ -553,9 +552,10 @@ Port::on_selected(gboolean b)
GraphWindow* win = _app.window_factory()->parent_graph_window(block);
if (win && win->documentation_is_visible() && block->plugin_model()) {
- bool html = false;
#if USE_WEBKIT
- html = true;
+ const bool html = true;
+#else
+ const bool html = false;
#endif
const std::string& doc = block->plugin_model()->port_documentation(
pm->index(), html);
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index 96b0788a..95ba88dc 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -24,6 +24,7 @@
#include "ingen/Interface.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
+#include "ingen/URI.hpp"
#include "ingen/URIs.hpp"
#include "ingen/client/BlockModel.hpp"
#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep
@@ -37,6 +38,7 @@
#include <glibmm/signalproxy.h>
#include <gtkmm/builder.h>
#include <gtkmm/checkmenuitem.h>
+#include <gtkmm/menu.h>
#include <gtkmm/menuitem.h>
#include <gtkmm/separatormenuitem.h>
#include <sigc++/functors/mem_fun.h>
diff --git a/src/gui/PortMenu.hpp b/src/gui/PortMenu.hpp
index 71a5f48b..cf7f9c62 100644
--- a/src/gui/PortMenu.hpp
+++ b/src/gui/PortMenu.hpp
@@ -19,8 +19,6 @@
#include "ObjectMenu.hpp"
-#include <gtkmm/menu.h>
-
#include <memory>
namespace Glib {
@@ -29,6 +27,7 @@ template <class T> class RefPtr;
namespace Gtk {
class Builder;
+class Menu;
class MenuItem;
} // namespace Gtk
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 4ea1536d..958a73c9 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -54,6 +54,7 @@
#include <gtkmm/table.h>
#include <gtkmm/treeiter.h>
#include <gtkmm/widget.h>
+#include <gtkmm/window.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
#include <sigc++/signal.h>
@@ -382,9 +383,9 @@ PropertiesWindow::create_value_widget(const URI& key,
? world.uri_map().unmap_uri(value.get<int32_t>())
: "");
- LilvNode* pred = lilv_new_uri(lworld, key.c_str());
- URISet ranges = rdfs::range(world, pred, true);
- URIEntry* widget = manage(new URIEntry(_app, ranges, str ? str : ""));
+ LilvNode* pred = lilv_new_uri(lworld, key.c_str());
+ const URISet ranges = rdfs::range(world, pred, true);
+ URIEntry* widget = manage(new URIEntry(_app, ranges, str ? str : ""));
widget->signal_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
lilv_node_free(pred);
@@ -400,10 +401,10 @@ PropertiesWindow::create_value_widget(const URI& key,
if (type == _app->uris().atom_URI ||
type == _app->uris().rdfs_Class ||
is_class) {
- LilvNode* pred = lilv_new_uri(lworld, key.c_str());
- URISet ranges = rdfs::range(world, pred, true);
- const char* str = value.is_valid() ? value.ptr<const char>() : "";
- URIEntry* widget = manage(new URIEntry(_app, ranges, str));
+ LilvNode* pred = lilv_new_uri(lworld, key.c_str());
+ const URISet ranges = rdfs::range(world, pred, true);
+ const char* str = value.is_valid() ? value.ptr<const char>() : "";
+ URIEntry* widget = manage(new URIEntry(_app, ranges, str));
widget->signal_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
lilv_node_free(pred);
@@ -482,7 +483,7 @@ PropertiesWindow::remove_property(const URI& key, const Atom& value)
Atom
PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
{
- Forge& forge = _app->forge();
+ const Forge& forge = _app->forge();
if (type == forge.Int) {
auto* spin = dynamic_cast<Gtk::SpinButton*>(value_widget);
@@ -501,10 +502,13 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
}
} else if (type == forge.URI || type == forge.URID) {
auto* uri_entry = dynamic_cast<URIEntry*>(value_widget);
- if (uri_entry && URI::is_valid(uri_entry->get_text())) {
- return _app->forge().make_urid(URI(uri_entry->get_text()));
+ if (uri_entry) {
+ if (URI::is_valid(uri_entry->get_text())) {
+ return _app->forge().make_urid(URI(uri_entry->get_text()));
+ }
+
+ _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
}
- _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
} else if (type == forge.String) {
auto* entry = dynamic_cast<Gtk::Entry*>(value_widget);
if (entry) {
@@ -542,7 +546,7 @@ PropertiesWindow::active_key() const
return "";
}
- Glib::ustring prop_uri = (*iter)[_combo_columns.uri_col];
+ const Glib::ustring prop_uri = (*iter)[_combo_columns.uri_col];
return prop_uri;
}
diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp
index 60b6bda3..3210ceaa 100644
--- a/src/gui/PropertiesWindow.hpp
+++ b/src/gui/PropertiesWindow.hpp
@@ -27,7 +27,6 @@
#include <gtkmm/liststore.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treemodelcolumn.h>
-#include <gtkmm/window.h>
#include <sigc++/connection.h>
#include <map>
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp
index bba8c31f..64aa893b 100644
--- a/src/gui/RDFS.cpp
+++ b/src/gui/RDFS.cpp
@@ -77,7 +77,7 @@ closure(World& world, const LilvNode* pred, URISet& types, bool super)
LILV_FOREACH (nodes, m, matches) {
const LilvNode* klass_node = lilv_nodes_get(matches, m);
if (lilv_node_is_uri(klass_node)) {
- URI klass(lilv_node_as_uri(klass_node));
+ const URI klass{lilv_node_as_uri(klass_node)};
if (!types.count(klass)) {
++added;
klasses.insert(klass);
@@ -144,8 +144,8 @@ URISet
properties(World& world,
const std::shared_ptr<const client::ObjectModel>& model)
{
- URISet properties;
- URISet types = rdfs::types(world, model);
+ URISet properties;
+ const URISet types = rdfs::types(world, model);
LilvNode* rdf_type = lilv_new_uri(world.lilv_world(),
LILV_NS_RDF "type");
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index e2c1e98c..66d8e918 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -37,6 +37,7 @@
#include <gtkmm/button.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
+#include <gtkmm/window.h>
#include <sigc++/functors/mem_fun.h>
#include <memory>
diff --git a/src/gui/RenameWindow.hpp b/src/gui/RenameWindow.hpp
index 42db3ff6..9c97d234 100644
--- a/src/gui/RenameWindow.hpp
+++ b/src/gui/RenameWindow.hpp
@@ -19,8 +19,6 @@
#include "Window.hpp"
-#include <gtkmm/window.h>
-
#include <memory>
namespace Glib {
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 0e5f1b01..4cd382a0 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -25,6 +25,7 @@
#include "ingen/World.hpp"
#include "ingen/client/GraphModel.hpp"
#include "raul/Path.hpp"
+#include "raul/Semaphore.hpp"
#include <glibmm/ustring.h>
#include <sigc++/adaptors/bind.h>
@@ -74,7 +75,7 @@ void
ThreadedLoader::run()
{
while (_sem.wait() && !_exit_flag) {
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
while (!_events.empty()) {
_events.front()();
_events.pop_front();
@@ -89,7 +90,7 @@ ThreadedLoader::load_graph(bool merge,
const std::optional<raul::Symbol>& engine_symbol,
const std::optional<Properties>& engine_data)
{
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
Glib::ustring engine_base = "";
if (engine_parent) {
@@ -117,7 +118,7 @@ ThreadedLoader::load_graph_event(
const std::optional<raul::Symbol>& engine_symbol,
const std::optional<Properties>& engine_data)
{
- std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_app.world().rdf_mutex()};
_app.world().parser()->parse_file(_app.world(),
*_app.world().interface(),
@@ -132,7 +133,7 @@ ThreadedLoader::save_graph(
const std::shared_ptr<const client::GraphModel>& model,
const URI& uri)
{
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
_events.emplace_back(sigc::hide_return(
sigc::bind(sigc::mem_fun(this, &ThreadedLoader::save_graph_event),
@@ -149,7 +150,7 @@ ThreadedLoader::save_graph_event(
{
assert(uri.scheme() == "file");
if (_app.serialiser()) {
- std::lock_guard<std::mutex> lock(_app.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_app.world().rdf_mutex()};
if (uri.string().find(".ingen") != std::string::npos) {
_app.serialiser()->write_bundle(model, uri);
diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp
index d701e3a2..fa03a05b 100644
--- a/src/gui/URIEntry.cpp
+++ b/src/gui/URIEntry.cpp
@@ -20,14 +20,13 @@
#include "RDFS.hpp"
#include "ingen/World.hpp"
+#include "lilv/lilv.h"
#include <gdk/gdk.h>
-#include <glibmm/helperlist.h>
#include <gtkmm/button.h>
#include <gtkmm/menu.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menuitem.h>
-#include <gtkmm/menushell.h>
#include <gtkmm/object.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
@@ -66,7 +65,7 @@ URIEntry::build_value_menu()
LilvNode* rdfs_Datatype = lilv_new_uri(lworld, LILV_NS_RDFS "Datatype");
LilvNode* rdfs_subClassOf = lilv_new_uri(lworld, LILV_NS_RDFS "subClassOf");
- rdfs::Objects values = rdfs::instances(world, _types);
+ const rdfs::Objects values = rdfs::instances(world, _types);
for (const auto& v : values) {
const LilvNode* inst = lilv_new_uri(lworld, v.second.c_str());
diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp
index dc08dbde..b2d27e90 100644
--- a/src/gui/WidgetFactory.cpp
+++ b/src/gui/WidgetFactory.cpp
@@ -16,7 +16,6 @@
#include "WidgetFactory.hpp"
-#include "ingen/FilePath.hpp"
#include "ingen/runtime_paths.hpp"
#include <cstdlib>
diff --git a/src/gui/WidgetFactory.hpp b/src/gui/WidgetFactory.hpp
index 1c45fd6e..474071ec 100644
--- a/src/gui/WidgetFactory.hpp
+++ b/src/gui/WidgetFactory.hpp
@@ -38,13 +38,13 @@ public:
template<typename T>
static void get_widget(const Glib::ustring& name, T*& widget) {
- Glib::RefPtr<Gtk::Builder> xml = create(name);
+ const Glib::RefPtr<Gtk::Builder> xml = create(name);
xml->get_widget(name, widget);
}
template<typename T>
static void get_widget_derived(const Glib::ustring& name, T*& widget) {
- Glib::RefPtr<Gtk::Builder> xml = create(name);
+ const Glib::RefPtr<Gtk::Builder> xml = create(name);
xml->get_widget_derived(name, widget);
}
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 8928b664..010ef704 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -30,6 +30,7 @@
#include "ingen/client/BlockModel.hpp"
#include "ingen/client/GraphModel.hpp"
#include "ingen/client/ObjectModel.hpp"
+#include "raul/Path.hpp"
#include <gdkmm/window.h>
#include <glibmm/signalproxy.h>
diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp
index 4c33c514..8ddacb04 100644
--- a/src/gui/ingen_gui.cpp
+++ b/src/gui/ingen_gui.cpp
@@ -35,7 +35,7 @@ struct GUIModule : public Module {
using SigClientInterface = client::SigClientInterface;
void load(World& world) override {
- URI uri(world.conf().option("connect").ptr<char>());
+ const URI uri{world.conf().option("connect").ptr<char>()};
if (!world.interface()) {
world.set_interface(
world.new_interface(URI(uri), make_client(world)));
diff --git a/src/gui/meson.build b/src/gui/meson.build
index 67914cca..3b9a7bb6 100644
--- a/src/gui/meson.build
+++ b/src/gui/meson.build
@@ -7,35 +7,47 @@
gui_defines = platform_defines
-glibmm_dep = dependency('glibmm-2.4',
- version: '>= 2.14.0',
- include_type: 'system',
- required: get_option('gui'))
-
-gthread_dep = dependency('gthread-2.0',
- version: '>= 2.14.0',
- include_type: 'system',
- required: get_option('gui'))
-
-gtkmm_dep = dependency('gtkmm-2.4',
- version: '>= 2.14.0',
- include_type: 'system',
- required: get_option('gui'))
-
-ganv_dep = dependency('ganv-1',
- version: '>= 1.5.2',
- fallback: ['ganv', 'ganv_dep'],
- required: get_option('gui'))
-
-webkit_dep = dependency('webkit-1.0',
- version: '>= 1.4.0',
- include_type: 'system',
- required: false)
-
-build_gui = (glibmm_dep.found() and
- gthread_dep.found() and
- gtkmm_dep.found() and
- ganv_dep.found())
+glibmm_dep = dependency(
+ 'glibmm-2.4',
+ include_type: 'system',
+ required: get_option('gui'),
+ version: '>= 2.14.0',
+)
+
+gthread_dep = dependency(
+ 'gthread-2.0',
+ include_type: 'system',
+ required: get_option('gui'),
+ version: '>= 2.14.0',
+)
+
+gtkmm_dep = dependency(
+ 'gtkmm-2.4',
+ include_type: 'system',
+ required: get_option('gui'),
+ version: '>= 2.14.0',
+)
+
+ganv_dep = dependency(
+ 'ganv-1',
+ fallback: ['ganv', 'ganv_dep'],
+ required: get_option('gui'),
+ version: '>= 1.5.2',
+)
+
+webkit_dep = dependency(
+ 'webkit-1.0',
+ include_type: 'system',
+ required: false,
+ version: '>= 1.4.0',
+)
+
+build_gui = (
+ glibmm_dep.found()
+ and gthread_dep.found()
+ and gtkmm_dep.found()
+ and ganv_dep.found()
+)
if webkit_dep.found()
gui_defines += ['-DHAVE_WEBKIT=1']
@@ -149,15 +161,19 @@ if build_gui
config = configuration_data()
config.set('INGEN_VERSION', meson.project_version())
- configure_file(configuration: config,
- input: files('ingen_gui.ui.in'),
- output: 'ingen_gui.ui',
- install: true,
- install_dir: ingen_data_dir)
-
- configure_file(copy: true,
- input: files('ingen_style.rc'),
- output: '@PLAINNAME@',
- install: true,
- install_dir: ingen_data_dir)
+ configure_file(
+ configuration: config,
+ input: files('ingen_gui.ui.in'),
+ install: true,
+ install_dir: ingen_data_dir,
+ output: 'ingen_gui.ui',
+ )
+
+ configure_file(
+ copy: true,
+ input: files('ingen_style.rc'),
+ install: true,
+ install_dir: ingen_data_dir,
+ output: '@PLAINNAME@',
+ )
endif
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 8f1233e1..6917c9b7 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -17,7 +17,6 @@
#include "ingen/Atom.hpp"
#include "ingen/Configuration.hpp"
#include "ingen/EngineBase.hpp"
-#include "ingen/FilePath.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Message.hpp"
#include "ingen/Parser.hpp"
@@ -203,7 +202,7 @@ run(int argc, char** argv)
engine_interface->get(URI("ingen:/plugins"));
engine_interface->get(main_uri());
- std::lock_guard<std::mutex> lock(world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{world->rdf_mutex()};
world->parser()->parse_file(
*world, *engine_interface, graph, parent, symbol);
} else if (conf.option("server-load").is_valid()) {
diff --git a/src/meson.build b/src/meson.build
index 833a9db2..abe6193a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -21,7 +21,7 @@ sources = files(
'URIMap.cpp',
'URIs.cpp',
'World.cpp',
- 'runtime_paths.cpp'
+ 'runtime_paths.cpp',
)
if have_socket
@@ -42,14 +42,16 @@ ingen_deps = [
ingen_include_dirs = include_directories('../include', 'include')
libingen = shared_library(
- 'ingen' + library_suffix,
+ versioned_name,
sources,
cpp_args: cpp_suppressions + platform_defines,
+ darwin_versions: [major_version + '.0.0', meson.project_version()],
dependencies: ingen_deps,
gnu_symbol_visibility: 'hidden',
implicit_include_directories: false,
include_directories: ingen_include_dirs,
install: true,
+ soversion: soversion,
version: meson.project_version(),
)
diff --git a/src/server/.clang-tidy b/src/server/.clang-tidy
index b5c584cf..8bb1a979 100644
--- a/src/server/.clang-tidy
+++ b/src/server/.clang-tidy
@@ -7,6 +7,7 @@ Checks: >
-bugprone-branch-clone,
-bugprone-parent-virtual-call,
-bugprone-reserved-identifier,
+ -bugprone-suspicious-realloc-usage,
-bugprone-suspicious-string-compare,
-cert-dcl37-c,
-cert-dcl51-cpp,
diff --git a/src/server/ArcImpl.hpp b/src/server/ArcImpl.hpp
index 27d7eacb..b1565390 100644
--- a/src/server/ArcImpl.hpp
+++ b/src/server/ArcImpl.hpp
@@ -17,8 +17,6 @@
#ifndef INGEN_ENGINE_ARC_IMPL_HPP
#define INGEN_ENGINE_ARC_IMPL_HPP
-// IWYU pragma: no_include "raul/Path.hpp"
-
#include "BufferRef.hpp"
#include "ingen/Arc.hpp"
@@ -28,6 +26,8 @@
#include <cstdint>
+// IWYU pragma: no_include "raul/Path.hpp"
+
namespace raul {
class Path; // IWYU pragma: keep
} // namespace raul
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 5c9279d3..4c8dd1d7 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -149,7 +149,7 @@ BlockFactory::load_lv2_plugins()
using Types = std::vector<std::shared_ptr<LilvNode>>;
Types types;
for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) {
- const URI& uri(PortType(static_cast<PortType::ID>(t)).uri());
+ const URI uri{PortType(static_cast<PortType::ID>(t)).uri()};
types.push_back(std::shared_ptr<LilvNode>(
lilv_new_uri(_world.lilv_world(), uri.c_str()), lilv_node_free));
}
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp
index 3fa7a1c3..d4285832 100644
--- a/src/server/BlockImpl.cpp
+++ b/src/server/BlockImpl.cpp
@@ -25,6 +25,7 @@
#include "lv2/urid/urid.h"
#include "raul/Array.hpp"
+#include "raul/Maid.hpp"
#include "raul/Symbol.hpp"
#include <cassert>
@@ -200,7 +201,7 @@ BlockImpl::bypass(RunContext& ctx)
}
// Dumb bypass
- for (PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) {
+ for (const PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) {
for (uint32_t i = 0;; ++i) {
PortImpl* in = nth_port_by_type(i, true, t);
PortImpl* out = nth_port_by_type(i, false, t);
diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp
index 3f742bfa..ef76e9bf 100644
--- a/src/server/BlockImpl.hpp
+++ b/src/server/BlockImpl.hpp
@@ -23,7 +23,6 @@
#include "State.hpp"
#include "types.hpp"
-#include "ingen/Node.hpp"
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
#include "ingen/URI.hpp"
@@ -43,7 +42,10 @@ namespace raul {
class Symbol;
} // namespace raul
-namespace ingen::server {
+namespace ingen {
+class Node;
+
+namespace server {
class BufferFactory;
class Engine;
@@ -215,6 +217,7 @@ protected:
bool _enabled{true};
};
-} // namespace ingen::server
+} // namespace server
+} // namespace ingen
#endif // INGEN_ENGINE_BLOCKIMPL_HPP
diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp
index 1d5cc843..e7406dc6 100644
--- a/src/server/Broadcaster.cpp
+++ b/src/server/Broadcaster.cpp
@@ -29,7 +29,7 @@ namespace ingen::server {
Broadcaster::~Broadcaster()
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
_clients.clear();
_broadcastees.clear();
}
@@ -39,7 +39,7 @@ Broadcaster::~Broadcaster()
void
Broadcaster::register_client(const std::shared_ptr<Interface>& client)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
_clients.insert(client);
}
@@ -50,7 +50,7 @@ Broadcaster::register_client(const std::shared_ptr<Interface>& client)
bool
Broadcaster::unregister_client(const std::shared_ptr<Interface>& client)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
const size_t erased = _clients.erase(client);
_broadcastees.erase(client);
return (erased > 0);
@@ -71,7 +71,7 @@ Broadcaster::set_broadcast(const std::shared_ptr<Interface>& client,
void
Broadcaster::send_plugins(const BlockFactory::Plugins& plugins)
{
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
for (const auto& c : _clients) {
send_plugins_to(c.get(), plugins);
}
diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp
index e4034155..9bae44b1 100644
--- a/src/server/Broadcaster.hpp
+++ b/src/server/Broadcaster.hpp
@@ -97,7 +97,7 @@ public:
send_plugins_to(Interface*, const BlockFactory::Plugins& plugins);
void message(const Message& msg) override {
- std::lock_guard<std::mutex> lock(_clients_mutex);
+ const std::lock_guard<std::mutex> lock{_clients_mutex};
for (const auto& c : _clients) {
if (c != _ignore_client) {
c->message(msg);
diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp
index c96a0d01..c69f5b49 100644
--- a/src/server/ClientUpdate.cpp
+++ b/src/server/ClientUpdate.cpp
@@ -26,7 +26,6 @@
#include "ingen/Arc.hpp"
#include "ingen/Forge.hpp"
#include "ingen/Interface.hpp"
-#include "ingen/Node.hpp"
#include "ingen/URIs.hpp"
#include <boost/intrusive/slist.hpp>
diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp
index b453932b..08e558a8 100644
--- a/src/server/CompiledGraph.cpp
+++ b/src/server/CompiledGraph.cpp
@@ -26,7 +26,6 @@
#include "ingen/Configuration.hpp"
#include "ingen/Log.hpp"
#include "ingen/World.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include <boost/intrusive/slist.hpp>
@@ -76,11 +75,11 @@ CompiledGraph::CompiledGraph(GraphImpl* graph)
compile_graph(graph);
}
-raul::managed_ptr<CompiledGraph>
-CompiledGraph::compile(raul::Maid& maid, GraphImpl& graph)
+std::unique_ptr<CompiledGraph>
+CompiledGraph::compile(GraphImpl& graph)
{
try {
- return maid.make_managed<CompiledGraph>(&graph);
+ return std::unique_ptr<CompiledGraph>(new CompiledGraph(&graph));
} catch (const FeedbackException& e) {
Log& log = graph.engine().log();
if (e.node && e.root) {
@@ -161,7 +160,7 @@ CompiledGraph::compile_graph(GraphImpl* graph)
_master = Task::simplify(std::move(_master));
if (graph->engine().world().conf().option("trace").get<int32_t>()) {
- ColorContext ctx(stderr, ColorContext::Color::YELLOW);
+ const ColorContext ctx{stderr, ColorContext::Color::YELLOW};
dump(graph->path());
}
}
diff --git a/src/server/CompiledGraph.hpp b/src/server/CompiledGraph.hpp
index a5ba66c3..89aab289 100644
--- a/src/server/CompiledGraph.hpp
+++ b/src/server/CompiledGraph.hpp
@@ -19,7 +19,6 @@
#include "Task.hpp"
-#include "raul/Maid.hpp"
#include "raul/Noncopyable.hpp"
#include <cstddef>
@@ -39,17 +38,14 @@ class RunContext;
* execute the nodes in order and have nodes always executed before any of
* their dependencies.
*/
-class CompiledGraph : public raul::Maid::Disposable
- , public raul::Noncopyable
+class CompiledGraph : public raul::Noncopyable
{
public:
- static raul::managed_ptr<CompiledGraph> compile(raul::Maid& maid, GraphImpl& graph);
+ static std::unique_ptr<CompiledGraph> compile(GraphImpl& graph);
void run(RunContext& ctx);
private:
- friend class raul::Maid; ///< Allow make_managed to construct
-
CompiledGraph(GraphImpl* graph);
using BlockSet = std::set<BlockImpl*>;
@@ -72,10 +68,10 @@ private:
std::unique_ptr<Task> _master;
};
-inline raul::managed_ptr<CompiledGraph>
-compile(raul::Maid& maid, GraphImpl& graph)
+inline std::unique_ptr<CompiledGraph>
+compile(GraphImpl& graph)
{
- return CompiledGraph::compile(maid, graph);
+ return CompiledGraph::compile(graph);
}
} // namespace ingen::server
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 265333d4..e8dd3554 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -198,8 +198,9 @@ ControlBindings::port_value_changed(RunContext& ctx,
{
const ingen::URIs& uris = ctx.engine().world().uris();
if (!!key) {
- int16_t value = port_value_to_control(
- ctx, port, key.type, value_atom);
+ const int16_t value =
+ port_value_to_control(ctx, port, key.type, value_atom);
+
uint16_t size = 0;
uint8_t buf[4];
switch (key.type) {
@@ -390,7 +391,7 @@ ControlBindings::set_port_value(RunContext& ctx,
// TODO: Set port value property so it is saved
port->set_control_value(ctx, ctx.start(), val);
- URIs& uris = ctx.engine().world().uris();
+ const URIs& uris = ctx.engine().world().uris();
ctx.notify(uris.ingen_value, ctx.start(), port,
sizeof(float), _forge.Float, &val);
}
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index 9603fcef..c4c492b7 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -19,7 +19,6 @@
#include "BlockFactory.hpp"
#include "Broadcaster.hpp"
#include "BufferFactory.hpp"
-#include "BufferRef.hpp"
#include "ControlBindings.hpp"
#include "DirectDriver.hpp"
#include "Driver.hpp"
diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp
index d224d5b5..f0f19740 100644
--- a/src/server/Engine.hpp
+++ b/src/server/Engine.hpp
@@ -35,9 +35,12 @@
#include <random>
#include <vector>
+// IWYU pragma: no_include "RunContext.hpp"
+// IWYU pragma: no_include "raul/RingBuffer.hpp"
+
namespace raul {
class Maid;
-class RingBuffer;
+class RingBuffer; // IWYU pragma: keep
} // namespace raul
namespace ingen {
@@ -60,7 +63,7 @@ class GraphImpl;
class LV2Options;
class PostProcessor;
class PreProcessor;
-class RunContext;
+class RunContext; // IWYU pragma: keep
class SocketListener;
class Task;
class UndoStack;
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index fedc5df8..0d3c5234 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -30,6 +30,7 @@
#include "ingen/Forge.hpp"
#include "ingen/Properties.hpp"
+#include "ingen/URI.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "lv2/urid/urid.h"
@@ -41,7 +42,6 @@
#include <cstddef>
#include <map>
#include <memory>
-#include <type_traits>
#include <unordered_map>
namespace ingen::server {
@@ -309,13 +309,15 @@ GraphImpl::has_arc(const PortImpl* tail, const PortImpl* dst_port) const
return (i != _graph_arcs.end());
}
-void
-GraphImpl::set_compiled_graph(raul::managed_ptr<CompiledGraph>&& cg)
+std::unique_ptr<CompiledGraph>
+GraphImpl::swap_compiled_graph(std::unique_ptr<CompiledGraph> cg)
{
if (_compiled_graph && _compiled_graph != cg) {
_engine.reset_load();
}
- _compiled_graph = std::move(cg);
+
+ _compiled_graph.swap(cg);
+ return cg;
}
uint32_t
diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp
index 1976fd4d..c5f978fb 100644
--- a/src/server/GraphImpl.hpp
+++ b/src/server/GraphImpl.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2023 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -23,7 +23,6 @@
#include "server.h"
#include "types.hpp"
-#include "ingen/Node.hpp"
#include "lv2/urid/urid.h"
#include "raul/Maid.hpp"
@@ -34,6 +33,8 @@
#include <memory>
#include <utility>
+// IWYU pragma: no_include "CompiledGraph.hpp"
+
namespace raul {
class Symbol;
} // namespace raul
@@ -46,7 +47,7 @@ namespace ingen::server {
class ArcImpl;
class BufferFactory;
-class CompiledGraph;
+class CompiledGraph; // IWYU pragma: keep
class Engine;
class PortImpl;
class RunContext;
@@ -180,7 +181,8 @@ public:
bool has_arc(const PortImpl* tail, const PortImpl* dst_port) const;
/** Set a new compiled graph to run, and return the old one. */
- void set_compiled_graph(raul::managed_ptr<CompiledGraph>&& cg);
+ [[nodiscard]] std::unique_ptr<CompiledGraph>
+ swap_compiled_graph(std::unique_ptr<CompiledGraph> cg);
const raul::managed_ptr<Ports>& external_ports() { return _ports; }
@@ -199,7 +201,7 @@ public:
Engine& engine() { return _engine; }
private:
- using CompiledGraphPtr = raul::managed_ptr<CompiledGraph>;
+ using CompiledGraphPtr = std::unique_ptr<CompiledGraph>;
Engine& _engine;
uint32_t _poly_pre; ///< Pre-process thread only
diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp
index e6535ab2..b2f2bae7 100644
--- a/src/server/InternalPlugin.cpp
+++ b/src/server/InternalPlugin.cpp
@@ -25,6 +25,8 @@
#include "types.hpp"
#include "ingen/URIs.hpp"
+#include "lilv/lilv.h"
+#include "raul/Symbol.hpp"
#include <utility>
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index eafa0fa7..d991879e 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -40,6 +40,7 @@
#include "lv2/atom/forge.h"
#include "lv2/atom/util.h"
#include "raul/Path.hpp"
+#include "raul/Semaphore.hpp"
#include <jack/midiport.h>
#include <jack/transport.h>
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 6dac1eec..c5cd73dc 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -37,6 +37,7 @@
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
+#include "lilv/lilv.h"
#include "lv2/core/lv2.h"
#include "lv2/options/options.h"
#include "lv2/state/state.h"
@@ -349,7 +350,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
LILV_FOREACH (nodes, i, sizes) {
const LilvNode* d = lilv_nodes_get(sizes, i);
if (lilv_node_is_int(d)) {
- uint32_t size_val = lilv_node_as_int(d);
+ const uint32_t size_val = lilv_node_as_int(d);
port_buffer_size = std::max(port_buffer_size, size_val);
}
}
@@ -481,7 +482,7 @@ LV2Block::save_state(const FilePath& dir) const
World& world = _lv2_plugin->world();
LilvWorld* lworld = world.lilv_world();
- StatePtr state{
+ const StatePtr state{
lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
const_cast<LV2Block*>(this)->instance(0),
&world.uri_map().urid_map(),
@@ -521,7 +522,7 @@ LV2Block::duplicate(Engine& engine,
const SampleRate rate = engine.sample_rate();
// Get current state
- StatePtr state{
+ const StatePtr state{
lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
instance(0),
&engine.world().uri_map().urid_map(),
@@ -589,10 +590,10 @@ LV2_Worker_Status
LV2Block::work(uint32_t size, const void* data)
{
if (_worker_iface) {
- std::lock_guard<std::mutex> lock(_work_mutex);
+ const std::lock_guard<std::mutex> lock{_work_mutex};
- LV2_Handle inst = lilv_instance_get_handle(instance(0));
- LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data);
+ LV2_Handle inst = lilv_instance_get_handle(instance(0));
+ const LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data);
if (st) {
parent_graph()->engine().log().error(
"Error calling %1% work method\n", _path);
@@ -717,17 +718,17 @@ LV2Block::save_preset(const URI& uri,
const FilePath dirname = path.parent_path();
const FilePath basename = path.stem();
- StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
- instance(0),
- lmap,
- nullptr,
- nullptr,
- nullptr,
- path.c_str(),
- get_port_value,
- this,
- LV2_STATE_IS_NATIVE,
- nullptr)};
+ const StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(),
+ instance(0),
+ lmap,
+ nullptr,
+ nullptr,
+ nullptr,
+ path.c_str(),
+ get_port_value,
+ this,
+ LV2_STATE_IS_NATIVE,
+ nullptr)};
if (state) {
const auto l = props.find(_uris.rdfs_label);
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 25ae9294..1e88952e 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -23,6 +23,8 @@
#include "ingen/Log.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
+#include "lilv/lilv.h"
+#include "raul/Symbol.hpp"
#include <cstdlib>
#include <string>
@@ -73,7 +75,7 @@ LV2Plugin::symbol() const
}
while (working.length() > 0) {
- size_t last_slash = working.find_last_of('/');
+ const size_t last_slash = working.find_last_of('/');
const std::string symbol = working.substr(last_slash+1);
if ( (symbol[0] >= 'a' && symbol[0] <= 'z')
|| (symbol[0] >= 'A' && symbol[0] <= 'Z') ) {
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 307d9b73..c7b20f2b 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -24,6 +24,7 @@
#include "ThreadManager.hpp"
#include "ingen/Forge.hpp"
+#include "ingen/Node.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "lv2/atom/atom.h"
@@ -289,9 +290,9 @@ PortImpl::set_voice_value(const RunContext& ctx,
void
PortImpl::update_set_state(const RunContext& ctx, uint32_t v)
{
- Voice& voice = _voices->at(v);
- SetState& state = voice.set_state;
- BufferRef buf = voice.buffer;
+ Voice& voice = _voices->at(v);
+ SetState& state = voice.set_state;
+ const BufferRef buf = voice.buffer;
switch (state.state) {
case SetState::State::SET:
break;
@@ -458,10 +459,10 @@ PortImpl::monitor(RunContext& ctx, bool send_now)
return;
}
- Forge& forge = ctx.engine().world().forge();
- URIs& uris = ctx.engine().world().uris();
- LV2_URID key = 0;
- float val = 0.0f;
+ const Forge& forge = ctx.engine().world().forge();
+ const URIs& uris = ctx.engine().world().uris();
+ LV2_URID key = 0;
+ float val = 0.0f;
switch (_type.id()) {
case PortType::UNKNOWN:
break;
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index 07904cff..64c3322f 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -26,7 +26,6 @@
#include "types.hpp"
#include "ingen/Atom.hpp"
-#include "ingen/Node.hpp"
#include "ingen/URIs.hpp"
#include "lv2/urid/urid.h"
#include "raul/Array.hpp"
diff --git a/src/server/PreProcessContext.hpp b/src/server/PreProcessContext.hpp
index 79e8ca68..7c97af3c 100644
--- a/src/server/PreProcessContext.hpp
+++ b/src/server/PreProcessContext.hpp
@@ -20,8 +20,7 @@
#include "CompiledGraph.hpp"
#include "GraphImpl.hpp"
-#include "raul/Maid.hpp"
-
+#include <memory>
#include <unordered_set>
namespace ingen::server {
@@ -64,13 +63,9 @@ public:
* This may return null when an atomic bundle is deferring compilation, in
* which case the graph is flagged as dirty for later compilation.
*/
- raul::Maid::managed_ptr<CompiledGraph>
- maybe_compile(raul::Maid& maid, GraphImpl& graph)
+ [[nodiscard]] std::unique_ptr<CompiledGraph> maybe_compile(GraphImpl& graph)
{
- if (must_compile(graph)) {
- return compile(maid, graph);
- }
- return nullptr;
+ return must_compile(graph) ? compile(graph) : nullptr;
}
/** Return all graphs that require compilation after an atomic bundle. */
diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp
index 5d719761..f9d7ecb3 100644
--- a/src/server/PreProcessor.cpp
+++ b/src/server/PreProcessor.cpp
@@ -28,6 +28,7 @@
#include "ingen/AtomWriter.hpp"
#include "ingen/Configuration.hpp"
#include "ingen/World.hpp"
+#include "raul/Semaphore.hpp"
#include <cassert>
#include <cstdint>
@@ -55,7 +56,7 @@ PreProcessor::event(Event* const ev, Event::Mode mode)
{
// TODO: Probably possible to make this lock-free with CAS
ThreadManager::assert_not_thread(THREAD_IS_REAL_TIME);
- std::lock_guard<std::mutex> lock(_mutex);
+ const std::lock_guard<std::mutex> lock{_mutex};
assert(!ev->is_prepared());
assert(!ev->next());
@@ -140,7 +141,7 @@ PreProcessor::process(RunContext& ctx, PostProcessor& dest, size_t limit)
if (n_processed > 0) {
#ifndef NDEBUG
- Engine& engine = ctx.engine();
+ const Engine& engine = ctx.engine();
if (engine.world().conf().option("trace").get<int32_t>()) {
const uint64_t start = engine.cycle_start_time(ctx);
const uint64_t end = engine.current_time();
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index 2bac3140..95d68f57 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -160,9 +160,9 @@ void
RunContext::set_priority(int priority)
{
if (_thread) {
- pthread_t pthread = _thread->native_handle();
- const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER;
- sched_param sp{};
+ const pthread_t pthread = _thread->native_handle();
+ const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER;
+ sched_param sp{};
sp.sched_priority = (priority > 0) ? priority : 0;
if (pthread_setschedparam(pthread, policy, &sp)) {
_engine.log().error(
diff --git a/src/server/Task.hpp b/src/server/Task.hpp
index e64d888c..30941f28 100644
--- a/src/server/Task.hpp
+++ b/src/server/Task.hpp
@@ -44,7 +44,7 @@ public:
: _block(block)
, _mode(mode)
{
- assert(!(mode == Mode::SINGLE && !block));
+ assert(mode != Mode::SINGLE || block);
}
Task(const Task&) = delete;
diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp
index 395a04cd..abb9fe46 100644
--- a/src/server/UndoStack.cpp
+++ b/src/server/UndoStack.cpp
@@ -27,7 +27,6 @@
#include <ctime>
#include <iterator>
-#include <memory>
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -41,7 +40,7 @@ UndoStack::start_entry()
if (_depth == 0) {
time_t now = {};
time(&now);
- _stack.emplace_back(Entry(now));
+ _stack.emplace_back(now);
}
return ++_depth;
}
@@ -188,8 +187,8 @@ UndoStack::write_entry(Sratom* sratom,
strftime(time_str, sizeof(time_str), "%FT%T", gmtime(&entry.time));
// entry rdf:type ingen:UndoEntry
- SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time"));
- SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str));
+ SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time"));
+ const SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str));
serd_writer_write_statement(writer, SERD_ANON_CONT, nullptr, subject, &p, &o, nullptr, nullptr);
p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "events"));
@@ -245,8 +244,8 @@ UndoStack::save(FILE* stream, const char* name)
reinterpret_cast<SerdEndSink>(serd_writer_end_anon),
writer);
- SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name));
- SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries"));
+ const SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name));
+ const SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries"));
BlankIDs ids('u');
ListContext ctx(ids, 0, &s, &p);
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 5b4da498..cf252d37 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -24,6 +24,8 @@
#include "ingen/Node.hpp"
#include "lv2/core/lv2.h"
#include "lv2/worker/worker.h"
+#include "raul/RingBuffer.hpp"
+#include "raul/Semaphore.hpp"
#include <cstdlib>
#include <memory>
@@ -46,8 +48,8 @@ schedule(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- auto* block = static_cast<LV2Block*>(handle);
- Engine& engine = block->parent_graph()->engine();
+ auto* block = static_cast<LV2Block*>(handle);
+ const Engine& engine = block->parent_graph()->engine();
return engine.worker()->request(block, size, data);
}
@@ -57,8 +59,8 @@ schedule_sync(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- auto* block = static_cast<LV2Block*>(handle);
- Engine& engine = block->parent_graph()->engine();
+ auto* block = static_cast<LV2Block*>(handle);
+ const Engine& engine = block->parent_graph()->engine();
return engine.sync_worker()->request(block, size, data);
}
@@ -72,7 +74,7 @@ Worker::request(LV2Block* block,
return block->work(size, data);
}
- Engine& engine = block->parent_graph()->engine();
+ const Engine& engine = block->parent_graph()->engine();
if (_requests.write_space() < sizeof(MessageHeader) + size) {
engine.log().error("Work request ring overflow\n");
return LV2_WORKER_ERR_NO_SPACE;
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 44c734a8..e1854ef2 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -57,7 +57,7 @@ Connect::~Connect() = default;
bool
Connect::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
Node* tail = _engine.store()->get(_msg.tail);
if (!tail) {
@@ -132,7 +132,7 @@ Connect::pre_process(PreProcessContext& ctx)
head_block->providers().insert(tail_block);
if (ctx.must_compile(*_graph)) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) {
+ if (!(_compiled_graph = compile(*_graph))) {
head_block->providers().erase(tail_block);
tail_block->dependants().erase(head_block);
return Event::pre_process_done(Status::COMPILATION_FAILED);
@@ -165,7 +165,7 @@ Connect::execute(RunContext& ctx)
}
_head->connect_buffers();
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph));
}
}
}
@@ -173,7 +173,7 @@ Connect::execute(RunContext& ctx)
void
Connect::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
if (!_tail_remove.empty() || !_tail_add.empty()) {
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index a735b68c..4224f109 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -66,7 +66,7 @@ private:
const ingen::Connect _msg;
GraphImpl* _graph{nullptr};
InputPort* _head{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
std::shared_ptr<ArcImpl> _arc;
raul::managed_ptr<PortImpl::Voices> _voices;
Properties _tail_remove;
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index f6bcc62a..f6529da3 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -24,6 +24,7 @@
#include "PreProcessContext.hpp"
#include "ingen/Interface.hpp"
+#include "ingen/Node.hpp"
#include "ingen/Parser.hpp"
#include "ingen/Serialiser.hpp"
#include "ingen/Status.hpp"
@@ -57,7 +58,7 @@ Copy::~Copy() = default;
bool
Copy::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (uri_is_path(_msg.old_uri)) {
// Old URI is a path within the engine
@@ -136,7 +137,7 @@ Copy::engine_to_engine(PreProcessContext& ctx)
_engine.store()->add(_block);
// Compile graph with new block added for insertion in audio thread
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent);
+ _compiled_graph = ctx.maybe_compile(*_parent);
return Event::pre_process_done(Status::SUCCESS);
}
@@ -163,7 +164,7 @@ Copy::engine_to_filesystem(PreProcessContext&)
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()};
if (ends_with(_msg.new_uri, ".ingen") || ends_with(_msg.new_uri, ".ingen/")) {
_engine.world().serialiser()->write_bundle(graph, URI(_msg.new_uri));
@@ -184,7 +185,7 @@ Copy::filesystem_to_engine(PreProcessContext&)
return Event::pre_process_done(Status::INTERNAL_ERROR);
}
- std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex());
+ const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()};
// Old URI is a filesystem path and new URI is a path within the engine
const std::string src_path(_msg.old_uri.path());
@@ -207,14 +208,15 @@ void
Copy::execute(RunContext&)
{
if (_block && _compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
Copy::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp
index 8460140a..744a61c2 100644
--- a/src/server/events/Copy.hpp
+++ b/src/server/events/Copy.hpp
@@ -21,7 +21,6 @@
#include "types.hpp"
#include "ingen/Message.hpp"
-#include "raul/Maid.hpp"
#include <memory>
@@ -67,7 +66,7 @@ private:
std::shared_ptr<BlockImpl> _old_block{nullptr};
GraphImpl* _parent{nullptr};
BlockImpl* _block{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index 73834fcb..7f50411c 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -40,7 +40,6 @@
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
@@ -169,7 +168,7 @@ CreateBlock::pre_process(PreProcessContext& ctx)
/* Compile graph with new block added for insertion in audio thread
TODO: Since the block is not connected at this point, a full compilation
could be avoided and the block simply appended. */
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
+ _compiled_graph = ctx.maybe_compile(*_graph);
_update.put_block(_block);
@@ -180,14 +179,15 @@ void
CreateBlock::execute(RunContext&)
{
if (_status == Status::SUCCESS && _compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _graph->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
CreateBlock::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_update.send(*_engine.broadcaster());
}
diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp
index 2a7a60ab..e8a49ea0 100644
--- a/src/server/events/CreateBlock.hpp
+++ b/src/server/events/CreateBlock.hpp
@@ -21,7 +21,6 @@
#include "Event.hpp"
#include "types.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include <cstdint>
@@ -70,7 +69,7 @@ private:
ClientUpdate _update;
GraphImpl* _graph{nullptr};
BlockImpl* _block{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp
index bcc935bb..7a8a973d 100644
--- a/src/server/events/CreateGraph.cpp
+++ b/src/server/events/CreateGraph.cpp
@@ -35,7 +35,6 @@
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
#include "ingen/paths.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "raul/Symbol.hpp"
@@ -192,7 +191,7 @@ CreateGraph::pre_process(PreProcessContext& ctx)
if (_parent->enabled()) {
_graph->enable();
}
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent);
+ _compiled_graph = ctx.maybe_compile(*_parent);
}
_graph->activate(*_engine.buffer_factory());
@@ -219,7 +218,8 @@ CreateGraph::execute(RunContext& ctx)
if (_graph) {
if (_parent) {
if (_compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _parent->swap_compiled_graph(std::move(_compiled_graph));
}
} else {
_engine.set_root_graph(_graph);
@@ -235,7 +235,7 @@ CreateGraph::execute(RunContext& ctx)
void
CreateGraph::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_update.send(*_engine.broadcaster());
}
diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp
index 7fc005ad..b083ae8c 100644
--- a/src/server/events/CreateGraph.hpp
+++ b/src/server/events/CreateGraph.hpp
@@ -22,7 +22,6 @@
#include "types.hpp"
#include "ingen/Properties.hpp"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include <cstdint>
@@ -74,7 +73,7 @@ private:
ClientUpdate _update;
GraphImpl* _graph{nullptr};
GraphImpl* _parent{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
std::list<std::unique_ptr<Event>> _child_events;
};
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 7a01d0d9..937842a7 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -210,7 +210,7 @@ CreatePort::execute(RunContext& ctx)
void
CreatePort::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->put(path_to_uri(_path), _update);
}
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index b64c81c0..62653752 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -104,7 +104,7 @@ Delete::pre_process(PreProcessContext& ctx)
}
// Take a writer lock while we modify the store
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
_engine.store()->remove(iter, _removed_objects);
@@ -113,14 +113,14 @@ Delete::pre_process(PreProcessContext& ctx)
_disconnect_event =
std::make_unique<DisconnectAll>(_engine, parent, _block.get());
_disconnect_event->pre_process(ctx);
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
+ _compiled_graph = ctx.maybe_compile(*parent);
} else if (_port) {
parent->remove_port(*_port);
_disconnect_event =
std::make_unique<DisconnectAll>(_engine, parent, _port.get());
_disconnect_event->pre_process(ctx);
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *parent);
+ _compiled_graph = ctx.maybe_compile(*parent);
if (parent->enabled()) {
_ports_array = parent->build_ports_array(*_engine.maid());
assert(_ports_array->size() == parent->num_ports_non_rt());
@@ -182,14 +182,14 @@ Delete::execute(RunContext& ctx)
}
if (parent && _compiled_graph) {
- parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
Delete::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && (_block || _port)) {
if (_block) {
_block->deactivate();
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 840b8415..87cde2c7 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -17,7 +17,6 @@
#ifndef INGEN_EVENTS_DELETE_HPP
#define INGEN_EVENTS_DELETE_HPP
-#include "BlockImpl.hpp"
#include "ControlBindings.hpp"
#include "Event.hpp"
#include "GraphImpl.hpp"
@@ -41,6 +40,7 @@ class Interface;
namespace server {
+class BlockImpl;
class CompiledGraph;
class DuplexPort;
class Engine;
@@ -80,7 +80,7 @@ private:
std::shared_ptr<DuplexPort> _port; ///< Non-null iff a port
EnginePort* _engine_port{nullptr};
raul::managed_ptr<GraphImpl::Ports> _ports_array; ///< New (external) ports for Graph
- raul::managed_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order
+ std::unique_ptr<CompiledGraph> _compiled_graph; ///< Graph's new process order
std::unique_ptr<DisconnectAll> _disconnect_event;
Store::Objects _removed_objects;
IndexChanges _port_index_changes;
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 0b8cab39..11a0b0ff 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -45,7 +45,6 @@
#include "ingen/World.hpp"
#include "ingen/paths.hpp"
#include "lilv/lilv.h"
-#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include <algorithm>
@@ -213,7 +212,7 @@ Delta::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::FAILURE);
}
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
_object = is_graph_object
? static_cast<ingen::Resource*>(_engine.store()->get(uri_to_path(_subject)))
@@ -225,7 +224,7 @@ Delta::pre_process(PreProcessContext& ctx)
}
if (is_graph_object && !_object) {
- raul::Path path(uri_to_path(_subject));
+ const raul::Path path{uri_to_path(_subject)};
bool is_graph = false;
bool is_block = false;
@@ -397,7 +396,7 @@ Delta::pre_process(PreProcessContext& ctx)
op = SpecialType::ENABLE;
// FIXME: defer until all other data has been processed
if (value.get<int32_t>() && !_graph->enabled()) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_graph))) {
+ if (!(_compiled_graph = compile(*_graph))) {
_status = Status::COMPILATION_FAILED;
}
}
@@ -516,7 +515,7 @@ Delta::execute(RunContext& ctx)
if (_graph) {
if (value.get<int32_t>()) {
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _graph->swap_compiled_graph(std::move(_compiled_graph));
}
_graph->enable();
} else {
@@ -594,7 +593,7 @@ Delta::post_process()
_state.reset();
}
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (_create_event) {
_create_event->post_process();
diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp
index 35357a26..ed04f8c9 100644
--- a/src/server/events/Delta.hpp
+++ b/src/server/events/Delta.hpp
@@ -27,13 +27,13 @@
#include "ingen/Properties.hpp"
#include "ingen/Resource.hpp"
#include "ingen/URI.hpp"
-#include "raul/Maid.hpp"
#include <cstdint>
#include <memory>
#include <optional>
#include <vector>
+// IWYU pragma: no_include "CompiledGraph.hpp"
// IWYU pragma: no_include <algorithm>
namespace ingen {
@@ -45,7 +45,7 @@ struct SetProperty;
namespace server {
-class CompiledGraph;
+class CompiledGraph; // IWYU pragma: keep
class Engine;
class GraphImpl;
class PreProcessContext;
@@ -117,7 +117,7 @@ private:
ClientUpdate _update;
ingen::Resource* _object{nullptr};
GraphImpl* _graph{nullptr};
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
ControlBindings::Binding* _binding{nullptr};
StatePtr _state;
Resource::Graph _context;
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index ef0cbd0b..e0db262a 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -117,7 +117,7 @@ Disconnect::Impl::Impl(Engine& e,
bool
Disconnect::pre_process(PreProcessContext& ctx)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (_msg.tail.parent().parent() != _msg.head.parent().parent()
&& _msg.tail.parent() != _msg.head.parent().parent()
@@ -171,7 +171,7 @@ Disconnect::pre_process(PreProcessContext& ctx)
dynamic_cast<PortImpl*>(tail),
dynamic_cast<InputPort*>(head));
- _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_graph);
+ _compiled_graph = ctx.maybe_compile(*_graph);
return Event::pre_process_done(Status::SUCCESS);
}
@@ -208,7 +208,8 @@ Disconnect::execute(RunContext& ctx)
if (_status == Status::SUCCESS) {
if (_impl->execute(ctx, true)) {
if (_compiled_graph) {
- _graph->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph =
+ _graph->swap_compiled_graph(std::move(_compiled_graph));
}
} else {
_status = Status::NOT_FOUND;
@@ -219,7 +220,7 @@ Disconnect::execute(RunContext& ctx)
void
Disconnect::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp
index 71ad4204..ad3d07b0 100644
--- a/src/server/events/Disconnect.hpp
+++ b/src/server/events/Disconnect.hpp
@@ -83,7 +83,7 @@ private:
const ingen::Disconnect _msg;
GraphImpl* _graph{nullptr};
std::unique_ptr<Impl> _impl;
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
};
} // namespace events
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index 957c6a6f..5f0e9a5e 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -32,7 +32,6 @@
#include "ingen/Node.hpp"
#include "ingen/Status.hpp"
#include "ingen/Store.hpp"
-#include "raul/Maid.hpp"
#include <memory>
#include <mutex>
@@ -130,7 +129,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx)
}
if (!_deleting && ctx.must_compile(*_parent)) {
- if (!(_compiled_graph = compile(*_engine.maid(), *_parent))) {
+ if (!(_compiled_graph = compile(*_parent))) {
return Event::pre_process_done(Status::COMPILATION_FAILED);
}
}
@@ -149,14 +148,14 @@ DisconnectAll::execute(RunContext& ctx)
}
if (_compiled_graph) {
- _parent->set_compiled_graph(std::move(_compiled_graph));
+ _compiled_graph = _parent->swap_compiled_graph(std::move(_compiled_graph));
}
}
void
DisconnectAll::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp
index 70da5dd6..aeb180de 100644
--- a/src/server/events/DisconnectAll.hpp
+++ b/src/server/events/DisconnectAll.hpp
@@ -22,7 +22,6 @@
#include "types.hpp"
#include "ingen/Message.hpp"
-#include "raul/Maid.hpp"
#include <list>
#include <memory>
@@ -79,7 +78,7 @@ private:
BlockImpl* _block;
PortImpl* _port;
Impls _impls;
- raul::managed_ptr<CompiledGraph> _compiled_graph;
+ std::unique_ptr<CompiledGraph> _compiled_graph;
bool _deleting;
};
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index f4cbb49d..9efef123 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -50,7 +50,7 @@ Get::Get(Engine& engine,
bool
Get::pre_process(PreProcessContext&)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
const auto& uri = _msg.subject;
if (uri == "ingen:/plugins") {
@@ -96,7 +96,7 @@ Get::execute(RunContext&)
void
Get::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && _request_client) {
if (_msg.subject == "ingen:/plugins") {
_engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins);
diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp
index 97acdbbb..87bc1035 100644
--- a/src/server/events/Mark.cpp
+++ b/src/server/events/Mark.cpp
@@ -84,7 +84,7 @@ Mark::pre_process(PreProcessContext& ctx)
ctx.set_in_bundle(false);
if (!ctx.dirty_graphs().empty()) {
for (GraphImpl* g : ctx.dirty_graphs()) {
- auto cg = compile(*_engine.maid(), *g);
+ auto cg = compile(*g);
if (cg) {
_compiled_graphs.emplace(g, std::move(cg));
}
@@ -101,7 +101,7 @@ void
Mark::execute(RunContext&)
{
for (auto& g : _compiled_graphs) {
- g.first->set_compiled_graph(std::move(g.second));
+ g.second = g.first->swap_compiled_graph(std::move(g.second));
}
}
diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp
index ea130eda..eb99c5a9 100644
--- a/src/server/events/Mark.hpp
+++ b/src/server/events/Mark.hpp
@@ -20,13 +20,11 @@
#include "Event.hpp"
#include "types.hpp"
-// IWYU pragma: no_include "CompiledGraph.hpp"
-
-#include "raul/Maid.hpp"
-
#include <map>
#include <memory>
+// IWYU pragma: no_include "CompiledGraph.hpp"
+
namespace ingen {
class Interface;
@@ -75,8 +73,7 @@ public:
private:
enum class Type { BUNDLE_BEGIN, BUNDLE_END };
- using CompiledGraphs =
- std::map<GraphImpl*, raul::managed_ptr<CompiledGraph>>;
+ using CompiledGraphs = std::map<GraphImpl*, std::unique_ptr<CompiledGraph>>;
CompiledGraphs _compiled_graphs;
Type _type;
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index ea05d34c..3af0ce6c 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -46,7 +46,7 @@ Move::Move(Engine& engine,
bool
Move::pre_process(PreProcessContext&)
{
- std::lock_guard<Store::Mutex> lock(_engine.store()->mutex());
+ const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()};
if (!_msg.old_path.parent().is_parent_of(_msg.new_path)) {
return Event::pre_process_done(Status::PARENT_DIFFERS, _msg.new_path);
@@ -78,7 +78,7 @@ Move::execute(RunContext&)
void
Move::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS) {
_engine.broadcaster()->message(_msg);
}
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 8b599354..04da7338 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -54,7 +54,7 @@ SetPortValue::SetPortValue(Engine& engine,
bool
SetPortValue::pre_process(PreProcessContext&)
{
- ingen::URIs& uris = _engine.world().uris();
+ const ingen::URIs& uris = _engine.world().uris();
if (_port->is_output()) {
return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path());
}
@@ -92,8 +92,8 @@ SetPortValue::apply(RunContext& ctx)
return;
}
- ingen::URIs& uris = _engine.world().uris();
- Buffer* buf = _port->buffer(0).get();
+ const ingen::URIs& uris = _engine.world().uris();
+ Buffer* buf = _port->buffer(0).get();
if (_buffer) {
if (_port->user_buffer(ctx)) {
@@ -127,7 +127,7 @@ SetPortValue::apply(RunContext& ctx)
void
SetPortValue::post_process()
{
- Broadcaster::Transfer t(*_engine.broadcaster());
+ const Broadcaster::Transfer t{*_engine.broadcaster()};
if (respond() == Status::SUCCESS && !_activity) {
_engine.broadcaster()->set_property(
_port->uri(),
diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp
index fd4a8ced..db1794de 100644
--- a/src/server/ingen_engine.cpp
+++ b/src/server/ingen_engine.cpp
@@ -14,8 +14,6 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-// IWYU pragma: no_include "ingen/Atom.hpp"
-
#include "Engine.hpp"
#include "util.hpp"
@@ -24,6 +22,8 @@
#include <memory>
+// IWYU pragma: no_include "ingen/Atom.hpp"
+
namespace ingen {
struct EngineModule : public Module {
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 851a83fb..45a193c1 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -15,7 +15,6 @@
*/
#include "Buffer.hpp"
-#include "BufferRef.hpp"
#include "Driver.hpp"
#include "DuplexPort.hpp"
#include "Engine.hpp"
@@ -512,7 +511,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
nullptr,
true);
- Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf)));
+ const Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf)));
serd_node_free(&manifest_node);
const LV2Graph* graph = nullptr;
@@ -533,11 +532,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
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);
- LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize);
- LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int);
- int32_t block_length = 0;
- int32_t seq_size = 0;
+ const LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength);
+ const LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize);
+ const LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int);
+ int32_t block_length = 0;
+ int32_t seq_size = 0;
if (options) {
for (const LV2_Options_Option* o = options; o->key; ++o) {
if (o->key == bufsz_max && o->type == atom_Int) {
@@ -567,7 +566,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
plugin->engine = engine;
plugin->world->set_engine(engine);
- std::shared_ptr<Interface> interface = engine->interface();
+ const std::shared_ptr<Interface> interface = engine->interface();
plugin->world->set_interface(interface);
@@ -580,7 +579,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
engine->activate();
ThreadManager::single_threaded = true;
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
// Locate to time 0 to process initialization events
engine->locate(0, block_length);
@@ -602,7 +601,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
/* Register client after loading graph so the to-ui ring does not overflow.
Since we are not yet rolling, it won't be drained, causing a deadlock. */
- std::shared_ptr<Interface> client(&driver->writer(), NullDeleter<Interface>);
+ const std::shared_ptr<Interface> client{&driver->writer(), NullDeleter<Interface>};
interface->set_respondee(client);
engine->register_client(client);
@@ -703,9 +702,9 @@ ingen_save(LV2_Handle instance,
return LV2_STATE_ERR_NO_FEATURE;
}
- LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
- LV2_URID atom_Path = plugin->map->map(plugin->map->handle,
- LV2_ATOM__Path);
+ const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
+ const LV2_URID atom_Path = plugin->map->map(plugin->map->handle,
+ LV2_ATOM__Path);
char* real_path = make_path->path(make_path->handle, "main.ttl");
char* state_path = map_path->abstract_path(map_path->handle, real_path);
@@ -713,7 +712,7 @@ ingen_save(LV2_Handle instance,
auto root = plugin->world->store()->find(raul::Path("/"));
{
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
plugin->world->serialiser()->start_to_file(
root->second->path(), FilePath{real_path});
@@ -749,10 +748,10 @@ ingen_restore(LV2_Handle instance,
return LV2_STATE_ERR_NO_FEATURE;
}
- LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
- size_t size = 0;
- uint32_t type = 0;
- uint32_t valflags = 0;
+ const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file);
+ size_t size = 0;
+ uint32_t type = 0;
+ uint32_t valflags = 0;
// Get abstract path to graph file
const char* path = static_cast<const char*>(
@@ -784,7 +783,7 @@ ingen_restore(LV2_Handle instance,
#endif
// Load new graph
- std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex());
+ const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()};
plugin->world->parser()->parse_file(
*plugin->world, *plugin->world->interface(), real_path);
diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp
index 0199413f..6de5a40c 100644
--- a/src/server/ingen_portaudio.cpp
+++ b/src/server/ingen_portaudio.cpp
@@ -14,8 +14,6 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-// IWYU pragma: no_include "ingen/FilePath.hpp"
-
#include "Engine.hpp"
#include "PortAudioDriver.hpp"
@@ -25,6 +23,8 @@
#include <memory>
+// IWYU pragma: no_include "ingen/FilePath.hpp"
+
namespace ingen::server {
class Driver;
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 898bd55b..ec400075 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -14,7 +14,6 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index dd202451..94598fb7 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -19,7 +19,6 @@
#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
-#include "BufferRef.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
#include "OutputPort.hpp"
diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp
index ee97ac84..d8f1ddef 100644
--- a/src/server/internals/Time.cpp
+++ b/src/server/internals/Time.cpp
@@ -16,7 +16,6 @@
#include "internals/Time.hpp"
-#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
@@ -72,8 +71,8 @@ TimeNode::TimeNode(InternalPlugin* plugin,
void
TimeNode::run(RunContext& ctx)
{
- BufferRef buf = _notify_port->buffer(0);
- auto* seq = buf->get<LV2_Atom_Sequence>();
+ const BufferRef buf = _notify_port->buffer(0);
+ auto* const seq = buf->get<LV2_Atom_Sequence>();
// Initialise output to the empty sequence
seq->atom.type = _notify_port->bufs().uris().atom_Sequence;
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 519b6d9f..9b3b8f98 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -16,7 +16,6 @@
#include "internals/Trigger.hpp"
-#include "BlockImpl.hpp"
#include "Buffer.hpp"
#include "BufferFactory.hpp"
#include "BufferRef.hpp"
diff --git a/src/server/meson.build b/src/server/meson.build
index c2e5b761..c1fccf5e 100644
--- a/src/server/meson.build
+++ b/src/server/meson.build
@@ -6,6 +6,25 @@
##########
server_sources = files(
+ 'events/Connect.cpp',
+ 'events/Copy.cpp',
+ 'events/CreateBlock.cpp',
+ 'events/CreateGraph.cpp',
+ 'events/CreatePort.cpp',
+ 'events/Delete.cpp',
+ 'events/Delta.cpp',
+ 'events/Disconnect.cpp',
+ 'events/DisconnectAll.cpp',
+ 'events/Get.cpp',
+ 'events/Mark.cpp',
+ 'events/Move.cpp',
+ 'events/SetPortValue.cpp',
+ 'events/Undo.cpp',
+ 'internals/BlockDelay.cpp',
+ 'internals/Controller.cpp',
+ 'internals/Note.cpp',
+ 'internals/Time.cpp',
+ 'internals/Trigger.cpp',
'ArcImpl.cpp',
'BlockFactory.cpp',
'BlockImpl.cpp',
@@ -33,26 +52,7 @@ server_sources = files(
'Task.cpp',
'UndoStack.cpp',
'Worker.cpp',
- 'events/Connect.cpp',
- 'events/Copy.cpp',
- 'events/CreateBlock.cpp',
- 'events/CreateGraph.cpp',
- 'events/CreatePort.cpp',
- 'events/Delete.cpp',
- 'events/Delta.cpp',
- 'events/Disconnect.cpp',
- 'events/DisconnectAll.cpp',
- 'events/Get.cpp',
- 'events/Mark.cpp',
- 'events/Move.cpp',
- 'events/SetPortValue.cpp',
- 'events/Undo.cpp',
'ingen_engine.cpp',
- 'internals/BlockDelay.cpp',
- 'internals/Controller.cpp',
- 'internals/Note.cpp',
- 'internals/Time.cpp',
- 'internals/Trigger.cpp',
'mix.cpp',
)