Skip to content

Commit

Permalink
Fix sim_ostream linking
Browse files Browse the repository at this point in the history
  • Loading branch information
scamille committed May 2, 2020
1 parent 55c4629 commit 527dd05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
28 changes: 15 additions & 13 deletions engine/sim/sim_ostream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,22 @@ struct sim_ostream_t
std::ostream* get_stream()
{ return _raw.get_stream(); }
template <class T>
sim_ostream_t & operator<< (T const& rhs);
sim_ostream_t & operator<< (T const& rhs)
{
print_simulation_time();
_raw << rhs << "\n";

return *this;
}

template<typename Format, typename... Args>
sim_ostream_t& printf(Format&& format, Args&& ... args);
sim_ostream_t& printf(Format&& format, Args&& ... args)
{
print_simulation_time();
fmt::fprintf(*_raw.get_stream(), std::forward<Format>(format), std::forward<Args>(args)... );
_raw << "\n";
return *this;
}

/**
* Print using fmt libraries python-like formatting syntax.
Expand All @@ -78,14 +90,4 @@ struct sim_ostream_t
void print_simulation_time();
sim_t& sim;
sc_raw_ostream_t _raw;
};


template<typename Format, typename... Args>
sim_ostream_t& sim_ostream_t::printf(Format&& format, Args&& ... args)
{
print_simulation_time();
fmt::fprintf(*_raw.get_stream(), std::forward<Format>(format), std::forward<Args>(args)... );
_raw << "\n";
return *this;
}
};
10 changes: 0 additions & 10 deletions engine/simulationcraft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2452,16 +2452,6 @@ inline bool cooldown_t::is_ready() const
return queueable() <= sim.current_time();
}

template <class T>
sim_ostream_t& sim_ostream_t::operator<< (T const& rhs)
{
fmt::fprintf(*_raw.get_stream(), "%.3f ", sim.current_time().total_seconds());
_raw << rhs << "\n";

return *this;
}


struct ground_aoe_params_t
{
enum hasted_with
Expand Down

0 comments on commit 527dd05

Please sign in to comment.