UniSet  2.24.2
TDelay.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 //--------------------------------------------------------------------------
17 #ifndef TDelay_H_
18 #define TDelay_H_
19 // --------------------------------------------------------------------------
20 #include "PassiveTimer.h"
21 #include "Element.h"
22 // --------------------------------------------------------------------------
23 namespace uniset
24 {
25  // ---------------------------------------------------------------------------
26  // "ON" delay element
27  // Сбрасывается без задержки.. а срабатывает с задержкой.
28  class TDelay:
29  public Element
30  {
31 
32  public:
33  TDelay( Element::ElementID id, timeout_t delayMS = 0, size_t inCount = 0 );
34  virtual ~TDelay();
35 
36  virtual void tick() override;
37  virtual void setIn( size_t num, long value ) override;
38  virtual long getOut() const override;
39  virtual std::string getType() const override
40  {
41  return "Delay";
42  }
43 
44  void setDelay( timeout_t timeMS );
45  timeout_t getDelay() const;
46 
47  protected:
48  TDelay(): myout(false), delay(0) {};
49 
50  bool myout;
51  PassiveTimer pt;
52  timeout_t delay;
53 
54  private:
55  };
56  // --------------------------------------------------------------------------
57 } // end of namespace uniset
58 // ---------------------------------------------------------------------------
59 #endif
60 // ---------------------------------------------------------------------------
61 
Definition: Element.h:40
Пассивный таймер
Definition: PassiveTimer.h:94
Definition: TDelay.h:30
virtual void tick() override
Definition: TDelay.cc:84
Definition: CommonEventLoop.h:15