Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnrd committed Aug 19, 2024
1 parent 2f3747d commit ecd53db
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/count/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down
4 changes: 2 additions & 2 deletions examples/hello/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions examples/ports/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Counter : public Reactor {
Output<int> 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);
}
Expand All @@ -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 {
Expand All @@ -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";
}
}
};
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/power_train/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ecd53db

Please sign in to comment.