C++ TargetRTS
Loading...
Searching...
No Matches
RTTiming.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTTiming_h__
11#define __RTTiming_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTPriority_h__
18#include <RTPriority.h>
19#endif
20
21#ifndef __RTProtocol_h__
22#include <RTProtocol.h>
23#endif
24
25#ifndef __RTTimespec_h__
26#include <RTTimespec.h>
27#endif
28
29#if RTUseCPP11
30#include <chrono>
31#endif
32
33class RTTimerId;
34class RTTimerNode;
35struct RTTypedValue;
36
39struct Timing
40{
42 class Base : public RTProtocol
43 {
44 public:
45 RTS_INLINE Base( void );
46 RTS_INLINE ~Base( void );
47
48 static const RTProtocolDescriptor rt_class;
49
50 enum
51 {
52 rti_timeout = rtiLast_RTProtocol + 1
53 };
54
58 RTS_INLINE RTInSignal timeout( void );
59
63 RTTimespec currentTime( void ) const;
64
78 const void * data,
79 const RTObject_class * type,
80 int prio = General );
81
92 RTS_INLINE RTTimerNode * informAt( const RTTimespec & when,
93 int prio = General );
94
106 RTS_INLINE RTTimerNode * informAt( const RTTimespec & when,
107 const RTDataObject & data,
108 int prio = General );
109
122 RTS_INLINE RTTimerNode * informAt( const RTTimespec & when,
123 const RTTypedValue & info,
124 int prio = General );
125
140 RTS_INLINE RTTimerNode * informIn( const RTTimespec & delta,
141 const void * data,
142 const RTObject_class * type,
143 int prio = General );
144
156 RTS_INLINE RTTimerNode * informIn( const RTTimespec & delta,
157 int prio = General );
158
172 RTS_INLINE RTTimerNode * informIn( const RTTimespec & delta,
173 const RTDataObject & data,
174 int prio = General );
175
190 RTS_INLINE RTTimerNode * informIn( const RTTimespec & delta,
191 const RTTypedValue & info,
192 int prio = General );
193
194#if RTS_COMPATIBLE <= 640
195 RTTimerNode * informIn( unsigned long centiseconds,
196 int prio = General );
197
198 RTTimerNode * informIn( unsigned long centiseconds,
199 const RTDataObject & data,
200 int prio = General );
201
202 RTTimerNode * informIn( unsigned long centiseconds,
203 const RTTypedValue & info,
204 int prio = General );
205#endif // RTS_COMPATIBLE <= 640
206
221 RTS_INLINE RTTimerNode * informEvery( const RTTimespec & delta,
222 const void * data,
223 const RTObject_class * type,
224 int prio = General );
225
239 RTS_INLINE RTTimerNode * informEvery( const RTTimespec & delta,
240 const RTDataObject & data,
241 int prio = General );
242
257 RTS_INLINE RTTimerNode * informEvery( const RTTimespec & delta,
258 const RTTypedValue & info,
259 int prio = General );
260
269 RTS_INLINE RTTimerNode * informEvery( const RTTimespec & delta );
270
287 int timeouts( const RTTimerId & id );
288
296
303 void adjustTimeBegin( void );
304
312 void adjustTimeEnd( const RTTimespec & delta );
313
314#if RTUseCPP11
315 RTTimerNode * informAt( const std::chrono::system_clock::time_point & when,
316 const void * data,
317 const RTObject_class * type,
318 int prio = General );
319
320 RTS_INLINE RTTimerNode * informAt( const std::chrono::system_clock::time_point & when,
321 int prio = General );
322
323 RTS_INLINE RTTimerNode * informAt( const std::chrono::system_clock::time_point & when,
324 const RTDataObject & data,
325 int prio = General );
326
327 RTS_INLINE RTTimerNode * informAt( const std::chrono::system_clock::time_point & when,
328 const RTTypedValue & info,
329 int prio = General );
330
331 RTS_INLINE RTTimerNode * informIn( const std::chrono::nanoseconds & delta_ns,
332 const void * data,
333 const RTObject_class * type,
334 int prio = General );
335
336 RTS_INLINE RTTimerNode * informIn( const std::chrono::nanoseconds & delta_ns,
337 int prio = General );
338
339 RTS_INLINE RTTimerNode * informIn( const std::chrono::nanoseconds & delta_ns,
340 const RTDataObject & data,
341 int prio = General );
342
343 RTS_INLINE RTTimerNode * informIn( const std::chrono::nanoseconds & delta_ns,
344 const RTTypedValue & info,
345 int prio = General );
346
347 RTS_INLINE RTTimerNode * informEvery( const std::chrono::nanoseconds & delta_ns,
348 const void * data,
349 const RTObject_class * type,
350 int prio = General );
351
352 RTS_INLINE RTTimerNode * informEvery( const std::chrono::nanoseconds & delta_ns,
353 const RTDataObject & data,
354 int prio = General );
355
356 RTS_INLINE RTTimerNode * informEvery( const std::chrono::nanoseconds & delta_ns,
357 const RTTypedValue & info,
358 int prio = General );
359
360 RTS_INLINE RTTimerNode * informEvery( const std::chrono::nanoseconds & delta_ns );
361#endif
362
363 protected:
364 RTTimerNode * informIn( const RTTimespec & when,
365 const RTTimespec & repeatInterval,
366 const void * data,
367 const RTObject_class * type,
368 int prio );
369
370 enum
371 {
372 rtiLast_Timing = rti_timeout
373 };
374
375 private:
376 friend class RTTimerActor;
377 friend class RTTimerNode;
378
379 RTTimerNode * outstanding;
380
381 // unavailable methods
382 Base( const Base & );
383 Base & operator=( const Base & );
384 };
385};
386
387#if RTS_INLINES
388#include <RTTiming.inl>
389#if RTUseCPP11
390#include <RTTimingChrono.inl>
391#endif
392#endif
393
394#endif // __RTTiming_h__
Provides a common interface to certain data type implementations (e.g.
Definition: RTDataObject.h:33
Represents a general capsule port typed by a protocol which determines the set of events that can be ...
Definition: RTProtocol.h:50
Definition: RTTimerActor.h:36
An identifier for a timer request.
Definition: RTTimerId.h:34
Definition: RTTimerNode.h:47
Represents a timer port.
Definition: RTTiming.h:43
int timeouts(const RTTimerId &id)
Get the number of timeout intervals that passed before the timeout of a periodic timer was actually p...
void adjustTimeEnd(const RTTimespec &delta)
End adjustment of system time.
RTTimerNode * informIn(const RTTimespec &delta, const void *data, const RTObject_class *type, int prio=General)
Start a timer which will expire after a specified time interval.
Definition: RTTiming.inl:74
RTTimerNode * informAt(const RTTimespec &when, const void *data, const RTObject_class *type, int prio=General)
Start a timer which will expire at a particular absolute point in time.
void adjustTimeBegin(void)
Begin adjustment of system time.
int cancelTimer(RTTimerId &id)
Cancel a timer.
RTInSignal timeout(void)
Return the object that represents the timeout event which is received by this port when the timer has...
Definition: RTTiming.inl:45
RTTimerNode * informEvery(const RTTimespec &delta, const void *data, const RTObject_class *type, int prio=General)
Start a periodic timer which will expire at regular intervals.
Definition: RTTiming.inl:106
RTTimespec currentTime(void) const
Return the current time.
Provides the API for working with messages of a certain protocol event received on a certain port.
Definition: RTInSignal.h:34
A type descriptor providing information about a type.
Definition: RTObject_class.h:64
Definition: RTProtocolDescriptor.h:40
A time value which can represent either an absolute or relative time.
Definition: RTTimespec.h:29
Encapsulates a data object and its type descriptor.
Definition: RTTypedValue.h:29
Represents the predefined "Timing" protocol that can be used for implementing timers in your realtime...
Definition: RTTiming.h:40