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