|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2022 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // ! 8: // DIPSW ! 9: // ! 10: ! 11: #pragma once ! 12: ! 13: #include "device.h" ! 14: ! 15: // DIPSW 共通クラス ! 16: class DipswDevice : public Device ! 17: { ! 18: using inherited = Device; ! 19: public: ! 20: DipswDevice(int sz_); ! 21: ~DipswDevice() override; ! 22: ! 23: // 総数を返す。 ! 24: int GetSize() const { return dipsw.size(); } ! 25: ! 26: // DIPSW n 番の値を取得/設定する。 ! 27: // true/false の割り当て方は機種依存。 ! 28: bool Get(int n) const; ! 29: void Set(int n, bool val); ! 30: ! 31: // DIPSW n 番の物理位置を取得/設定する。0 が上、1が下。 ! 32: // これは GUI 用なので、値の向きはスクロールバーの position に由来。 ! 33: int GetPosition(int n) const; ! 34: void SetPosition(int n, int val); ! 35: ! 36: protected: ! 37: std::vector<bool> dipsw {}; ! 38: ! 39: // 論理値と物理位置の対応。 ! 40: // upside が true なら、上が true ! 41: // upside が false なら、上が false。 ! 42: bool upside; ! 43: }; ! 44: ! 45: // LUNA の DIPSW ! 46: class LunaDipswDevice : public DipswDevice ! 47: { ! 48: using inherited = DipswDevice; ! 49: public: ! 50: LunaDipswDevice(); ! 51: ~LunaDipswDevice() override; ! 52: ! 53: bool Init() override; ! 54: }; ! 55: ! 56: // NEWS の DIPSW ! 57: class NewsDipswDevice : public DipswDevice ! 58: { ! 59: using inherited = DipswDevice; ! 60: public: ! 61: NewsDipswDevice(); ! 62: ~NewsDipswDevice() override; ! 63: ! 64: bool Init() override; ! 65: }; ! 66: ! 67: static inline DipswDevice *GetDipswDevice() { ! 68: return Object::GetObject<DipswDevice>(OBJ_DIPSW); ! 69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.