summaryrefslogtreecommitdiffstats
path: root/src/server/events/Get.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/events/Get.cpp')
-rw-r--r--src/server/events/Get.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 219af6fe..9efef123 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -37,9 +37,7 @@
#include <memory>
#include <mutex>
-namespace ingen {
-namespace server {
-namespace events {
+namespace ingen::server::events {
Get::Get(Engine& engine,
const std::shared_ptr<Interface>& client,
@@ -47,22 +45,24 @@ Get::Get(Engine& engine,
const ingen::Get& msg)
: Event(engine, client, msg.seq, timestamp)
, _msg(msg)
- , _object(nullptr)
- , _plugin(nullptr)
{}
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") {
_plugins = _engine.block_factory()->plugins();
return Event::pre_process_done(Status::SUCCESS);
- } else if (uri == "ingen:/engine") {
+ }
+
+ if (uri == "ingen:/engine") {
return Event::pre_process_done(Status::SUCCESS);
- } else if (uri_is_path(uri)) {
+ }
+
+ if (uri_is_path(uri)) {
if ((_object = _engine.store()->get(uri_to_path(uri)))) {
const BlockImpl* block = nullptr;
const GraphImpl* graph = nullptr;
@@ -79,23 +79,24 @@ Get::pre_process(PreProcessContext&)
return Event::pre_process_done(Status::SUCCESS);
}
return Event::pre_process_done(Status::NOT_FOUND, uri);
- } else if ((_plugin = _engine.block_factory()->plugin(uri))) {
+ }
+
+ if ((_plugin = _engine.block_factory()->plugin(uri))) {
_response.put_plugin(_plugin);
return Event::pre_process_done(Status::SUCCESS);
- } else {
- return Event::pre_process_done(Status::NOT_FOUND, uri);
}
+
+ return Event::pre_process_done(Status::NOT_FOUND, uri);
}
void
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);
@@ -119,6 +120,4 @@ Get::post_process()
}
}
-} // namespace events
-} // namespace server
-} // namespace ingen
+} // namespace ingen::server::events