diff options
Diffstat (limited to 'src/server/events')
-rw-r--r-- | src/server/events/CreateBlock.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 38 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 32 | ||||
-rw-r--r-- | src/server/events/Get.cpp | 10 |
4 files changed, 39 insertions, 45 deletions
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 65e24bfd..90a76c1d 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -140,8 +140,8 @@ CreateBlock::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); if (respond() == Status::SUCCESS) { - for (Update::const_iterator i = _update.begin(); i != _update.end(); ++i) { - _engine.broadcaster()->put(i->first, i->second); + for (const auto& u : _update) { + _engine.broadcaster()->put(u.first, u.second); } } } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 0f854096..352aa56c 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -65,10 +65,8 @@ Delta::Delta(Engine& engine, , _create(create) { if (context != Resource::Graph::DEFAULT) { - for (Properties::iterator i = _properties.begin(); - i != _properties.end(); - ++i) { - i->second.set_context(context); + for (auto& p : _properties) { + p.second.set_context(context); } } @@ -94,8 +92,8 @@ Delta::Delta(Engine& engine, Delta::~Delta() { - for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) - delete *i; + for (auto& s : _set_events) + delete s; delete _create_event; } @@ -149,9 +147,9 @@ Delta::pre_process() NodeImpl* obj = dynamic_cast<NodeImpl*>(_object); - for (Properties::const_iterator p = _remove.begin(); p != _remove.end(); ++p) { - const Raul::URI& key = p->first; - const Raul::Atom& value = p->second; + for (const auto& r : _remove) { + const Raul::URI& key = r.first; + const Raul::Atom& value = r.second; if (key == uris.ingen_controlBinding && value == uris.wildcard) { PortImpl* port = dynamic_cast<PortImpl*>(_object); if (port) @@ -160,9 +158,9 @@ Delta::pre_process() _object->remove_property(key, value); } - for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p) { - const Raul::URI& key = p->first; - const Resource::Property& value = p->second; + for (const auto& p : _properties) { + const Raul::URI& key = p.first; + const Resource::Property& value = p.second; SpecialType op = SpecialType::NONE; if (obj) { Resource& resource = *obj; @@ -273,9 +271,9 @@ Delta::execute(ProcessContext& context) _create_event->execute(context); } - for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) { - (*i)->set_time(_time); - (*i)->execute(context); + for (auto& s : _set_events) { + s->set_time(_time); + s->execute(context); } NodeImpl* const object = dynamic_cast<NodeImpl*>(_object); @@ -283,9 +281,9 @@ Delta::execute(ProcessContext& context) PortImpl* const port = dynamic_cast<PortImpl*>(_object); std::vector<SpecialType>::const_iterator t = _types.begin(); - for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p, ++t) { - const Raul::URI& key = p->first; - const Raul::Atom& value = p->second; + for (const auto& p : _properties) { + const Raul::URI& key = p.first; + const Raul::Atom& value = p.second; switch (*t) { case SpecialType::ENABLE_BROADCAST: if (port) { @@ -346,8 +344,8 @@ Delta::post_process() { Broadcaster::Transfer t(*_engine.broadcaster()); - for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) - (*i)->post_process(); + for (auto& s : _set_events) + s->post_process(); if (_status == Status::SUCCESS) { if (_create_event) { diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index a6022410..a3df4e77 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -75,8 +75,8 @@ DisconnectAll::DisconnectAll(Engine& engine, DisconnectAll::~DisconnectAll() { - for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) - delete (*i); + for (auto& i : _impls) + delete i; } bool @@ -116,28 +116,26 @@ DisconnectAll::pre_process() // Find set of arcs to remove std::set<ArcImpl*> to_remove; - for (Node::Arcs::const_iterator i = _parent->arcs().begin(); - i != _parent->arcs().end(); ++i) { - ArcImpl* const c = (ArcImpl*)i->second.get(); + for (const auto& a : _parent->arcs()) { + ArcImpl* const arc = (ArcImpl*)a.second.get(); if (_block) { - if (c->tail()->parent_block() == _block - || c->head()->parent_block() == _block) { - to_remove.insert(c); + if (arc->tail()->parent_block() == _block + || arc->head()->parent_block() == _block) { + to_remove.insert(arc); } } else if (_port) { - if (c->tail() == _port || c->head() == _port) { - to_remove.insert(c); + if (arc->tail() == _port || arc->head() == _port) { + to_remove.insert(arc); } } } // Create disconnect events (which erases from _parent->arcs()) - for (std::set<ArcImpl*>::const_iterator i = to_remove.begin(); - i != to_remove.end(); ++i) { + for (const auto& a : to_remove) { _impls.push_back(new Disconnect::Impl( _engine, _parent, - dynamic_cast<OutputPort*>((*i)->tail()), - dynamic_cast<InputPort*>((*i)->head()))); + dynamic_cast<OutputPort*>(a->tail()), + dynamic_cast<InputPort*>(a->head()))); } if (!_deleting && _parent->enabled()) @@ -150,9 +148,9 @@ void DisconnectAll::execute(ProcessContext& context) { if (_status == Status::SUCCESS) { - for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) { - (*i)->execute(context, - !_deleting || ((*i)->head()->parent_block() != _block)); + for (auto& i : _impls) { + i->execute(context, + !_deleting || (i->head()->parent_block() != _block)); } } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 67b68de9..f16654f7 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -111,9 +111,8 @@ send_graph(Interface* client, const GraphImpl* graph) Resource::Graph::EXTERNAL); // Send blocks - for (GraphImpl::Blocks::const_iterator j = graph->blocks().begin(); - j != graph->blocks().end(); ++j) { - send_block(client, &*j); + for (const auto& b : graph->blocks()) { + send_block(client, &b); } // Send ports @@ -122,9 +121,8 @@ send_graph(Interface* client, const GraphImpl* graph) } // Send arcs - for (GraphImpl::Arcs::const_iterator j = graph->arcs().begin(); - j != graph->arcs().end(); ++j) { - client->connect(j->second->tail_path(), j->second->head_path()); + for (const auto& a : graph->arcs()) { + client->connect(a.second->tail_path(), a.second->head_path()); } } |