📄 timer.cc
字号:
#include "koala.hh"SerialType<Koala::Timer> Koala::Timer::type( "Koala::Timer");Koala::Timer::Timer(Checkpoint& cp) : Serializable(cp), Event(cp){ SerialID cid = extract<SerialID>(cp); cpu = dynamic_cast<Koala *>(find_object(cid)); if (!cpu) throw Checkpoint::SyntaxError(cp, "%d is not a Koala module ID", cid);}voidKoala::Timer::invoke(){ cpu->deliver_interrupt(5);}voidKoala::Timer::checkpoint(Checkpoint& cp, bool parent) const{ if (parent) cp << type << ' ' << id << '\n'; Event::checkpoint(cp); cp << cpu->id << '\n';}voidKoala::set_timer(){ if (timer != NULL) { remove(timer); delete timer; } timer = new Timer(this, now + (cp0[Compare] - (cp0[Count] + ((now - count_seed) / 2))) * 2); insert(timer);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -