aboutsummaryrefslogtreecommitdiffstats
path: root/src/Flowgraph.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-01 17:41:55 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-01 17:41:55 +0200
commit07f5c0fbfb43b099fa09b273a1074093c7579903 (patch)
tree48a2b759b46aaa483ab238d679cc172a97bdff82 /src/Flowgraph.cpp
parentdd22ff8c7ab0ec2fae413431b7d546d2bf9367ea (diff)
downloaddabmod-07f5c0fbfb43b099fa09b273a1074093c7579903.tar.gz
dabmod-07f5c0fbfb43b099fa09b273a1074093c7579903.tar.bz2
dabmod-07f5c0fbfb43b099fa09b273a1074093c7579903.zip
Replace some loops with iterators to foreach loops
Diffstat (limited to 'src/Flowgraph.cpp')
-rw-r--r--src/Flowgraph.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Flowgraph.cpp b/src/Flowgraph.cpp
index e36c1f4..e4c6a30 100644
--- a/src/Flowgraph.cpp
+++ b/src/Flowgraph.cpp
@@ -151,12 +151,11 @@ Flowgraph::~Flowgraph()
if (myProcessTime) {
fprintf(stderr, "Process time:\n");
- std::vector<shared_ptr<Node> >::const_iterator node;
- for (node = nodes.begin(); node != nodes.end(); ++node) {
+ for (const auto &node : nodes) {
fprintf(stderr, " %30s: %10u us (%2.2f %%)\n",
- (*node)->plugin()->name(),
- (unsigned)(*node)->processTime(),
- (*node)->processTime() * 100.0 / myProcessTime);
+ node->plugin()->name(),
+ (unsigned)node->processTime(),
+ node->processTime() * 100.0 / myProcessTime);
}
fprintf(stderr, " %30s: %10u us (100.00 %%)\n", "total",
@@ -215,19 +214,18 @@ bool Flowgraph::run()
{
PDEBUG("Flowgraph::run()\n");
- std::vector<shared_ptr<Node> >::const_iterator node;
timeval start, stop;
time_t diff;
gettimeofday(&start, NULL);
- for (node = nodes.begin(); node != nodes.end(); ++node) {
- int ret = (*node)->process();
+ for (const auto &node : nodes) {
+ int ret = node->process();
PDEBUG(" ret: %i\n", ret);
gettimeofday(&stop, NULL);
diff = (stop.tv_sec - start.tv_sec) * 1000000 +
stop.tv_usec - start.tv_usec;
myProcessTime += diff;
- (*node)->addProcessTime(diff);
+ node->addProcessTime(diff);
start = stop;
if (!ret) {
return false;