C++ TargetRTS
Loading...
Searching...
No Matches
RTTimerNode.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 __RTTimerNode_h__
11#define __RTTimerNode_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTMessage_h__
18#include <RTMessage.h>
19#endif
20
21#ifndef __RTTimerId_h__
22#include <RTTimerId.h>
23#endif
24
25#ifndef __RTTimerList_h__
26#include <RTTimerList.h>
27#endif
28
29#ifndef __RTTimespec_h__
30#include <RTTimespec.h>
31#endif
32
33#ifndef __RTTiming_h__
34#include <RTTiming.h>
35#endif
36
37#if USE_THREADS && ! defined( __RTMutex_h__ )
38#include <RTMutex.h>
39#endif
40
41class RTActor;
42class RTController;
43struct RTObject_class;
44class RTTimerActor;
45
47{
48protected:
49 friend class RTController;
50 friend class RTTimerActor;
51 friend class RTTimerId;
52 friend class RTTimerList;
53
54 // creator
55 Timing::Base * sap;
56
57 // doubly-linked chain of nodes created by sap; next used in free list
58 RTTimerNode * prev;
59 RTTimerNode * next;
60
61 // link in pending list
63
64 RTController * owner;
65 RTMessage * msg;
66 RTTimespec expireTime;
67 RTTimespec repeatInterval;
68 int missedIntervals;
69 void * data;
70 const RTObject_class * type;
71
72 RTTimerId::Ring id_ring;
73
74 int active; // being delivered?
75
76 // for RTTimerId ring management
77 void _connect( RTTimerId * );
78 static void _disconnect( RTTimerId * );
79
80 // invalidate all associated RTTimerId objects and disassociated from sap
81 void _disconnectAll( void );
82
83 void buildMsg( RTMessage *, RTActor *, int priority );
84
85 void _timeout( RTController * responder );
86 void _cancel( RTController * );
87
88 RTMessage::DeliverResult _deliver( void );
89
90#if USE_THREADS
91 static RTMutex critical;
92#endif
93
94public:
95 explicit RTTimerNode( RTController * originator );
96 ~RTTimerNode( void );
97
98 void setValue( RTMessage *,
100 const RTTimespec & expireTime,
101 const RTTimespec & repeatInterval,
102 const void * _data,
103 const RTObject_class * _type,
104 int _priority );
105
106 void clear( void );
107
108 static int cancel( RTController *, RTTimerId & );
109
110 static
111 RTMessage::DeliverResult deliver( const RTMessage * );
112
113private:
114 // unavailable methods
115 RTTimerNode( const RTTimerNode & );
116 RTTimerNode & operator=( const RTTimerNode & );
117}; //lint !e1712
118
119#endif // __RTTimerNode_h__
An instance of this class represents a capsule instance.
Definition: RTActor.h:44
A controller manages a group of capsule instances that all run in the same physical thread (i....
Definition: RTController.h:54
Represents a message used for communication between capsule instances.
Definition: RTMessage.h:33
Definition: RTTimerActor.h:36
An identifier for a timer request.
Definition: RTTimerId.h:34
Definition: RTTimerList.h:26
Definition: RTTimerNode.h:47
Represents a timer port.
Definition: RTTiming.h:43
A type descriptor providing information about a type.
Definition: RTObject_class.h:64
A time value which can represent either an absolute or relative time.
Definition: RTTimespec.h:29