Home

Using RTI Code Generator - Community RTI Connext Users

image

Contents

1. Defines a user variable that can be used in the templates as userVarList name or userVarList name equals value The variables defined with this option are case sensitive Generated Files Table 2 1 Options for rtiddsgen Option Description verbosity 1 3 Sets the Code Generator verbosity 1 Exceptions 2 Exceptions and warnings 3 Exceptions warnings and information Default Displays the version of Code Generator being used such as 2 x y as well as the ee version of the templates being used xxxx xxxx xxxx writer Generates support for a DataWriter only with micro XMLInputFile xm A file containing XML descriptions of your data types If inputXml is not used the file must have an xml extension Note Before using a makefile created by Code Generator to compile an application make sure the NDDSHOME environment variable is set as described in the RTI Connext DDS Core Libraries Getting Started Guide 3 Generated Files The following tables show the files that Code Generator creates for an example IDL file called Hello idl LI C C C CLI C Files Created for Example Hello idl Table 3 1 I Java Files Created for Example Hello idl Table 3 2 J Ada Files Created for Example Hello idl Table 3 3 Table 3 1 C C C CLI C Files Created for Example Hello idl Generated Files Description The following fil
2. lt your home directory gt rti_connext_dds version 1 This document is provided with RTI Connext DDS You can also access it from the RTI Community s Documenta tion page Paths Mentioned in Documentation e Windows systems user with Administrator privileges C Program Files rti_connext_dds version for 64 bits machines or C Program Files x86 rti_connext_dds version for 32 bit machines You may also see NDDSHOME or NDDSHOME which refers to an environment variable set to the installation path Wherever you see lt NDDSHOME gt used in a path replace it with your installation path Note for Windows Users When using a command prompt to enter a command that includes the path C Program Files or any directory name that has a space enclose the path in quotation marks For example C Program Files rti_connext_dds version bin rtiddsgen or if you have defined the NDDSHOME environment variable SNDDSHOMES bin rtiddsgen RTI Workspace directory rti_workspace The RTI Workspace is where all configuration files for the applications and example files are located All configuration files and examples are copied here the first time you run RTI Launcher or any script in lt NDDSHOMED gt bin The default path to the RTI Work space directory is e Mac OS X systems Users your user name rti_workspace e UNIX based systems home your user name rti_workspace e Windows systems your Windows documents f
3. C that prints the members for a structure and if it is an array or sequence its corresponding size For this IDL module Mymodule struct MyStruct long longMember Customizing the Generated Code long arrayMember 2 100 sequence lt char 2 gt sequenceMember sequence lt long 5 gt arrayOfSequenceMember 28 We want to generate this void MyModule MyStruct_specialPrint printf longMember n printf arrayMember is an array 2 100 n printf sequenceMember is a sequence lt 2 gt n printf arrayOfSequenceMember is an array 28 is a sequence lt 5 gt The code in the template would look like this We go through all the list of types foreach node in constructMapList We only want the method for structs if Snode constructKind equals struct void node nativeFQName specialPrint We go through all the members and call to the macros that check if they are array or sequences foreach Smember in node memberFieldMapList print Smember name isAnArray Smember isASeq Smember An end end end The isAnArray macro checks if the member is an array i e has the variable dimensionList and in that case prints it macro isAnArray member if member dimensionList is an array member dimensionList end end The isASeq macro checks if the member is an sequence i e has the variable seqSize and in that case pr
4. lt architecture gt Required if create makefiles or update makefiles is used Valid options for lt architecture gt are listed in the RTI Connext DDS Core Libraries Platform Notes or you can replace lt architecture gt with the string universal platform universal to generate compatible publisher subscriber code for all supported platforms The universal architecture will not generate makefiles project files ppDisable ppOption lt option gt Disables the preprocessor Specifies a preprocessor option This option can be used multiple times to provide the command line options for the specified preprocessor See ppPath lt path to preprocessor gt ppPath lt path to preprocessor gt Specifies the preprocessor If you only specify the name of an executable not a complete path to that executable the executable must be found in your Path The default value is cpp for non Windows architectures and cl exe for Windows architectures If you use ppPath to provide the full path and filename for cl exe or the cpp preprocessor you must also use ppOption lt option gt to set the following preprocessor options If you use a non default path for cl exe you also need to set ppOption nologo ppOption C ppOption E ppOption X If you use a non default path for cpp you also need to set ppOption C reader Generates support for a DataReader only with micro Command Line Arguments for rti
5. run rtiddsgen The VCVARS32 BAT file is usually located in lt Visual Studio Installation Directory gt VC bin Alternatively run rtiddsgen from the Visual Studio Command Prompt under the Visual Studio Tools folder If you are generating code for Connext DDS the options are rtiddsgen help autoGenFiles lt architecture gt create lt typefiles examplefiles makefiles gt convertToIdl convertToXML D lt name gt lt values d lt outdir gt enableEscapeChar example lt architecture gt express I lt directory gt inputId1l lt IDLInputFile idl gt inputXml lt XMLInputFile xml gt language lt Ada C C C 03 C 11 C CLI C Java gt namespace noCopyable notypecode obfuscate package lt packagePrefix gt platform lt architecture gt ppDisable ppPath lt path to preprocessor gt ppOption lt option gt reader replace sequenceSize lt unbounded sequences size gt sharedLib stringSize lt unbounded strings size gt U lt name gt unboundedSupport update lt typefiles examplefiles makefiles gt use42eAlignment V lt name lt lt value gt verbosity 1 3 version writer If you have RTI CORBA Compatibility Kit you can use the above options plus these corba CORBA Client header file dataReaderSuffix lt suffix gt dataWriterSuffix lt suffix gt Command Line Argument
6. RTI Code Generator for RTI Connext DDS User s Manual Version 2 3 0 t I Your systems Working as one 2014 2015 Real Time Innovations Inc All rights reserved Printed in U S A ir printing June 2015 Trademarks Real Time Innovations and RTI are registered trademarks of Real Time Innovations Inc All other trademarks used in this document are the property of their respective owners Tai and Use Restrictions p of this publication may be reproduced stored in a retrieval system or transmitted in any form including electronic mechanical photocopy and facsimile without the prior written permission of Real Time Innovations Inc The software described in this document is furnished under an subject to the RTI software license agreement The software may be used or copied only under the terms of the license agreement Technical Support Real Time Innovations Inc 232 East Java Drive Sunnyvale CA 94089 Phone 408 990 7444 Email support rti com Website https support rti com Contents 1 SUMtrOAU CH OM csccccacssvcssecssctensdedecsesebcutebeassedesseagoobcsseberonssedsstenssaseubsutesnssacussossspecsetosn canes cbessensaesusnsadesieswedSeesasueos es 1 1 1 Paths Mentioned in Documentation ccssesssssesssecessscsssesesesssssssesesssssssssesesssssssesesesssssnsesessssssssesesesesenes 1 2 Command Line Arguments for rtiddsgen ccccscsssssssssssssssssssesssssssssssssessssssesssessesessssscs
7. able 3 2 Java Files Created for Example Hello idl Data Type Generated Files Description The following optional files are generated when you use the example lt architecture gt command line option You may modify and use these files as a way to create simple applications that publish or subscribe to the user data type Example code for applications that publish or subscribe to HelloPublisherjava the user data type You should modify the code in the Aw publisher application to set and change the value of the Structures Unions HelloSubscriberjava published data Otherwise both files should be ready to compile and run kefile Hello lt architecture gt Makefile for non Windows based architectures An a ee example lt architecture gt is i86Linux2 6gcc4 4 5jdk Sa Unions HelloTypeCode java ructures Unions AO Typedefs Enums Note this is not generated if Type code class associated with the IDL type Hello you use notypecode Table 3 3 Ada Files Created for Example Hello idl Generated Files Description Hello h c Generated code for the data types which contain the HelloSupport h c implementation for the data types and header files that HelloPlugin _h c contain declarations used in the implementation of the data types hello_idl_file adb ads hello_idl_file hello_datawriter adb ads hello_idl_file hello_datareader adb ads DataReader and DataWriter clas
8. akefiles platform lt architecture gt create lt typefiles examplefiles makefiles gt Creates the files indicated typefiles examplefiles or makefiles if they do not exist If the files already exist the files are not modified and a warning is printed There can be multiple create options If both create and update are specified for the same file type only the update will be applied convertToldl Converts the input type description file into IDL format This option creates a new file with the same name as the input file and a id extension convertloXML Converts the input type description file into XML format This option creates a new file with the same name as the input file and a xml extension This option is only available when using the RTI CORBA Compatibility Kit for corba CORBA Client header file Connext available for purchase as a separate product and described in the RTI Connext DDS Core Libraries User s Manual Command Line Arguments for rtiddsgen Table 2 1 Options for rtiddsgen Option Description D lt name gt lt value gt Defines preprocessor macros On Windows systems enclose the argument in quotation marks D lt name gt lt value gt d lt outdir gt Generates the output in the specified directory By default Code Generator will generate files in the directory where the input type definition file is found da
9. bjects needed to receive data using a listener function No modification of this file is required It is ready for you to compile and run Hello sln Hello_publisher v c cs cx proj Hello_subscriber v c cs cx proj Microsoft Visual Studio solution and project files generated only for Visual Studio based architectures To compile the generated source code open the workspace file and build the two projects makefile_Hello_ lt architecture gt Makefile for non Visual Studios based architectures An example lt architecture gt is i86Linux2 6gcc4 4 5 Table 3 2 Java Files Created for Example Hello idl Data Type Generated Files Description Since the Java language requires individual files to be created for each class Code Generator will generate a source file for every IDL construct that translates into a class in Java Constants Hello java Class associated with the constant Enums Hello java Class associated with enum type Hello java i Structure Union class HelloSeq java Sequence class Structures Unions HelloDataReader java ape DDS DataReader and DataWriter classes HelloDataWriter java nee We Support serialize deserialize etc class HelloTypeSupportjava Hello java Wrapper class Typedef of g HelloSeq java Sequence class sequences or arrays HelloTypeSupport java Support serialize deserialize etc class Generated Files T
10. ddsgen Table 2 1 Options for rtiddsgen Option Description Deprecated option Instead use update lt typefiles examplefiles makefiles gt for the proper files typefiles examplefiles makefiles Jeplac This option is maintained for backwards compatibility It allows Code Generator to P overwrite any existing generated files If it is not present and existing files are found Code Generator will print a warning but will not overwrite them sequenceSize lt unbounded sequences size gt Sets the size assigned to unbounded sequences The default value is 100 elements sharedLib Generates makefiles that compile with the Connext DDS shared libraries by default the makefile will link with the static libraries stringSize lt unbounded strings size gt Sets the size assigned to unbounded strings not counting a terminating NULL character The default value is 255 bytes typeSequenceSuffix lt suffix gt U lt name gt This option can only be used with the corba CORBA Client header file option Assigns a suffix to the names of the implicit sequences defined for IDL types By default the suffix is Seq Therefore given the type Foo the name of the implicit sequence will be FooSeq Cancels any previous definition of lt name gt unboundedSupport Generates code that supports unbounded sequences and strings When the option is used the command line options sequenceSize and s
11. es are required for the user data type The source files should be compiled and linked with your application The header files are required to use the data type in source You should not modify these files unless you intend to customize the generated code supporting your type Hello c cxx cpp HelloSupport c cxx cpp HelloPlugin c cxx cpp Generated code for the data types These files contain the implementation for your data types Hello h HelloSupport h HelloPlugin h Header files that contain declarations used in the implementation of your data types Generated Files Table 3 1 C C C CLI C Files Created for Example Hello idl Generated Files Description type The following optional files are generated when you use the example lt architecture gt command line option You may modify and use these files as a way to create simple applications that publish or subscribe to the user data Hello_publisher c cxx cpp cs data You will need to modify the code to set and change the values being sent in the data structure Otherwise just compile and run Example code for an application that publishes the user data type This example shows the basic steps to create all of the DDS objects needed to send Hello_subscriber c cxx cpp cs Example code for an application that subscribes to the user data type This example shows the basic steps to create all of the DDS o
12. ill automatically stop if it is not used for a certain amount of time The default value is 20 seconds you can change this by editing the rtiddsgen_server script and adjusting the value of the parameter n_servertimeout 13
13. ints it macro isASeq member if S member seqSize is a sequence lt S member seqSize gt end end You can add new variables to the templates using the V lt name lt lt value gt command line option when starting Code Generator This variable will be added to the userVarList hashMap You can refer to it in the template as userVarList name or userVarList name equals value For more information on velocity templates see http velocity apache org engine releases velocity 1 5 user guide html 12 Boosting Performance with Server Mode Boosting Performance with Server Mode If you need to invoke Code Generator multiple times with different parameters and or type files there will be a performance penalty derived from loading the JVM and compiling the velocity templates To help with the above scenario you can run Code Generator in server mode Server mode runs a native executable that opens a TCP connection to a server instance of the code generator that is spawned the first time the executable is run as depicted below creates ee a f iidegena serveil tcp client ttiddsgen2 0 When Code Generator is used in server mode JVM is loaded a single time when the server is started the velocity templates are also compiled a single time To invoke Code Generator in server mode use the script rtiddsgen_server bat which is in the scripts directory The Code Generator server w
14. is flag I lt directory gt Adds to the list of directories to be searched for type definition files IDL or XML files Note A type definition file in one format cannot include a file in another format lt Adal C C 1C 03 1C 11 C CLI C Java gt For Connext DDS Micro language lt C C gt inputldl Indicates that the input file is an IDL file regardless of the file extension IDLInputFile idl ae PE a ii of your data types If inputIdl is not used the inputXml Indicates that the input file is an XML file regardless of the file extension help Prints out the command line options for rtiddsgen For Connext DDS Core language Specifies the language to use for the generated files The default language is C metp micro Generates code for the Multi Encapsulation Type Support METP library The METP library requires a special version of RTI Connext DDS Core please contact support rti com for more information Generates code and support files for Connext DDS Micro instead of Connext Professional Use micro help to list the options supported by Code Generator when targeting RTI Connext DDS Micro Command Line Arguments for rtiddsgen Table 2 1 Options for rtiddsgen Option Description namespace Specifies the use of C namespaces For C only For C CLI and C it is implied namespaces are always used noCopyable Force
15. llowing command in an existing template where lt path ToTemplate gt is relative to the lt NDDSHOME gt resource app app_support rtiddsgen templates folder parse lt pathToTemplate gt template vm If that template vm file contains macros you can use it within the original template If tem plate vm contains just plain text without macros that text will be included directly in the origi nal file You can customize the behavior of a template by using the predefined set of variables provided with Code Generator For more information see the tables in RTI_rtiddsgen_template_variables xlsx This file contains two different sheets Language Templates and Template variables The Lan guage Template sheet shows the correspondence between the Velocity Templates used and the generated files for each language If for example we want to add a method in C in the Hello c file we would need to modify the template typeBody vm under the templates c directory The scope of a template can be I type If we generate a file with that template for each type in the IDL file For example in Java where we generate a TypeSupport file for each type in the IDL LI file If we generate a file with that template for each IDL file For example in C we gener ate a single plugin file containing all the types Plugin information L lastlopLevelType If we generate a file with that template for the last top level type in the IDL file This is commonly
16. older rti_workspace Note your Windows documents folder depends on your version of Windows For example on Windows 7 the folder is C Users your user name Documents on Windows Server 2003 the folder is C Documents and Settings your user name Documents You can specify a different location for the rti_workspace directory See the RTI Connext DDS Core Libraries Getting Started Guide for instructions lt path to examples gt Examples are copied into your home directory the first time you run RTI Launcher or any script in lt NDDSHOME gt bin This document refers to the location of these examples as lt path to examples gt Wherever you see lt path to examples gt replace it with the appropri ate path By default the examples are copied to rti_workspace version examples So the paths are e Mac OS X systems Users your user name rti_workspace version examples e UNIX based systems home your user name rti_workspace version examples Command Line Arguments for rtiddsgen e Windows systems your Windows documents folder rti_workspace version examples Note your Windows documents folder is described above You can specify that you do not want the examples copied to the workspace See the RTI Connext DDS Core Libraries Getting Started Guide for instructions Command Line Arguments for rtiddsgen On Windows systems Before running rtiddsgen run VCVARS32 BAT in the same command prompt that you will use to
17. s Code Generator to put copy logic into the corresponding TypeSupport class rather than the type itself This option is only used for Java code generation notypecode Disables type code support If you are using a large data type more than 64 K and type code support you will see a warning when type code information is sent Connext DDS has a type code size limit of 64K To avoid the warning when working with data types with type codes larger than 64K turn off type code support by using notypecode Type code support must be enabled if you are going to use ContentFilteredTopics with the default SQL filter obfuscate Generates an obfuscated IDL file from the input file Note that even if the input type is XML this option generates an obfuscated IDL file orb lt CORBA ORB gt Only applies if corba CORBA Client header file is also specified Specifies the CORBA ORB The majority of generated code is independent of the ORB However for some IDL features the generated code depends on the ORB Code Generator generates code compatible with ACE TAO or JacORB To select an ACE_TAO version use the orb option The default is ACE_TAO1 6 package lt packagePrefix gt Specifies the root package into which generated classes will be placed It applies to Java only If the type definition file contains module declarations those modules will be considered subpackages of the package specified here platform
18. s for rtiddsgen orb lt CORBA ORB gt typeSequenceSuffix lt suffix gt If you are generating code for RTI Connext DDS Micro the options are rtiddsgen help create lt typefiles examplefiles makefiles gt convertToIdl convertToXML D lt name gt lt values d lt outdir gt enableEscapeChar I lt directory gt inputId1l lt IDLInputFile idl gt inputXml lt XMLInputFile xml gt language lt C C gt micro namespace ppDisable ppPath lt path to preprocessor gt ppOption lt option gt reader replace sequenceSize lt unbounded sequences size gt stringSize lt unbounded strings size gt U lt name gt update lt typefiles examplefiles makefiles gt V lt name lt lt value gt s verbosity 1 3 version writer Table 2 1 describes the options Table 2 1 Options for rtiddsgen Option Description autoGenFiles lt architecture gt Updates the auto generated files i e the typefiles and makefile project files Valid options for lt architecture gt are listed in the RTI Connext DDS Core Platform Notes or you can replace lt architecture gt with the string universal autoGenFiles universal to generate compatible publisher subscriber code for all supported platforms The universal architecture will not generate makefiles project files This is a shortcut for update typefiles update m
19. ses and serialize deserialize methods hello_idl_file hello_typesupport adb ads hello_idl_file hello_publisher adb ads in the samples directory Example code for an application that publishes the user data hello idl file hello_subscriber adb ads type You will need to modify the code to set and change the values being sent in the data structure Otherwise just in the samples directory compile and run The subscriberlistener file implements the hello idl file hello subscriberlistener adb ads on_data_available callback in the samples directory hello gpr Project files using Ada like syntax These files define the build related characteristics of the application These characteristics include the list of sources the location of those sources the location of the generated object files the name of the main program and the options for the various tools involved in the hello samples gpr in the samples directory build process Each of them is for a different set of files hello samples is for the examples hello_c is for the c files and hello is for rest of the ada files hello_c gpr 10 Customizing the Generated Code Customizing the Generated Code Code Generator allows you to customize the generated code for different languages by changing the provided templates This version does not allow you to create new output files You can load new templates using the fo
20. ssssestseseseseeeres 3 3 Generated E N EE EA E EE A E E E 8 4 Customizing the Generated Codeseira oire iisa iiei ieiki 11 5 Boosting Performance with Server Mode seesseeseessssseseesressosseseeoeeosessesseoseosessesseoscosessesseoneoseesrsssosseseesee 13 Using RTI Code Generator 1 Introduction RTI Code Generator creates the code needed to define and register a user data type with Connext DDS Using Code Generator is optional if LI You are using dynamic types see Managing Memory for Built in Types Section 3 2 7 in the RTI Connext DDS Core Libraries User s Manual I You are using one of the built in types see Built in Data Types Section 3 2 in the RTI Connext DDS Core Libraries User s Manual To use Code Generator you will need to provide a description of your data type s in an IDL or XML file You can define multiple data types in the same type definition file For details on these files see the RTI Connext DDS Core Libraries User s Manual Sections 3 3 and 3 4 1 1 Paths Mentioned in Documentation The documentation refers to J lt NDDSHOME gt This refers to the installation directory for Connext DDS The default installation paths are e Mac OS X systems Applications rti_connext_dds version e UNIX based systems non root user home your user name rti_connext_dds version e UNIX based systems root user opt rti_connext_dds version e Windows systems user without Administrator privileges
21. taReaderSuffix lt suffix gt Only applies if corba CORBA Client header file is also specified Assigns a suffix to the name of a DataReader interface By default the suffix is DataReader Therefore given the type Foo the name of the DataReader interface will be FooDataReader dataWriterSuffix lt suffix gt Only applies if corba CORBA Client header file is also specified Assigns a suffix to the name of a DataWriter interface By default the suffix is DataWriter Therefore given the type Foo the name of the DataWriter interface will be FooDataWriter enableEscapeChar Enables use of the escape character _ in IDL identifiers example lt architecture gt Generates type files example files and a makefile This is a shortcut for create typefiles create examplefiles create makefiles platform lt architecture gt Valid options for lt architecture gt are listed in the RTI Connext DDS Core Libraries Platform Notes or you can replace lt architecture gt with the string universal example universal to generate compatible publisher subscriber code for all supported platforms The universal architecture will not generate makefiles project files express Generates the C project files needed to build with Microsoft Visual Studio Express This option is only compatible with architectures i86Win32VS2008 and i86Win32VS2010 Newer versions of Microsoft Visual Studio Express Edition do not need th
22. tringSize are ignored This option also affects the way unbounded sequences are deserialized When a sequence is being received into a sample from the DataReader s cache the old memory for the sequence will be de allocated and memory of sufficient size to hold the deserialized data will be allocated When initially constructed sequences will not pre allocate any elements thus starting with a maximum of zero elements To use unboundedSupport you must also e Specify the language option as C CLI C C or C e Set the properties dds data_writer history memory_manager fast_pool pool_buffer_max_size on the DataWriter and dds data_reader history memory_manager fast_pool pool_buffer_max_size on the DataReader e Set the QoS reader_resource_limits dynamically_allocate_fragmented_samples on the DataReader to true update lt typefiles examplefiles makefiles gt Creates the files indicated if they do not exist Is the files already exist this overwrites the files without printing a warning There can be multiple update options If both create and update are specified for the same file type only the update will be applied use42eAlignment Makes the generated code compatible with RTI Data Distribution Service 4 2e This option should be used when compatibility with 4 2e is required and the topic data types contain double long long unsigned long long or long double members V lt name lt lt value gt
23. used for the publisher subscriber examples L module If we generate a file with that template for each module in the IDL file This is used in Ada where there are files that contain all the types of a module L topLevelType if we generate a file with that template for each type in the idl file This is used in ADA where the publisher subscriber files are only generated for top level types The table also shows the top_level variables that can be used for that templates These variables are explained in the sheet Template variables For example in Java the main unit of variables are the constructMap which is a hashMap of variables that represent a type In C we will have as the main unit the constructMapList that is a List of constructMap In the Template variables sheet we can see which variables are contained in each constructMap the constructKind or type that it is applicable to and the value that it contains depending on the language we use One important variable that contains the constructMap for a type is the memberFieldMapList This list represent the members contained within the type Each member is also represented as a hashMap whose variables are also described in the Template variables sheet Apart from that there are environmental or general variables that are not related with the types that are defined within a hashMap called envMap Let s see how to use these variables with an example Suppose we want to generate a method in

Download Pdf Manuals

image

Related Search

Related Contents

chariot motorise pour balle ronde modele r848  IEEE 802.11n 150Mbps In Wall Access Point SinoV-AP  Programmable Logic Controllers J  Wayne 352205-001 User's Manual  Zebra DS3478  Pilote Automatique TP32 dossier technique  OnTOP for Series 90-70 Online Troubleshooting and    

Copyright © All rights reserved.
Failed to retrieve file