From 517cf42748117220c82239c4c426ee628cca2d64 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 15 Aug 2024 13:32:16 +0200 Subject: [PATCH] fix examples --- examples/count/main.cc | 4 ++-- examples/hello/main.cc | 4 ++-- examples/ports/main.cc | 12 ++++++------ examples/power_train/main.cc | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/count/main.cc b/examples/count/main.cc index 716afe2f..e0c6e92b 100644 --- a/examples/count/main.cc +++ b/examples/count/main.cc @@ -26,12 +26,12 @@ class Count : public Reactor { void print_count() { const auto& value = *(counter.get()); - std::cout << "Count: " << value << std::endl; + std::cout << "Count: " << value << '\n'; counter.schedule(value + 1, 1s); } void init() { - std::cout << "Hello World!" << std::endl; + std::cout << "Hello World!\n"; counter.schedule(0, 1s); } }; diff --git a/examples/hello/main.cc b/examples/hello/main.cc index 837f89d2..3b02fd89 100644 --- a/examples/hello/main.cc +++ b/examples/hello/main.cc @@ -25,9 +25,9 @@ class Hello : public Reactor { r_terminate.declare_trigger(&sa); } - static void hello() { std::cout << "Hello World!" << std::endl; } + static void hello() { std::cout << "Hello World!\n"; } - static void terminate() { std::cout << "Good Bye!" << std::endl; } + static void terminate() { std::cout << "Good Bye!\n"; } }; auto main() -> int { diff --git a/examples/ports/main.cc b/examples/ports/main.cc index 8d098af1..671d89b7 100644 --- a/examples/ports/main.cc +++ b/examples/ports/main.cc @@ -38,7 +38,7 @@ class Counter : public Reactor { Output count{"count", this}; // NOLINT void assemble() override { - std::cout << "assemble Counter" << std::endl << std::flush; + std::cout << "assemble Counter\n"; r_trigger.declare_trigger(&trigger); r_trigger.declare_antidependency(&count); } @@ -60,11 +60,11 @@ class Printer : public Reactor { : Reactor(name, env) {} void assemble() override { - std::cout << "assemble Printer" << std::endl << std::flush; + std::cout << "assemble Printer\n"; r_value.declare_trigger(&value); } - void on_value() { std::cout << this->name() << ": " << *value.get() << std::endl; } + void on_value() { std::cout << this->name() << ": " << *value.get() << '\n'; } }; class Adder : public Reactor { @@ -88,7 +88,7 @@ class Adder : public Reactor { void add() { if (i1.is_present() && i2.is_present()) { sum.set(*i1.get() + *i2.get()); - std::cout << "setting sum" << std::endl; + std::cout << "setting sum\n"; } } }; @@ -120,10 +120,10 @@ auto main() -> int { env.draw_connection(add.sum, p_add.forward, ConnectionProperties{ConnectionType::Delayed, 10s, nullptr}); env.draw_connection(p_add.forward, p_add.value, ConnectionProperties{ConnectionType::Delayed, 5s, nullptr}); - std::cout << "assemble" << std::endl << std::flush; + std::cout << "assemble\n"; env.assemble(); - std::cout << "optimize" << std::endl << std::flush; + std::cout << "optimize\n"; auto thread = env.startup(); thread.join(); diff --git a/examples/power_train/main.cc b/examples/power_train/main.cc index 7a618948..05efe57f 100644 --- a/examples/power_train/main.cc +++ b/examples/power_train/main.cc @@ -44,7 +44,7 @@ class RightPedal : public Reactor { Reaction r1{"1", 1, this, [this]() { reaction_1(); }}; Reaction r2{"2", 2, this, [this]() { reaction_2(); }}; - void reaction_1() {}; + void reaction_1() {} void reaction_2() {} public: