diff options
author | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
commit | 10e9a3a800a35916872abf9e354be4c554338e4e (patch) | |
tree | d6be3ce7993f5d8efd525629fd321b32a6341633 /src/server/events | |
parent | 684eaf6b58e41f6758b160b882a6313faf0cff18 (diff) | |
download | ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.gz ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.bz2 ingen-10e9a3a800a35916872abf9e354be4c554338e4e.zip |
Use type safe enumerations.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4918 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r-- | src/server/events/Connect.cpp | 20 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 17 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 13 | ||||
-rw-r--r-- | src/server/events/CreatePort.cpp | 20 | ||||
-rw-r--r-- | src/server/events/Delete.cpp | 12 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 61 | ||||
-rw-r--r-- | src/server/events/Delta.hpp | 2 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 20 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 16 | ||||
-rw-r--r-- | src/server/events/Get.cpp | 20 | ||||
-rw-r--r-- | src/server/events/Move.cpp | 10 | ||||
-rw-r--r-- | src/server/events/SetPortValue.cpp | 16 |
12 files changed, 118 insertions, 109 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 0559ec39..16792a11 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -56,34 +56,34 @@ Connect::pre_process() Node* tail = _engine.store()->get(_tail_path); if (!tail) { - return Event::pre_process_done(NOT_FOUND, _tail_path); + return Event::pre_process_done(Status::NOT_FOUND, _tail_path); } Node* head = _engine.store()->get(_head_path); if (!head) { - return Event::pre_process_done(NOT_FOUND, _head_path); + return Event::pre_process_done(Status::NOT_FOUND, _head_path); } OutputPort* tail_output = dynamic_cast<OutputPort*>(tail); _head = dynamic_cast<InputPort*>(head); if (!tail_output || !_head) { - return Event::pre_process_done(BAD_REQUEST, _head_path); + return Event::pre_process_done(Status::BAD_REQUEST, _head_path); } BlockImpl* const tail_block = tail_output->parent_block(); BlockImpl* const head_block = _head->parent_block(); if (!tail_block || !head_block) { - return Event::pre_process_done(PARENT_NOT_FOUND, _head_path); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, _head_path); } if (tail_block->parent() != head_block->parent() && tail_block != head_block->parent() && tail_block->parent() != head_block) { - return Event::pre_process_done(PARENT_DIFFERS, _head_path); + return Event::pre_process_done(Status::PARENT_DIFFERS, _head_path); } if (!ArcImpl::can_connect(tail_output, _head)) { - return Event::pre_process_done(TYPE_MISMATCH, _head_path); + return Event::pre_process_done(Status::TYPE_MISMATCH, _head_path); } if (tail_block->parent_graph() != head_block->parent_graph()) { @@ -103,7 +103,7 @@ Connect::pre_process() } if (_graph->has_arc(tail_output, _head)) { - return Event::pre_process_done(EXISTS, _head_path); + return Event::pre_process_done(Status::EXISTS, _head_path); } _arc = SharedPtr<ArcImpl>(new ArcImpl(tail_output, _head)); @@ -136,13 +136,13 @@ Connect::pre_process() _compiled_graph = _graph->compile(); } - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void Connect::execute(ProcessContext& context) { - if (!_status) { + if (_status != Status::SUCCESS) { _head->add_arc(context, _arc.get()); _engine.maid()->dispose(_head->set_buffers(context, _buffers)); _head->connect_buffers(); @@ -154,7 +154,7 @@ void Connect::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->connect(_tail_path, _head_path); } } diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index b75dbf1e..65e24bfd 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -59,7 +59,7 @@ CreateBlock::pre_process() typedef Resource::Properties::const_iterator iterator; if (_path.is_root()) { - return Event::pre_process_done(BAD_URI, _path); + return Event::pre_process_done(Status::BAD_URI, _path); } std::string plugin_uri_str; @@ -67,22 +67,23 @@ CreateBlock::pre_process() if (t != _properties.end() && t->second.type() == uris.forge.URI) { plugin_uri_str = t->second.get_uri(); } else { - return Event::pre_process_done(BAD_REQUEST); + return Event::pre_process_done(Status::BAD_REQUEST); } if (_engine.store()->get(_path)) { - return Event::pre_process_done(EXISTS, _path); + return Event::pre_process_done(Status::EXISTS, _path); } _graph = dynamic_cast<GraphImpl*>(_engine.store()->get(_path.parent())); if (!_graph) { - return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, _path.parent()); } const Raul::URI plugin_uri(plugin_uri_str); PluginImpl* plugin = _engine.block_factory()->plugin(plugin_uri); if (!plugin) { - return Event::pre_process_done(PLUGIN_NOT_FOUND, Raul::URI(plugin_uri)); + return Event::pre_process_done(Status::PLUGIN_NOT_FOUND, + Raul::URI(plugin_uri)); } const iterator p = _properties.find(uris.ingen_polyphonic); @@ -96,7 +97,7 @@ CreateBlock::pre_process() polyphonic, _graph, _engine))) { - return Event::pre_process_done(CREATION_FAILED, _path); + return Event::pre_process_done(Status::CREATION_FAILED, _path); } _block->properties().insert(_properties.begin(), _properties.end()); @@ -122,7 +123,7 @@ CreateBlock::pre_process() _update.push_back(std::make_pair(port->uri(), pprops)); } - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void @@ -138,7 +139,7 @@ void CreateBlock::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { for (Update::const_iterator i = _update.begin(); i != _update.end(); ++i) { _engine.broadcaster()->put(i->first, i->second); } diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 23c6ef14..f2131246 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -48,12 +48,12 @@ bool CreateGraph::pre_process() { if (_path.is_root() || _engine.store()->get(_path)) { - return Event::pre_process_done(EXISTS, _path); + return Event::pre_process_done(Status::EXISTS, _path); } _parent = dynamic_cast<GraphImpl*>(_engine.store()->get(_path.parent())); if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, _path.parent()); } const Ingen::URIs& uris = _engine.world()->uris(); @@ -68,7 +68,7 @@ CreateGraph::pre_process() } if (int_poly < 1 || int_poly > 128) { - return Event::pre_process_done(INVALID_POLY, _path); + return Event::pre_process_done(Status::INVALID_POLY, _path); } if (int_poly == _parent->internal_poly()) { @@ -81,7 +81,8 @@ CreateGraph::pre_process() _graph->properties().insert(_properties.begin(), _properties.end()); _graph->add_property(uris.rdf_type, uris.ingen_Graph); _graph->add_property(uris.rdf_type, - Resource::Property(uris.ingen_Block, Resource::EXTERNAL)); + Resource::Property(uris.ingen_Block, + Resource::Graph::EXTERNAL)); _parent->add_block(*_graph); if (_parent->enabled()) { @@ -96,7 +97,7 @@ CreateGraph::pre_process() _update = _graph->properties(); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void @@ -111,7 +112,7 @@ void CreateGraph::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->put(Node::path_to_uri(_path), _update); } } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 03cc2bd8..818b0438 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -86,11 +86,11 @@ bool CreatePort::pre_process() { if (_port_type == PortType::UNKNOWN) { - return Event::pre_process_done(UNKNOWN_TYPE, _path); + return Event::pre_process_done(Status::UNKNOWN_TYPE, _path); } if (_path.is_root()) { - return Event::pre_process_done(BAD_URI, _path); + return Event::pre_process_done(Status::BAD_URI, _path); } if (_engine.store()->get(_path)) { @@ -99,11 +99,13 @@ CreatePort::pre_process() Node* parent = _engine.store()->get(_path.parent()); if (!parent) { - return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, + _path.parent()); } if (!(_graph = dynamic_cast<GraphImpl*>(parent))) { - return Event::pre_process_done(INVALID_PARENT_PATH, _path.parent()); + return Event::pre_process_done(Status::INVALID_PARENT_PATH, + _path.parent()); } const URIs& uris = _engine.world()->uris(); @@ -122,7 +124,7 @@ CreatePort::pre_process() _engine.world()->forge().make(old_n_ports))); } else if (index_i->second.type() != uris.forge.Int || index_i->second.get_int32() != old_n_ports) { - return Event::pre_process_done(BAD_INDEX, _path); + return Event::pre_process_done(Status::BAD_INDEX, _path); } const PropIter poly_i = _properties.find(uris.ingen_polyphonic); @@ -133,7 +135,7 @@ CreatePort::pre_process() if (!(_graph_port = _graph->create_port( *_engine.buffer_factory(), Raul::Symbol(_path.symbol()), _port_type, _buf_type, buf_size, _is_output, polyphonic))) { - return Event::pre_process_done(CREATION_FAILED, _path); + return Event::pre_process_done(Status::CREATION_FAILED, _path); } _graph_port->properties().insert(_properties.begin(), _properties.end()); @@ -158,13 +160,13 @@ CreatePort::pre_process() assert(_graph_port->index() == (uint32_t)old_n_ports); assert(_ports_array->size() == _graph->num_ports_non_rt()); assert(_graph_port->index() < _ports_array->size()); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void CreatePort::execute(ProcessContext& context) { - if (!_status) { + if (_status == Status::SUCCESS) { _old_ports_array = _graph->external_ports(); if (_old_ports_array) { for (uint32_t i = 0; i < _old_ports_array->size(); ++i) { @@ -185,7 +187,7 @@ void CreatePort::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->put(Node::path_to_uri(_path), _update); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 77dd9003..bcfb209a 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -61,7 +61,7 @@ bool Delete::pre_process() { if (_path.is_root() || _path == "/control_in" || _path == "/control_out") { - return Event::pre_process_done(NOT_DELETABLE, _path); + return Event::pre_process_done(Status::NOT_DELETABLE, _path); } _lock.acquire(); @@ -70,7 +70,7 @@ Delete::pre_process() Store::iterator iter = _engine.store()->find(_path); if (iter == _engine.store()->end()) { - return Event::pre_process_done(NOT_FOUND, _path); + return Event::pre_process_done(Status::NOT_FOUND, _path); } if (!(_block = PtrCast<BlockImpl>(iter->second))) { @@ -78,12 +78,12 @@ Delete::pre_process() } if (!_block && !_port) { - return Event::pre_process_done(NOT_DELETABLE, _path); + return Event::pre_process_done(Status::NOT_DELETABLE, _path); } GraphImpl* parent = _block ? _block->parent_graph() : _port->parent_graph(); if (!parent) { - return Event::pre_process_done(INTERNAL_ERROR, _path); + return Event::pre_process_done(Status::INTERNAL_ERROR, _path); } _engine.store()->remove(iter, _removed_objects); @@ -112,7 +112,7 @@ Delete::pre_process() } } - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void @@ -145,7 +145,7 @@ Delete::post_process() _removed_bindings.reset(); Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond() && (_block || _port)) { + if (respond() == Status::SUCCESS && (_block || _port)) { if (_block) { _block->deactivate(); } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index c7a2fb10..0f854096 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -64,7 +64,7 @@ Delta::Delta(Engine& engine, , _context(context) , _create(create) { - if (context != Resource::DEFAULT) { + if (context != Resource::Graph::DEFAULT) { for (Properties::iterator i = _properties.begin(); i != _properties.end(); ++i) { @@ -115,7 +115,7 @@ Delta::pre_process() : static_cast<Ingen::Resource*>(_engine.block_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { - return Event::pre_process_done(NOT_FOUND, _subject); + return Event::pre_process_done(Status::NOT_FOUND, _subject); } const Ingen::URIs& uris = _engine.world()->uris(); @@ -141,7 +141,7 @@ Delta::pre_process() // Grab the object for applying properties, if the create-event succeeded _object = _engine.store()->get(path); } else { - return Event::pre_process_done(BAD_OBJECT_TYPE, _subject); + return Event::pre_process_done(Status::BAD_OBJECT_TYPE, _subject); } } @@ -163,7 +163,7 @@ Delta::pre_process() for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p) { const Raul::URI& key = p->first; const Resource::Property& value = p->second; - SpecialType op = NONE; + SpecialType op = SpecialType::NONE; if (obj) { Resource& resource = *obj; if (value != uris.wildcard) { @@ -175,9 +175,9 @@ Delta::pre_process() if (port) { if (key == uris.ingen_broadcast) { if (value.type() == uris.forge.Bool) { - op = ENABLE_BROADCAST; + op = SpecialType::ENABLE_BROADCAST; } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } else if (key == uris.ingen_value) { SetPortValue* ev = new SetPortValue( @@ -189,46 +189,46 @@ Delta::pre_process() if (value == uris.wildcard) { _engine.control_bindings()->learn(port); } else if (value.type() == uris.atom_Blank) { - op = CONTROL_BINDING; + op = SpecialType::CONTROL_BINDING; } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } else { - _status = BAD_OBJECT_TYPE; + _status = Status::BAD_OBJECT_TYPE; } } } else if ((block = dynamic_cast<BlockImpl*>(_object))) { if (key == uris.ingen_controlBinding && value == uris.wildcard) { - op = CONTROL_BINDING; // Internal block learn + op = SpecialType::CONTROL_BINDING; // Internal block learn } } else if ((_graph = dynamic_cast<GraphImpl*>(_object))) { if (key == uris.ingen_enabled) { if (value.type() == uris.forge.Bool) { - op = ENABLE; + op = SpecialType::ENABLE; // FIXME: defer this until all other metadata has been processed if (value.get_bool() && !_graph->enabled()) _compiled_graph = _graph->compile(); } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } else if (key == uris.ingen_polyphony) { if (value.type() == uris.forge.Int) { if (value.get_int32() < 1 || value.get_int32() > 128) { - _status = INVALID_POLY; + _status = Status::INVALID_POLY; } else { - op = POLYPHONY; + op = SpecialType::POLYPHONY; _graph->prepare_internal_poly( *_engine.buffer_factory(), value.get_int32()); } } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } } else if (key == uris.ingen_polyphonic) { GraphImpl* parent = dynamic_cast<GraphImpl*>(obj->parent()); if (parent) { if (value.type() == uris.forge.Bool) { - op = POLYPHONIC; + op = SpecialType::POLYPHONIC; obj->set_property(key, value, value.context()); BlockImpl* block = dynamic_cast<BlockImpl*>(obj); if (block) @@ -239,29 +239,30 @@ Delta::pre_process() obj->prepare_poly(*_engine.buffer_factory(), 1); } } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } else { - _status = BAD_OBJECT_TYPE; + _status = Status::BAD_OBJECT_TYPE; } } } - if (_status != NOT_PREPARED) { + if (_status != Status::NOT_PREPARED) { break; } _types.push_back(op); } - return Event::pre_process_done(_status == NOT_PREPARED ? SUCCESS : _status, - _subject); + return Event::pre_process_done( + _status == Status::NOT_PREPARED ? Status::SUCCESS : _status, + _subject); } void Delta::execute(ProcessContext& context) { - if (_status) { + if (_status != Status::SUCCESS) { return; } @@ -286,12 +287,12 @@ Delta::execute(ProcessContext& context) const Raul::URI& key = p->first; const Raul::Atom& value = p->second; switch (*t) { - case ENABLE_BROADCAST: + case SpecialType::ENABLE_BROADCAST: if (port) { port->broadcast(value.get_bool()); } break; - case ENABLE: + case SpecialType::ENABLE: if (value.get_bool()) { if (_compiled_graph) { _graph->set_compiled_graph(_compiled_graph); @@ -301,7 +302,7 @@ Delta::execute(ProcessContext& context) _graph->disable(context); } break; - case POLYPHONIC: { + case SpecialType::POLYPHONIC: { GraphImpl* parent = reinterpret_cast<GraphImpl*>(object->parent()); if (value.get_bool()) { object->apply_poly( @@ -310,15 +311,15 @@ Delta::execute(ProcessContext& context) object->apply_poly(context, *_engine.maid(), 1); } } break; - case POLYPHONY: + case SpecialType::POLYPHONY: if (!_graph->apply_internal_poly(context, *_engine.buffer_factory(), *_engine.maid(), value.get_int32())) { - _status = INTERNAL_ERROR; + _status = Status::INTERNAL_ERROR; } break; - case CONTROL_BINDING: + case SpecialType::CONTROL_BINDING: if (port) { _engine.control_bindings()->port_binding_changed(context, port, value); } else if (block) { @@ -327,7 +328,7 @@ Delta::execute(ProcessContext& context) } } break; - case NONE: + case SpecialType::NONE: if (port) { if (key == uris.lv2_minimum) { port->set_minimum(value); @@ -348,7 +349,7 @@ Delta::post_process() for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) (*i)->post_process(); - if (!_status) { + if (_status == Status::SUCCESS) { if (_create_event) { _create_event->post_process(); } else { diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index c3a28fbb..34319591 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -86,7 +86,7 @@ public: void post_process(); private: - enum SpecialType { + enum class SpecialType { NONE, ENABLE, ENABLE_BROADCAST, diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 829500f5..4a961d9e 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -117,17 +117,17 @@ Disconnect::pre_process() if (_tail_path.parent().parent() != _head_path.parent().parent() && _tail_path.parent() != _head_path.parent().parent() && _tail_path.parent().parent() != _head_path.parent()) { - return Event::pre_process_done(PARENT_DIFFERS, _head_path); + return Event::pre_process_done(Status::PARENT_DIFFERS, _head_path); } PortImpl* tail = dynamic_cast<PortImpl*>(_engine.store()->get(_tail_path)); if (!tail) { - return Event::pre_process_done(PORT_NOT_FOUND, _tail_path); + return Event::pre_process_done(Status::PORT_NOT_FOUND, _tail_path); } PortImpl* head = dynamic_cast<PortImpl*>(_engine.store()->get(_head_path)); if (!head) { - return Event::pre_process_done(PORT_NOT_FOUND, _head_path); + return Event::pre_process_done(Status::PORT_NOT_FOUND, _head_path); } BlockImpl* const src_block = tail->parent_block(); @@ -150,13 +150,13 @@ Disconnect::pre_process() } if (!_graph) { - return Event::pre_process_done(INTERNAL_ERROR, _head_path); + return Event::pre_process_done(Status::INTERNAL_ERROR, _head_path); } else if (!_graph->has_arc(tail, head)) { - return Event::pre_process_done(NOT_FOUND, _head_path); + return Event::pre_process_done(Status::NOT_FOUND, _head_path); } if (src_block == NULL || dst_block == NULL) { - return Event::pre_process_done(PARENT_NOT_FOUND, _head_path); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, _head_path); } _impl = new Impl(_engine, @@ -167,7 +167,7 @@ Disconnect::pre_process() if (_graph->enabled()) _compiled_graph = _graph->compile(); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } bool @@ -198,9 +198,9 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers) void Disconnect::execute(ProcessContext& context) { - if (_status == SUCCESS) { + if (_status == Status::SUCCESS) { if (!_impl->execute(context, true)) { - _status = NOT_FOUND; + _status = Status::NOT_FOUND; return; } @@ -212,7 +212,7 @@ void Disconnect::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->disconnect(_tail_path, _head_path); } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index c2475b45..a6022410 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -89,18 +89,20 @@ DisconnectAll::pre_process() _parent = dynamic_cast<GraphImpl*>(_engine.store()->get(_parent_path)); if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND, _parent_path); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, + _parent_path); } NodeImpl* const object = dynamic_cast<NodeImpl*>( _engine.store()->get(_path)); if (!object) { - return Event::pre_process_done(NOT_FOUND, _path); + return Event::pre_process_done(Status::NOT_FOUND, _path); } if (object->parent_graph() != _parent && object->parent()->parent_graph() != _parent) { - return Event::pre_process_done(INVALID_PARENT_PATH, _parent_path); + return Event::pre_process_done(Status::INVALID_PARENT_PATH, + _parent_path); } // Only one of these will succeed @@ -108,7 +110,7 @@ DisconnectAll::pre_process() _port = dynamic_cast<PortImpl*>(object); if (!_block && !_port) { - return Event::pre_process_done(INTERNAL_ERROR, _path); + return Event::pre_process_done(Status::INTERNAL_ERROR, _path); } } @@ -141,13 +143,13 @@ DisconnectAll::pre_process() if (!_deleting && _parent->enabled()) _compiled_graph = _parent->compile(); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void DisconnectAll::execute(ProcessContext& context) { - if (_status == SUCCESS) { + if (_status == Status::SUCCESS) { for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) { (*i)->execute(context, !_deleting || ((*i)->head()->parent_block() != _block)); @@ -161,7 +163,7 @@ void DisconnectAll::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->disconnect_all(_parent_path, _path); } } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 93af8bf2..67b68de9 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -57,15 +57,17 @@ Get::pre_process() if (_uri == "ingen:/plugins") { _plugins = _engine.block_factory()->plugins(); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } else if (_uri == "ingen:/engine") { - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } else if (Node::uri_is_path(_uri)) { _object = _engine.store()->get(Node::uri_to_path(_uri)); - return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND, _uri); + return Event::pre_process_done( + _object ? Status::SUCCESS : Status::NOT_FOUND, _uri); } else { _plugin = _engine.block_factory()->plugin(_uri); - return Event::pre_process_done(_plugin ? SUCCESS : NOT_FOUND, _uri); + return Event::pre_process_done( + _plugin ? Status::SUCCESS : Status::NOT_FOUND, _uri); } } @@ -101,12 +103,12 @@ static void send_graph(Interface* client, const GraphImpl* graph) { client->put(graph->uri(), - graph->properties(Resource::INTERNAL), - Resource::INTERNAL); + graph->properties(Resource::Graph::INTERNAL), + Resource::Graph::INTERNAL); client->put(graph->uri(), - graph->properties(Resource::EXTERNAL), - Resource::EXTERNAL); + graph->properties(Resource::Graph::EXTERNAL), + Resource::Graph::EXTERNAL); // Send blocks for (GraphImpl::Blocks::const_iterator j = graph->blocks().begin(); @@ -130,7 +132,7 @@ void Get::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond() && _request_client) { + if (respond() == Status::SUCCESS && _request_client) { if (_uri == "ingen:/plugins") { _engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins); } else if (_uri == "ingen:/engine") { diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 08eea56a..700d5814 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -53,16 +53,16 @@ Move::pre_process() Glib::RWLock::WriterLock lock(_engine.store()->lock()); if (!_old_path.parent().is_parent_of(_new_path)) { - return Event::pre_process_done(PARENT_DIFFERS, _new_path); + return Event::pre_process_done(Status::PARENT_DIFFERS, _new_path); } const Store::iterator i = _engine.store()->find(_old_path); if (i == _engine.store()->end()) { - return Event::pre_process_done(NOT_FOUND, _old_path); + return Event::pre_process_done(Status::NOT_FOUND, _old_path); } if (_engine.store()->find(_new_path) != _engine.store()->end()) { - return Event::pre_process_done(EXISTS, _new_path); + return Event::pre_process_done(Status::EXISTS, _new_path); } EnginePort* eport = _engine.driver()->get_port(_old_path); @@ -72,7 +72,7 @@ Move::pre_process() _engine.store()->rename(i, _new_path); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void @@ -84,7 +84,7 @@ void Move::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->move(_old_path, _new_path); } } diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index b3481861..f2399d8e 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -54,7 +54,7 @@ bool SetPortValue::pre_process() { if (_port->is_output()) { - return Event::pre_process_done(DIRECTION_MISMATCH, _port->path()); + return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path()); } // Set value metadata (does not affect buffers) @@ -63,7 +63,7 @@ SetPortValue::pre_process() _binding = _engine.control_bindings()->port_binding(_port); - return Event::pre_process_done(SUCCESS); + return Event::pre_process_done(Status::SUCCESS); } void @@ -71,7 +71,7 @@ SetPortValue::execute(ProcessContext& context) { assert(_time >= context.start() && _time <= context.end()); - if (_port->parent_block()->context() == Context::MESSAGE) + if (_port->parent_block()->context() == Context::ID::MESSAGE) return; apply(context); @@ -81,7 +81,7 @@ SetPortValue::execute(ProcessContext& context) void SetPortValue::apply(Context& context) { - if (_status) { + if (_status != Status::SUCCESS) { return; } @@ -92,7 +92,7 @@ SetPortValue::apply(Context& context) if (_value.type() == uris.forge.Float) { _port->set_control_value(context, _time, _value.get_float()); } else { - _status = TYPE_MISMATCH; + _status = Status::TYPE_MISMATCH; } } else if (buf->type() == uris.atom_Sequence) { buf->prepare_write(context); // FIXME: incorrect @@ -102,12 +102,12 @@ SetPortValue::apply(Context& context) (const uint8_t*)_value.get_body())) { _port->raise_set_by_user_flag(); } else { - _status = NO_SPACE; + _status = Status::NO_SPACE; } } else if (buf->type() == uris.atom_URID) { ((LV2_Atom_URID*)buf->atom())->body = _value.get_int32(); } else { - _status = BAD_VALUE_TYPE; + _status = Status::BAD_VALUE_TYPE; } } @@ -115,7 +115,7 @@ void SetPortValue::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - if (!respond()) { + if (respond() == Status::SUCCESS) { _engine.broadcaster()->set_property( _port->uri(), _engine.world()->uris().ingen_value, |