|
|
1.1 root 1: //
2: // nono
1.1.1.4 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #include "event.h"
1.1.1.3 root 8: #include "scheduler.h"
1.1 root 9:
10: // 全イベントの配列
11: std::vector<Event *> gEvents;
12:
13: // コンストラクタ
14: Event::Event()
15: {
16: // 自身をリストに追加する
17: gEvents.push_back(this);
18: }
19:
1.1.1.6 ! root 20: // コンストラクタ (dev 指定あり)
! 21: Event::Event(Device *dev_)
! 22: : Event()
! 23: {
! 24: dev = dev_;
! 25: }
! 26:
1.1 root 27: // デストラクタ
28: Event::~Event()
29: {
30: }
1.1.1.2 root 31:
1.1.1.3 root 32: // イベントタイマーを開始する
33: void
34: Event::Start()
35: {
36: gScheduler->StartEvent(this);
37: }
38:
39: // イベントタイマーを停止する
40: void
41: Event::Stop()
42: {
43: gScheduler->StopEvent(this);
44: }
45:
1.1.1.2 root 46: // 名前をセットする
47: void
48: Event::SetName(const std::string& val)
49: {
50: name = val;
51: if (name.length() > 25) {
1.1.1.5 root 52: dev->putmsgn("Event Name \"%s\" is too long(%d chars)",
1.1.1.2 root 53: name.c_str(), (int)name.length());
54: name.resize(25);
55: }
56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.