diff --git a/CAPI/API/include/API.h b/CAPI/API/include/API.h index 9a2c9e1..3aabda2 100644 --- a/CAPI/API/include/API.h +++ b/CAPI/API/include/API.h @@ -128,9 +128,24 @@ protected: ILogic& logic; }; -class IHumanAPI : public IAPI +// 给Logic使用的IAPI接口,为了保证面向对象的设计模式 +class IAPIForLogic : public IAPI +{ + IAPIForLogic(ILogic& logic) : + IAPI(logic) + { + } + virtual void StartTimer() = 0; + virtual void EndTimer() = 0; +}; + +class IHumanAPI : public IAPIForLogic { public: + HumanAPI(ILogic& logic) : + IAPIForLogic(logic) + { + } virtual std::future StartFixMachine() = 0; virtual std::future EndFixMachine() = 0; virtual std::future GetFixStatus() = 0; @@ -141,9 +156,13 @@ public: [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; }; -class IButcherAPI : public IAPI +class IButcherAPI : public IAPIForLogic { public: + ButcherAPI(Logic& logic) : + IAPIForLogic(logic) + { + } virtual std::future Attack(double angleInRadian) = 0; virtual std::future CarryHuman() = 0; virtual std::future ReleaseHuman() = 0; @@ -151,4 +170,40 @@ public: [[nodiscard]] virtual std::shared_ptr GetSelfInfo() const = 0; }; +class HumanAPI : public IHumanAPI +{ +public: + HumanAPI(Logic& logic) : + logic(logic) + { + } +}; + +class DebugHumanAPI : public IHumanAPI +{ +public: + DebugHumanAPI(Logic& logic) : + logic(logic) + { + } +}; + +class ButhcerAPI : public IButcherAPI +{ +public: + ButhcerAPI(Logic& logic) : + logic(logic) + { + } +}; + +class DebugButcherAPI : public IButcherAPI +{ +public: + DebugButcherAPI(Logic& logic) : + logic(logic) + { + } +}; + #endif \ No newline at end of file