C++ TargetRTS
Loading...
Searching...
No Matches
RTConfig.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 __RTConfig_h__
11#define __RTConfig_h__ included
12
13#define __RTSExternal__
14
15// These are retained only for use by applications that may need differing
16// implementations certain operating environments. RTTarget.h will equate
17// the macro TARGET with one of these. These are provided for backwards
18// compatibility only. The preferred approach is to use the preprocessor
19// symbol TARGET_VRTX, for example, which will only be defined in VRTX
20// configurations.
21
22#define platAIX3 1
23#define platAIX4 2
24#define platBSS 3
25#define platHPRT 4
26#define platHPUX 5
27#define platIRIX5 6
28#define platLynx2 7
29#define platpSOS 8
30#define platQNX 9
31#define platSun4 10
32#define platSun5 11
33#define platVRTX 12
34#define platVxWorks 13
35
36// Possible values for OTRTSDEBUG
37
38#define DEBUG_NONE 0
39#define DEBUG_TERSE 1
40#define DEBUG_VERBOSE 2
41
42// Possible values for RTFRAME_CHECKING:
43// The frame service is intended to provide operations on components of the
44// actor which has the frame SAP. The checking can be relaxed or removed.
45
46#define RTFRAME_CHECK_NONE 0 // no checking (pre-5.2 compatible)
47#define RTFRAME_CHECK_LOOSE 1 // references must be in same thread
48#define RTFRAME_CHECK_STRICT 2 // references must be in same actor
49
50// Possible values for RTTYPECHECK_PROTOCOL, RTTYPECHECK_SEND
51// and RTTYPECHECK_RECEIVE.
52
53#define RTTYPECHECK_DONT 0 // no checking
54#define RTTYPECHECK_WARN 1 // set error code, but proceed
55#define RTTYPECHECK_FAIL 2 // set error code, fail operation
56
57// Peculiarities of the compiler we are using are captured in RTLibSet.h.
58
59#ifndef __RTLibSet_h__
60#include <RTLibSet.h>
61#endif
62
63// Peculiarities of the target operating environment are captured in RTTarget.h.
64
65#ifndef __RTTarget_h__
66#include <RTTarget.h>
67#endif
68
69// Overall defaults are specified here. They can be overridden in the two files included above.
70
71// Occasionally we must cast the const away.
72#ifndef RTConstCast
73#define RTConstCast( type, value ) ( const_cast<type *>( value ) )
74#endif
75
76// Is there a defer queue in every actor?
77// By default, there is one per controller.
78
79#ifndef DEFER_IN_ACTOR
80#define DEFER_IN_ACTOR 0
81#endif
82
83// Is the internet protocol (IP) supported?
84
85#ifndef HAVE_INET
86#define HAVE_INET 1
87#endif
88
89// Does the compiler support postfix increment and decrement operators?
90
91#ifndef INTEGER_POSTFIX
92#define INTEGER_POSTFIX 1
93#endif
94
95// Should RTActor::logMsg be declared and called for every message handled?
96
97#ifndef LOG_MESSAGE
98#define LOG_MESSAGE 1
99#endif
100
101// Should the decoding classes and functions be present?
102
103#ifndef OBJECT_DECODE
104#define OBJECT_DECODE 1
105#endif
106
107// Should the encoding classes and functions be present?
108
109#ifndef OBJECT_ENCODE
110#define OBJECT_ENCODE 1
111#endif
112
113// How much of the debugger should be present?
114
115#ifndef OTRTSDEBUG
116#define OTRTSDEBUG DEBUG_VERBOSE
117#endif
118
119// Normally, free lists of certain types of objects are managed by the
120// run-time system. This hides some allocation and deallocation events
121// from tools like purify. A non-zero value for PURIFY disables those
122// free lists.
123
124#ifndef PURIFY
125#define PURIFY 0
126#endif
127
128// Obsolescent features may be used by setting RTS_COMPATIBLE to a smaller
129// number. For example, to enable features present in 5.2, use the value 520.
130
131#ifndef RTS_COMPATIBLE
132#define RTS_COMPATIBLE 520
133#endif
134
135// Should statistics be gathered?
136
137#ifndef RTS_COUNT
138#define RTS_COUNT 0
139#endif
140
141// RTS_INLINES controls whether RTS header files define any inline functions.
142
143#ifndef RTS_INLINES
144#define RTS_INLINES 1
145#endif
146
147#ifndef RTS_INLINE
148# if RTS_INLINES
149# define RTS_INLINE inline
150# else
151# define RTS_INLINE
152# endif
153#endif
154
155// What level of semantic checking should be done by the frame service?
156
157#ifndef RTFRAME_CHECKING
158#define RTFRAME_CHECKING RTFRAME_CHECK_STRICT
159#endif
160
161// When importing a capsule instance into a plugin capsule part, should we check for cycles in the reference graph?
162
163#ifndef RTIMPORT_ISREFERENCEDBY_CHECK
164#define RTIMPORT_ISREFERENCEDBY_CHECK 1
165#endif
166
167// Setting this macro to 1 guarantees that the frame service is thread safe.
168// This is an option because some applications may use the frame service in
169// ways that don't require this level of safety.
170
171#ifndef RTFRAME_THREAD_SAFE
172#define RTFRAME_THREAD_SAFE 1
173#endif
174
175// Reserve this many bytes in RTMessage for small objects. When data must
176// be copied, objects that are no larger than this will use that space in
177// the message itself rather than allocated on the heap.
178
179#ifndef RTMESSAGE_PAYLOAD_SIZE
180#define RTMESSAGE_PAYLOAD_SIZE 100
181#endif
182
183// Should we support floating point at all?
184
185#ifndef RTUseFloatingPoint
186#define RTUseFloatingPoint 1
187#endif
188
189// Should the class RTReal be present? Target environments that don't
190// support floating point data types, or can't afford them, should set
191// RTREAL_INCLUDED to zero.
192
193#ifndef RTREAL_INCLUDED
194#define RTREAL_INCLUDED RTUseFloatingPoint
195#endif
196
197#if RTREAL_INCLUDED && ! RTUseFloatingPoint
198#error RTREAL_INCLUDED requires RTUseFloatingPoint
199#endif
200
201// RTAlignment: a type with the most demanding alignment.
202
203#ifndef RTAlignment
204# if RTUseFloatingPoint
205# define RTAlignment double
206# else
207# define RTAlignment long
208# endif
209#endif
210
211// What to do about protocols which have signals of incompatible data types?
212
213#ifndef RTTYPECHECK_PROTOCOL
214#define RTTYPECHECK_PROTOCOL RTTYPECHECK_WARN
215#endif
216
217// What to do about send, invoke or reply when the type
218// is incompatible with the protocol?
219
220#ifndef RTTYPECHECK_SEND
221#define RTTYPECHECK_SEND RTTYPECHECK_WARN
222#endif
223
224// Should data be checked for type compatibility as it is received?
225
226#ifndef RTTYPECHECK_RECEIVE
227# if ( RTTYPECHECK_PROTOCOL == RTTYPECHECK_FAIL ) && \
228 ( RTTYPECHECK_SEND == RTTYPECHECK_FAIL )
229 // There is no point in re-checking: the binding and send were checked.
230# define RTTYPECHECK_RECEIVE RTTYPECHECK_DONT
231# else
232# define RTTYPECHECK_RECEIVE RTTYPECHECK_WARN
233# endif
234#endif
235
236// Some compilers have trouble with the class nesting for protocol
237// backwards compatibility and require the class names to be fully
238// qualified.
239
240#ifndef RTQUALIFY_NESTED
241#define RTQUALIFY_NESTED 0
242#endif
243
244// Some structures can be made smaller through the use of bit-fields.
245// This space savings often comes at the expense of greater code bulk.
246
247#ifndef RTUseBitFields
248#define RTUseBitFields 0
249#endif
250
251// The ability to 'suspend' actors is unsupported. Leave this alone.
252
253#ifndef SUSPEND
254#define SUSPEND 0
255#endif
256
257// RTStateId_MaxSize controls the maximum amount of space that will be
258// allocated to store a state id. The default (2 bytes) supports state machines
259// with up to 65535 states. Smaller state machines automatically use less space.
260// If all state machines in an application have no more than 255 states, slightly less
261// memory (1 byte per actor instance) will be required if RTStateId_MaxSize
262// is reduced to 1. In the unlikely situation where one or more state machines have
263// more than 65535 states, RTStateId_MaxSize may be increased to 4 without
264// any extra overhead for smaller state machines.
265
266#ifndef RTStateId_MaxSize
267#define RTStateId_MaxSize 2
268#endif
269
270#if RTStateId_MaxSize == 1
271 typedef unsigned char RTStateId;
272#elif RTStateId_MaxSize == 2
273 typedef unsigned short RTStateId;
274#elif RTStateId_MaxSize == 4
275 typedef unsigned RTStateId;
276#else
277# error RTStateId_MaxSize improperly defined.
278#endif
279
280// This macro is used in the declaration and definition of generated 'chain'
281// functions. It should be either blank, as below, or the keyword 'inline'.
282
283#ifndef INLINE_CHAINS
284#define INLINE_CHAINS
285#endif
286
287// This macro is used in the declaration and definition of generated
288// functions containing user code for guards, transitions and choie points,
289// as well as entry and exit code. It should be either blank, as below, or
290// the keyword 'inline'.
291
292#ifndef INLINE_METHODS
293#define INLINE_METHODS
294#endif
295
296// The default conditions for enabling target-observability.
297
298#ifndef OBSERVABLE
299#define OBSERVABLE ( OTRTSDEBUG != DEBUG_NONE && HAVE_INET && \
300 OBJECT_DECODE && OBJECT_ENCODE )
301#endif
302
303// Make sure we have the minimum set of tools necessary.
304
305#if OBSERVABLE && ! ( OTRTSDEBUG != DEBUG_NONE && HAVE_INET && \
306 OBJECT_DECODE && OBJECT_ENCODE )
307#error TargetRTS cannot be OBSERVABLE with OTRTSDEBUG == DEBUG_NONE \
308 or HAVE_INET == 0 \
309 or OBJECT_DECODE == 0 \
310 or OBJECT_ENCODE == 0
311#endif
312
313// The "els" connection service is NOT available.
314// This macro is only for backwards compatibility of preprocessor conditions.
315
316#define EXTERNAL_LAYER 0
317
318// _MSC_VER macro is used to find out the Visual Studio version.
319// _MSC_VER value in Visual Studio 2008 (9.0) is 1500.
320// For other compilers it is not defined. So It will be consider zero.
321// Visual Studio 2008 (9.0) is not having support for nullptr and override.
322
323#if __cplusplus < 201103L && _MSC_VER <= 1500
324 #include <cstddef>
325 #define nullptr NULL
326 #define override /*override*/
327 #define RTUseCPP11 0
328#else
329 #define RTUseCPP11 1
330#endif
331
332// Macros for the freeList
333#ifndef MIN_FREE_LIST_SIZE
334#define MIN_FREE_LIST_SIZE 20U
335#endif
336
337#ifndef MAX_FREE_LIST_SIZE
338#define MAX_FREE_LIST_SIZE 100U
339#endif
340
341#ifndef RTMESSAGE_BLOCK_SIZE
342#define RTMESSAGE_BLOCK_SIZE 250
343#endif
344
345#endif // __RTConfig_h__