summaryrefslogtreecommitdiffstats
path: root/src/server/events/CreatePort.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-11 04:47:21 +0000
committerDavid Robillard <d@drobilla.net>2013-01-11 04:47:21 +0000
commit10e9a3a800a35916872abf9e354be4c554338e4e (patch)
treed6be3ce7993f5d8efd525629fd321b32a6341633 /src/server/events/CreatePort.cpp
parent684eaf6b58e41f6758b160b882a6313faf0cff18 (diff)
downloadingen-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/CreatePort.cpp')
-rw-r--r--src/server/events/CreatePort.cpp20
1 files changed, 11 insertions, 9 deletions
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);
}