cleanup, timermanager in App is a dependency that takes timers again.
App now adds already constructed Timers Timer is now an Invoker that takes a weak_ptr to a steppable with a request()rather than a bool callback. should eventually be changed to composition
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#ifndef INVOKER_HPP
|
||||
#define INVOKER_HPP
|
||||
|
||||
#include "steppable.hpp"
|
||||
#include <memory>
|
||||
class Invoker {
|
||||
public:
|
||||
virtual ~Invoker() = default;
|
||||
std::weak_ptr<Steppable> target;
|
||||
|
||||
void set_target(std::shared_ptr<Steppable> t) { target = t; }
|
||||
void request() {
|
||||
if (auto sp = target.lock()) {
|
||||
sp->step();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user