This article contains some API/IDL-related, submitted OpenSplice questions that may prove useful to others.
See the OpenSplice documentation for more information.
Is the OpenSplice DDS Java API Operating System independent?
All the OpenSplice API’s are Operating System independent as the source code is provided, allowing you to recompile with your preferred compiler. An additional advantage of Java applications is that these applications do not need to be recompiled to run on different operating systems (following the Java slogan ‘write once, run anywhere’). For optimal performance and minimal footprint, the OpenSplice core modules are implemented in C and the application API’s (for C, C++ and Java) are plugable extensions to allow the use of the various programming languages. This gives two advantages. The first is that there is extremely low overhead for Java, for example. Running the “ping pong” benchmark, provided in the distribution, shows that the peer-to-peer latency between a Java-based writer and reader is only slightly slower slower than a C-based writer and reader (65 microseconds versus 57 microseconds on a 2GHz Windows notebook). The second is that one ‘instance’ of OpenSplice can serve multiple applications written in multiple programming languages, thus reducing the footprint on a computing node considerably.
What are the differences between the DDS language compilation processes?
For JAVA, the process is OS-independent that is, just invoke the javac compiler and run the applications.
For C/C++/C#, the compilation process differs a little bit between windows and Unix (Solaris and/or Linux). The main difference is that for UNIX platforms, we typically use the gcc compiler-suite (C-preprocessor, Compiler, Linker) and make utility whereas for Windows we use the Microsoft Visual Studio compiler and linker. Please note that for preprocessing the IDL data-structures, the C-preprocessor is required (gcc for Unix, cl for Windows).
Does OpenSplice support Unicode strings?
Unfortunately not. Adding this support would require significant development and is not currently planned. As a workaround we suggest that you encode your string as an octet sequence and provide handling logic at application level. This approach obviously has some drawbacks as you will not be able to make use of the filtering features of OpenSplice.
How is change counting calculated?
The standard and the OpenSplice documentation both state that the value returned from current_count_change() is
“The change in current_count since the last time the listener was called or the status was read.”
In OpenSplice this is always a positive number even if readers are removed unlike some other DDS implementations that output a negative value. This is also the case in other counting methods such as for the livelinessChangedStatus, “alive_count_change”.
How can I create a datetime field in a DDS Topic?
The OpenSplice IDL Pre-processor and the OpenSplice runtime system support the following DDS data types to be used in application IDL definitions:
- Duration_t
- Time_t
More information on Build-In IDL preprocessor types can be found in the OpenSplice IDL Pre-Processor guide – see the OpenSplice documentation.
Can I use String and Sequence data types in my IDL file?
All data distributed using the DDS has to be defined as a topic. A topic is a structured data type, like a C++-struct with several members. Whenever the application needs to read or write data, it will be reading or writing topics. The definition of each topic it will be using has to be written in (a subset of) OMG IDL.
The Data Distribution Service is capable of distributing more complex topics as well. In fact, any definition following the OpenSplice IDL subset is allowed. It is important to know that the preprocessor accepts all IDL constructs but only the subset is being processed. Apart from the trivial data types, the Data Distribution Service is capable of handling fixed-length arrays, bounded and unbounded sequences, union types and enumerations. Types can be nested, e.g. a struct can contain a struct field or an array of structs, or a sequence of strings or an array of sequences containing structs.
The Ping/Pong example program also uses an IDL with both Strings and Sequences use throughout. Our documentation for use of IDL within DDS is very verbose see the OpenSplice IDL Preprocessor User Manual for more information. This is part of the OpenSplice documentation.
Can I a struct as an IDL keylist in OpenSplice?
While it’s not possible to use a struct itself as a keylist it is possible to use the contents of a struct as follows:
module KeyedTypeData
module KeyedTypeData
{
struct FirstKeyedType {
long member1;
long member2;
};
#pragma keylist FirstKeyedType member1
struct SecondKeyedType {
FirstKeyedType myKey;
};
#pragma keylist SecondKeyedType myKey.member1 myKey.member2
};
This will allow you to use the contents of the struct FirstKeyedType as the keylist for SecondKeyedType