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// Should the run-time tracer be present?
120
121#ifndef RTS_TRACE
122#define RTS_TRACE 1
123#endif
124
125// Normally, free lists of certain types of objects are managed by the
126// run-time system. This hides some allocation and deallocation events
127// from tools like purify. A non-zero value for PURIFY disables those
128// free lists.
129
130#ifndef PURIFY
131#define PURIFY 0
132#endif
133
134// Obsolescent features may be used by setting RTS_COMPATIBLE to a smaller
135// number. For example, to enable features present in 5.2, use the value 520.
136
137#ifndef RTS_COMPATIBLE
138#define RTS_COMPATIBLE 520
139#endif
140
141// Should statistics be gathered?
142
143#ifndef RTS_COUNT
144#define RTS_COUNT 0
145#endif
146
147// RTS_INLINES controls whether RTS header files define any inline functions.
148
149#ifndef RTS_INLINES
150#define RTS_INLINES 1
151#endif
152
153#ifndef RTS_INLINE
154# if RTS_INLINES
155# define RTS_INLINE inline
156# else
157# define RTS_INLINE
158# endif
159#endif
160
161// What level of semantic checking should be done by the frame service?
162
163#ifndef RTFRAME_CHECKING
164#define RTFRAME_CHECKING RTFRAME_CHECK_STRICT
165#endif
166
167// When importing a capsule instance into a plugin capsule part, should we check for cycles in the reference graph?
168
169#ifndef RTIMPORT_ISREFERENCEDBY_CHECK
170#define RTIMPORT_ISREFERENCEDBY_CHECK 1
171#endif
172
173// Setting this macro to 1 guarantees that the frame service is thread safe.
174// This is an option because some applications may use the frame service in
175// ways that don't require this level of safety.
176
177#ifndef RTFRAME_THREAD_SAFE
178#define RTFRAME_THREAD_SAFE 1
179#endif
180
181// Reserve this many bytes in RTMessage for small objects. When data must
182// be copied, objects that are no larger than this will use that space in
183// the message itself rather than allocated on the heap.
184
185#ifndef RTMESSAGE_PAYLOAD_SIZE
186#define RTMESSAGE_PAYLOAD_SIZE 100
187#endif
188
189// Should we support floating point at all?
190
191#ifndef RTUseFloatingPoint
192#define RTUseFloatingPoint 1
193#endif
194
195// Should the class RTReal be present? Target environments that don't
196// support floating point data types, or can't afford them, should set
197// RTREAL_INCLUDED to zero.
198
199#ifndef RTREAL_INCLUDED
200#define RTREAL_INCLUDED RTUseFloatingPoint
201#endif
202
203#if RTREAL_INCLUDED && ! RTUseFloatingPoint
204#error RTREAL_INCLUDED requires RTUseFloatingPoint
205#endif
206
207// RTAlignment: a type with the most demanding alignment.
208
209#ifndef RTAlignment
210# if RTUseFloatingPoint
211# define RTAlignment double
212# else
213# define RTAlignment long
214# endif
215#endif
216
217// What to do about protocols which have signals of incompatible data types?
218
219#ifndef RTTYPECHECK_PROTOCOL
220#define RTTYPECHECK_PROTOCOL RTTYPECHECK_WARN
221#endif
222
223// What to do about send, invoke or reply when the type
224// is incompatible with the protocol?
225
226#ifndef RTTYPECHECK_SEND
227#define RTTYPECHECK_SEND RTTYPECHECK_WARN
228#endif
229
230// Should data be checked for type compatibility as it is received?
231
232#ifndef RTTYPECHECK_RECEIVE
233# if ( RTTYPECHECK_PROTOCOL == RTTYPECHECK_FAIL ) && \
234 ( RTTYPECHECK_SEND == RTTYPECHECK_FAIL )
235 // There is no point in re-checking: the binding and send were checked.
236# define RTTYPECHECK_RECEIVE RTTYPECHECK_DONT
237# else
238# define RTTYPECHECK_RECEIVE RTTYPECHECK_WARN
239# endif
240#endif
241
242// Some compilers have trouble with the class nesting for protocol
243// backwards compatibility and require the class names to be fully
244// qualified.
245
246#ifndef RTQUALIFY_NESTED
247#define RTQUALIFY_NESTED 0
248#endif
249
250// Some structures can be made smaller through the use of bit-fields.
251// This space savings often comes at the expense of greater code bulk.
252
253#ifndef RTUseBitFields
254#define RTUseBitFields 0
255#endif
256
257// The ability to 'suspend' actors is unsupported. Leave this alone.
258
259#ifndef SUSPEND
260#define SUSPEND 0
261#endif
262
263// RTStateId_MaxSize controls the maximum amount of space that will be
264// allocated to store a state id. The default (2 bytes) supports state machines
265// with up to 65535 states. Smaller state machines automatically use less space.
266// If all state machines in an application have no more than 255 states, slightly less
267// memory (1 byte per actor instance) will be required if RTStateId_MaxSize
268// is reduced to 1. In the unlikely situation where one or more state machines have
269// more than 65535 states, RTStateId_MaxSize may be increased to 4 without
270// any extra overhead for smaller state machines.
271
272#ifndef RTStateId_MaxSize
273#define RTStateId_MaxSize 2
274#endif
275
276#if RTStateId_MaxSize == 1
277 typedef unsigned char RTStateId;
278#elif RTStateId_MaxSize == 2
279 typedef unsigned short RTStateId;
280#elif RTStateId_MaxSize == 4
281 typedef unsigned RTStateId;
282#else
283# error RTStateId_MaxSize improperly defined.
284#endif
285
286// This macro is used in the declaration and definition of generated 'chain'
287// functions. It should be either blank, as below, or the keyword 'inline'.
288
289#ifndef INLINE_CHAINS
290#define INLINE_CHAINS
291#endif
292
293// This macro is used in the declaration and definition of generated
294// functions containing user code for guards, transitions and choie points,
295// as well as entry and exit code. It should be either blank, as below, or
296// the keyword 'inline'.
297
298#ifndef INLINE_METHODS
299#define INLINE_METHODS
300#endif
301
302// The default conditions for enabling target-observability.
303
304#ifndef OBSERVABLE
305#define OBSERVABLE ( OTRTSDEBUG != DEBUG_NONE && HAVE_INET && \
306 OBJECT_DECODE && OBJECT_ENCODE )
307#endif
308
309// Make sure we have the minimum set of tools necessary.
310
311#if OBSERVABLE && ! ( OTRTSDEBUG != DEBUG_NONE && HAVE_INET && \
312 OBJECT_DECODE && OBJECT_ENCODE )
313#error TargetRTS cannot be OBSERVABLE with OTRTSDEBUG == DEBUG_NONE \
314 or HAVE_INET == 0 \
315 or OBJECT_DECODE == 0 \
316 or OBJECT_ENCODE == 0
317#endif
318
319// The "els" connection service is NOT available.
320// This macro is only for backwards compatibility of preprocessor conditions.
321
322#define EXTERNAL_LAYER 0
323
324// _MSC_VER macro is used to find out the Visual Studio version.
325// _MSC_VER value in Visual Studio 2008 (9.0) is 1500.
326// For other compilers it is not defined. So It will be consider zero.
327// Visual Studio 2008 (9.0) is not having support for nullptr and override.
328
329#if __cplusplus < 201103L && _MSC_VER <= 1500
330 #include <cstddef>
331 #define nullptr NULL
332 #define override /*override*/
333 #define RTUseCPP11 0
334#else
335 #define RTUseCPP11 1
336#endif
337
338// Macros for the freeList
339#ifndef MIN_FREE_LIST_SIZE
340#define MIN_FREE_LIST_SIZE 20U
341#endif
342
343#ifndef MAX_FREE_LIST_SIZE
344#define MAX_FREE_LIST_SIZE 100U
345#endif
346
347#ifndef RTMESSAGE_BLOCK_SIZE
348#define RTMESSAGE_BLOCK_SIZE 250
349#endif
350
351// If this setting is enabled an array config_info will be included in mainLine.cc file,
352// containing a textual encoding of all configuration settings used when compiling the TargetRTS.
353#ifndef RTCONFIG_INFO
354#define RTCONFIG_INFO 0
355#endif
356
357#endif // __RTConfig_h__