|
UniSet
2.6.0
|
00001 /* 00002 * Copyright (c) 2015 Pavel Vainerman. 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU Lesser General Public License as 00006 * published by the Free Software Foundation, version 2.1. 00007 * 00008 * This program is distributed in the hope that it will be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Lesser Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 */ 00016 //-------------------------------------------------------------------------- 00017 #ifndef TDelay_H_ 00018 #define TDelay_H_ 00019 // -------------------------------------------------------------------------- 00020 #include "PassiveTimer.h" 00021 #include "Element.h" 00022 // -------------------------------------------------------------------------- 00023 namespace uniset 00024 { 00025 // --------------------------------------------------------------------------- 00026 // "ON" delay element 00027 // Сбрасывается без задержки.. а срабатывает с задержкой. 00028 class TDelay: 00029 public Element 00030 { 00031 00032 public: 00033 TDelay( Element::ElementID id, timeout_t delayMS = 0, size_t inCount = 0 ); 00034 virtual ~TDelay(); 00035 00036 virtual void tick() override; 00037 virtual void setIn( size_t num, bool state ) override; 00038 virtual bool getOut() const override; 00039 virtual std::string getType() const override 00040 { 00041 return "Delay"; 00042 } 00043 00044 void setDelay( timeout_t timeMS ); 00045 inline timeout_t getDelay() const 00046 { 00047 return delay; 00048 } 00049 00050 protected: 00051 TDelay(): myout(false), delay(0) {}; 00052 00053 bool myout; 00054 PassiveTimer pt; 00055 timeout_t delay; 00056 00057 private: 00058 }; 00059 // -------------------------------------------------------------------------- 00060 } // end of namespace uniset 00061 // --------------------------------------------------------------------------- 00062 #endif 00063 // --------------------------------------------------------------------------- 00064
1.7.6.1