IDL PreProcessor Guide Open Splice IDLPre Proc
User Manual:
Open the PDF directly: View PDF .
Page Count: 31
Download | ![]() |
Open PDF In Browser | View PDF |
IDL PreProcessor Guide Release 6.x Contents 1 . . . . 1 1 1 1 1 2 Overview 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 Prerequisites 5 4 Command Line Options 6 5 OpenSplice Modes and Languages 9 6 IDL Pre-processor Grammar 10 7 Keys 7.1 Defining Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Bounded strings as character arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 15 16 8 Modes, Languages and Processing steps 8.1 Integrated C++ ORB . . . . . . . . 8.2 C++ Standalone . . . . . . . . . . 8.3 ISOC++ . . . . . . . . . . . . . . 8.4 ISOC++2 . . . . . . . . . . . . . . 8.5 C Standalone . . . . . . . . . . . . 8.6 C99 Standalone . . . . . . . . . . . 8.7 Java Standalone . . . . . . . . . . 8.8 Integrated Java ORB . . . . . . . . 18 18 20 20 20 20 22 22 23 9 Preface 1.1 About the IDL PreProcessor Guide 1.2 Intended Audience . . . . . . . . . 1.3 Organisation . . . . . . . . . . . . 1.4 Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extensible and Dynamic Topic Types for DDS annotation support 24 10 Built-in DDS data types 26 11 References 27 12 Contacts & Notices 12.1 Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 28 28 i 1 Preface 1.1 About the IDL PreProcessor Guide The IDL Pre-processor Guide describes what the Vortex OpenSplice IDL Pre-processor is, and how to use it. The Vortex OpenSplice IDL Pre-processor is included with the Vortex OpenSplice product. 1.2 Intended Audience The IDL Pre-processor Guide is intended to be used by developers creating applications which use Vortex OpenSplice. 1.3 Organisation The Overview gives a general description of and brief introduction to the IDL Pre-processor. Prerequisites describes the prerequisites needed to run the pre-processor. IDL Pre-processor Command Line Options gives detailed descriptions of the options that are available for running the pre-processor. OpenSplice Modes and Languages provides a summary of OpenSplice’s supported modes and languages, as well as an overview of the applicable Vortex OpenSplice libraries. IDL Pre-processor Grammar shows the IDL grammar that is supported by the Vortex OpenSplice IDL Preprocessor. Keys describes the mechanism for the use of keys with particular data types. Modes, Languages and Processing steps describes the steps required for creating programs for each of the modes and languages supported by the Pre-processor. Extensible and Dynamic Topic Types for DDS annotation support describes how the IDL Pre-processor handles the annotation language extension. Built-in DDS data types describes the built-in DDS data types and provides language-specific guidelines on how to use them. Finally, there is a bibliography which lists all of the publications referred to in this Guide. 1.4 Conventions The icons shown below are used in ADLINK product documentation to help readers to quickly identify information relevant to their specific use of Vortex OpenSplice. 1 IDL PreProcessor Guide, Release 6.x Icon Meaning Item of special significance or where caution needs to be taken. Item contains helpful hint or special information. Information applies to Windows (e.g. XP, 2003, Windows 7) only. Information applies to Unix-based systems (e.g. Solaris) only. Information applies to Linux-based systems (e.g. Ubuntu) only. C language specific. C++ language specific. C# language specific. Java language specific. 1.4. Conventions 2 2 Overview The Vortex OpenSplice IDL Pre-processor plays a role in generating code for DDS/DCPS specialized interfaces (TypeSupport, DataReader and DataWriter) from application data definitions defined in IDL for all supported languages. 2.1 Introduction The Vortex OpenSplice IDL Pre-processor supports two modes: • Standalone mode where the application is only used with Vortex OpenSplice • ORB-integrated mode where the application is used with an ORB as well as with Vortex OpenSplice In a standalone context, Vortex OpenSplice provides, apart from the DDS/DCPS related artifacts, all of the artifacts implied by the lDL language-specific mapping. In this case the name space used is DDS instead of the name space implied by the IDL language-specific mapping. In an ORB-integrated context, the ORB pre-processor will provide for the artifacts implied by the lDL languagespecific mapping, while Vortex OpenSplice only provides the DDS/DCPS-related artifacts. The application data type representation provided by the ORB is also used within the Vortex OpenSplice context. In this way application data types can be shared between the ORB and Vortex OpenSplice within one application program. The Vortex OpenSplice IDL Pre-processor accepts IDL which complies with the OMG CORBA specification to specify application data types. Additionally it allows specifying keys on data types. A number of DDS data types defined in the DCPS API (for example, Time_t) are available for use with application IDL data types and can be seen as OpenSplice DDS IDL Pre-processor “built-in” definitions. The diagram OpenSplice IDL Pre-processor High Level Processes shows the Vortex OpenSplice IDL Preprocessor high-level processing. The Vortex OpenSplice IDL Pre-processor scans and parses the IDL input file containing the application data type definitions. For the selected language, the Vortex OpenSplice IDL Pre-processor generates the specialized interfaces for TypeSupport, the DataReader and the DataWriter from specialized class template files which are provided by OpenSplice. Note that the Vortex OpenSplice IDL Pre-processor will only generate specialized interfaces for application data types for which a key list is defined. If it is not, the OpenSplice DDS IDL Pre-processor assumes that the data type will only be used enclosed in other data types. The Vortex OpenSplice IDL Pre-processor also generates language-specific support functions, which are needed to allow the Vortex OpenSplice system to handle the application data types. For the standalone context the Vortex OpenSplice IDL Pre-processor generates the language-specific application data types according the OMG IDL language mapping that is applicable for the specific target language. OpenSplice IDL Pre-processor High Level Processes 3 IDL PreProcessor Guide, Release 6.x 2.1. Introduction 4 3 Prerequisites The Vortex OpenSplice environment must be set correctly for UNIX-based platforms before the Vortex OpenSplice IDL Pre-processor can be used. Run release.com from a shell command line to set the environment. release.com is located in the root directory of the Vortex OpenSplice installation (): % . /release.com The Vortex OpenSplice IDL Pre-processor, idlpp, can be invoked by running it from a command shell: % idlpp The idlpp command line options are fully described in IDL Pre-processor Command Line Options. 5 4 Command Line Options The Vortex OpenSplice IDL Pre-processor, idlpp, can be run with the following command line options: [ -h ] [ -b ] [ -n ] [ -I ] [ -D [= ] ] < -S | -C > < -l (c | c++ | cpp | java | cs | isocpp | isoc++ | c99 | simulink) > [ -F ] [ -j [old]: ] [ -o | | | ] [ -d ] [ -P [, ] ] [ -N ] • Options shown between angle brackets, < and >, are mandatory. • Options shown between square brackets, [ and ], are optional. All of these options are described in full detail below. -h List the command line options and information. -b Specifies the ORB-specific path within the template path for the specialized class templates (in case the template files are ORB specific). The ORB-specific template path can also be set via the environment variable OSPL_ORB_PATH, the command line option is however leading. To complete the path to the templates, the value of the environment variable OSPL_TMPL_PATH is prepended to the ORB path. -n Overrides the suffix that is used to identify the ORB-dependent header file (specifying the data model) that needs to be included. Normally the name of this include file is derived from the IDL file name and followed by an ORB-dependent suffix (e.g. C.h for ACE-TAO based ORBs). This option is only supported in CORBA cohabitation mode for C++; in all other cases it is simply ignored. Example usage: -n .stub.hpp (For a file named foo.idl this will include foo.stub.hpp instead of fooC.h, which is the default expectation for ACE-TAO.) -I Passes the include path directives to the C pre-processor. -D Passes the specified macro definition to the C pre-processor. -S Specifies standalone mode, which allows application programs to be built and run without involvement of any ORB. The name space for standard types will be DDS instead of the name space implied by the IDL language mapping. types will be DDS instead of the name space implied by the IDL language mapping. -C Specifies ORB integrated mode, which allows application programs to be built and run integrated with an ORB. -l (c | c++ | cpp | java | cs | isocpp | isoc++ | isocpp2 | isoc++2 | c99 | simulink) Selects the target language. Note that the Vortex OpenSplice IDL Pre-processor does not support every combination of modes and languages. This option is mandatory; when no language is selected the OpenSplice IDL Pre-processor reports an error. 6 IDL PreProcessor Guide, Release 6.x • For the c, c++, cpp, java and cs target languages the types will default to the standard types. For the isocpp and isoc++ target languages the types will default to the ISOC++ types that comply with the ISO/IEC C++ 2003 Language DDS PSM. When using isocpp, isoc++ isocpp2 or isoc++2 an equality operator will also be generated for types unless this feature is explicitly disabled. • Please note that isocpp and isoc++ target languages are DEPRECATED since V6.6.0. Please use isocpp2 or isoc++2 instead. • For the Standalone mode in C (when using the -S flag and the c language option), OSPL_ORB_PATH will by default be set to value SAC, which is the default location for the standalone C specialized class template files. • For the CORBA cohabitation mode in C++ (when using the -C flag and the c++ or cpp language option) the OSPL_ORB_PATH will, by default, be set to: CCPP/DDS_OpenFusion_1_6_1 for Unix-based platforms. CCPP\DDS_OpenFusion_1_6_1 for Windows platforms. These are the default locations for the IDL to C++ specialized class template files of the OpenSpliceTao ORB. Class templates for other ORBS are also available in separate sub-directories of the CCPP directory, but for more information about using a different ORB, consult the README file in the custom_lib/ccpp directory. • For the Standalone mode in C++ (when using the -S flag and the c++ or cpp language option), OSPL_ORB_PATH will by default be set to value SACPP, which is the default location for the standalone C++ specialized class template files. • For the Standalone mode in Java (when using the -S flag and the java language option), OSPL_ORB_PATH will by default be set to the value of SAJ, which is the default location for the standalone Java specialized class template files. • For the CORBA cohabitation mode in Java (when using the -C flag and the java language option), OSPL_ORB_PATH will by default be set to the value of SAJ, which is the default location for the CORBA Java specialized class template files. This means that the CORBA cohabitated Java API and StandAlone Java API share the same template files. • For the Standalone mode in C# (when using the -S flag and the cs language option), OSPL_ORB_PATH will by default be set to the value of SACS, which is the default location for the standalone CSharp specialized class template files. |c99| • For the c99 target language the types will default to the standard types. Except that the primitive types are mapped to the corresponding c99 types and that bound strings are mapped to char arrays with a size one larger than specified in the idl definition to allow for the terminating 0 character. |simulink| • For Simulink a MATLAB .m file is created representing the simulink bus for the input IDL file. Typically this option is used when invoking a script from MATLAB to import the IDL into Simulink. See also OpenSplice Modes and Languages for a complete list of supported modes and languages. -F Specifies FACE mode, generate FACE API type specific functions in addition to the target language specific ones. Only applicable for the java and isocpp2 target languages. -j [old]: Specifies that the (partial) package name which matches [old] will be replaced by the package name which matches (the package is substituted for the package [old]). If [old] 7 IDL PreProcessor Guide, Release 6.x is not included then the package name defined by is prefixed to all Java packages. The package names may only be separated by . (period) characters. A trailing . character is not required, but may be used. Example: -j :org.opensplice (prefixes all Java packages). Example: -j com.opensplice.:org.opensplice. (substitutes). Only applicable for the Java language. -o dds-types Enables the built-in DDS data types. In the default mode, the built-in DDS data types are not available to the application IDL definitions. When this option is activated, the built-in DDS data types will become available. Refer to Section 1.9, Built-in DDS data types, on page 28. -o custom-psm Enables support for alternative IDL language mappings. Currently CSharp offers an alternative language mapping where IDL names are translated to their PascalCase representation and where @ instead of _ is used to escape reserved C#-keywords. -o no-equality Disables support for the automatically-generated equality operator on ISOC++ types. -o deprecated-c++11-mapping Generates the ISOC++2 types using the deprecated C++11 mapping implementation as used in the past by the also deprecated isocpp/isoc++ PSM. This option only makes sense when migrating from isocpp/isoc++ to isocpp2/isoc++2. -d Specifies the output directory for the generated code. -P [, ] This option controls the signature for every external function/class interface. If you want to use the generated code for creating a DLL, then interfaces that need to be accessible from the outside need to be exported. When accessing these operations outside of the DLL, then these external interfaces need to be imported. If the generated code is statically linked, this option can be omitted. The first argument specifies the text that is prepended to the signature of every external function and/or class. For example: defining DDS_API as the macro, the user can define this macro as __declspec(dllexport) when building the DLL containing the generated code, and define the macro as __declspec(dllimport) when using the DLL containing the generated code. Addtionally a header file can be specified, which contains controls to define the macro. For example the external interface of the generated code is exported when the macro BUILD_MY_DLL is defined, then this file could look like: #ifdef BUILD_MY_DLL #define DDS_API __declspec(dllexport) #else /* !BUILD_MY_DLL */ #define DDS_API __declspec(dllimport) #endif /* BUILD_MY_DLL */ -N This option disables type caching in the copy-in routines. The copy-in routines cache the type to improve the performance of copying sequences. This option disables this feature to allow the use of sequences within multi-domain applications. Only applicable for the C and C++ languages. Specifies the IDL input file to process. 8 5 OpenSplice Modes and Languages The Vortex OpenSplice IDL Pre-processor supports two modes: • Standalone mode where the application is only used with Vortex OpenSplice • ORB-integrated mode where the application is used with an ORB as well as with Vortex OpenSplice In a standalone context, Vortex OpenSplice provides, apart from the DDS/DCPS related artifacts, all the artifacts implied by the lDL language specific mapping. In this case the used name space is DDS instead of the name space implied by the IDL language specific mapping. In an ORB-integrated context, the ORB pre-processor will provide for the artifacts implied by the lDL language specific mapping, while Vortex OpenSplice only provides the DDS/DCPS related artifacts. The application data type representation provided by the ORB is also used within the Vortex OpenSplice context. In this way application data types can be shared between the ORB and Vortex OpenSplice within one application program. The languages and modes that Vortex OpenSplice supports are listed in the table below. Supported Modes and Languages Language C Mode Standalone C++ ORB Integrated OpenSplice Library dcpssac.so dcpsac.lib dcpsccpp.so C++ ISOC++ ISOC++ Standalone ISOCPP Types ORB Integrated dcpssacpp.so dcpsisocpp.so dcpsisocpp.so ISOC++2 Java Java C# ISOCPP Types Standalone ORB integrated Standalone C99 Standalone dcpsisocpp2.so dcpssaj.jar dcpscj.jar dcpssacs Assembly.dll dcpsc99.so dcpsc99.lib ORB Template Path SAC CCPP/DDS_OpenFusion_1_4_1 for UNIX-like platforms, and CCPP\DDS_OpenFusion_1_5_1 for the Windows platform SACPP ISOCPP CCPP/DDS_OpenFusion_1_4_1 for UNIX-like platforms, and CCPP\DDS_OpenFusion_1_5_1 for the Windows platform ISOCPP2 SAJ SAJ SACS C99 The mappings for each language are in accordance with their respective OMG Language Mapping Specifications (see the Bibliography for a list of references). 9 6 IDL Pre-processor Grammar The Vortex OpenSplice IDL Pre-processor accepts the grammar which complies with the CORBA Specification. The Vortex OpenSplice IDL Pre-processor accepts the complete grammar, but it will ignore elements not relevant to the definition of data types. In the following specification of the grammar (similar to EBNF), elements that are processed by the Vortex OpenSplice IDL Pre-processor are highlighted in bold. Note that Vortex OpenSplice does not support all base types that are specified by the OMG. The idlpp also takes into account all C pre-processor directives that are common to ANSI-C, like #include, #define, #ifdef, etc.. The OMG’s IDL Grammar ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= * + ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | “{” “}” “@Annotation [ “(” ”)” ] local interface” “@Annotation [ “(” ”)” ] local interface” * ”:” “attribute” [ “default” ] ”;” { “@” }* { “//@” }* [ “(” [ ] ”)” ] | { ”,” }* “=” “struct” [ ”:” ] | | | | | | “map” “<” ”,” ”,” “>” | “map” “<” ”,” “>” “module” “{” + “}” | “{” “}” [ “abstract” | “local” ] “interface” [ “abstract” | “local” ] “interface” [ ] * Continued on next page 10 IDL PreProcessor Guide, Release 6.x Table 6.1 – continued from previous page ::= ”;” | ”;” | ”;” | ”;” | ”;” | ”;” | ”;” ::= ”:” { ”,” }* ::= ::= | ”::” | ”::” ::= ( | | | ) ::= [ “abstract” ] “valuetype” ::= “valuetype” ::= “abstract” “valuetype” [ ] “{” * “}” ::= “{” < value_element>* “}” ::= [”custom” ] “valuetype” [ ] ::= [ ”:” [ “truncatable” ] { ”,” }* ] [ “supports” { ”,” }* ] ::= ::= | < state_member> | ::= (“public” | “private”) ”;” ::= “factory” “(” [ ] ”)” [ ] ”;” ::= { ”,” }* ::= ::= “in” ::= “const” “=” ::= | | | | | | | | ** | ::= ::= | “|” ::= | “^” ::= | “&” ::= | “>>” | “<<” ::= | “+” | “-” ::= | “*” | “/” | “%” ::= | ::= “-“ | “+” | “~” ::= | | “(” ”)” ::= | | | | | | | ::= “TRUE” | “FALSE” ::=