Free Electron
PushSequencer.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __signal_PushSequencer_h__
8 #define __signal_PushSequencer_h__
9 
10 #define FE_SEQUENCER_ROLLOVER_WINDOW (U32)(1 << 31)
11 
12 
13 namespace fe
14 {
15 namespace ext
16 {
17 
18 /** @brief Mechanism to fire scheduled signals
19 
20  @ingroup signal
21 
22  Entries for the sequencer are represented by pulse records which have
23  these four attributes:
24 
25  - time --
26  The time at which to fire the signal.
27 
28  - interval --
29  Interval in which to repeat the signal.
30 
31  - count --
32  Number of times to repeatedly fire the signal. Setting this to
33  zero will repeat an unlimited number of times. A non-zero count
34  is decremented every time the signal is fired, and when decremented
35  form 1 to 0 the signal is removed from the sequencer.
36  A negative count will halt repeating without removing the signal,
37  which is a way to pause repeating.
38 
39  - periodic --
40  The mode to repeat signals.
41  - 0 -- the repeat signal is set to the sequencer handle time plus the
42  interval.
43  This means that the true interval between firings in likely longer
44  than the interval setting, but such signals will never
45  'fall behind'.
46  - 1 -- The time for a repeat signal is set to the previous time plus
47  the interval. Note that this could lead to the system getting
48  swamped by periodic signals. However, if the computation load
49  varies a lot, this setting could allow repeats to 'catch up'.
50  - 2 -- The time for a repeat signal is set to the previous time plus
51  the interval unless such time has already passed in which case the
52  time is set to the sequencer handle time. This is like setting 1
53  that will
54  not fall behind.
55  - 3 -- the repeat signal is set to the current time (after the immediate
56  handling of the signal is processed) plus the interval. This
57  is a sort of 'forced yield for a time' mode.
58 
59  @copydoc PushSequencer_info
60  */
61 class FE_DL_EXPORT PushSequencer :
62  virtual public SequencerI,
63  virtual public HandlerI
64 {
65  public:
66  PushSequencer(void);
67 virtual ~PushSequencer(void);
68  // AS SequencerI
69 virtual U32 getCurrentTime( void);
70 virtual void setTime( U32 counter);
71 virtual Record add( sp<Layout> spLayout,
72  U32 startTime,
73  U32 interval);
74 virtual Record lookup( sp<Layout> spLayout,
75  U32 interval);
76 virtual bool remove( Record pulse);
77 
78  // AS HandlerI
79 virtual void handle( Record &signal);
80 virtual void handleBind( sp<SignalerI> spSignalerI,
81  sp<Layout> spLayout);
82 
83  private:
84 
85  class t_pulse : public Counted
86  {
87  public:
88  Record m_record;
89  AsSequenceSignal m_asSeqSignal;
90  int time(void)
91  {
92  return m_asSeqSignal.time(m_record);
93  }
94  int interval(void)
95  {
96  return m_asSeqSignal.interval(m_record);
97  }
98  };
99 
100  void insert( sp<t_pulse> &a_pulse);
101 
102  private:
103  U32 m_timeOffset;
104  SignalerI *m_pSignaler;
105  std::list<sp<t_pulse> > m_pulseList;
106  SystemTicker m_ticker;
107 };
108 
109 } /* namespace ext */
110 } /* namespace fe */
111 
112 #endif /* __signal_PushSequencer_h__ */
113 
Mechanism to fire scheduled signals.
Definition: PushSequencer.h:61
Timed record broadcaster.
Definition: SequencerI.h:20
Heap-based support for classes participating in fe::ptr <>
Definition: Counted.h:35
kernel
Definition: namespace.dox:3
Accessor< int > time
time setting for sequencer signals
Definition: AccessorSets.h:82
Selective record broadcaster.
Definition: SignalerI.h:20
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
High precision timer.
Definition: SystemTicker.h:174
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Accessor< int > interval
interval setting for sequencer signals
Definition: AccessorSets.h:84
Sequencer signal.
Definition: AccessorSets.h:69