|
|
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:
1.1.1.7 root 7: //
8: // イベント
9: //
10:
1.1 root 11: #include "event.h"
1.1.1.3 root 12: #include "scheduler.h"
1.1 root 13:
14: // コンストラクタ
1.1.1.10! root 15: Event::Event(Device *dev_, int code_,
! 16: EventCallback_t func_, const std::string& name_)
1.1.1.6 root 17: {
18: dev = dev_;
1.1.1.10! root 19: code = code_;
! 20: func = func_;
! 21: name = name_;
1.1.1.6 root 22: }
23:
1.1 root 24: // デストラクタ
25: Event::~Event()
26: {
27: }
1.1.1.2 root 28:
29: // 名前をセットする
30: void
31: Event::SetName(const std::string& val)
32: {
33: name = val;
34: if (name.length() > 25) {
1.1.1.9 root 35: dev->putmsgn("Event Name \"%s\" is too long(%u chars)",
36: name.c_str(), (uint)name.length());
1.1.1.2 root 37: name.resize(25);
38: }
39: }
1.1.1.10! root 40:
! 41:
! 42: //
! 43: // イベントマネージャ
! 44: //
! 45:
! 46: // コンストラクタ
! 47: EventManager::EventManager()
! 48: : inherited(OBJ_EVENT_MANAGER)
! 49: {
! 50: }
! 51:
! 52: // デストラクタ
! 53: EventManager::~EventManager()
! 54: {
! 55: }
! 56:
! 57: // イベントを登録する。
! 58: // こっちは初期設定のほう。イベントを有効にする、ではない。
! 59: Event *
! 60: EventManager::Regist(Device *dev_, int code_,
! 61: EventCallback_t func_, const std::string& name_)
! 62: {
! 63: all.push_back(new Event(dev_, code_, func_, name_));
! 64: return all.back();
! 65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.