This section describes Tester features for Google Protocol Buffers.
In versions of Vortex OpenSplice that support Google Protocol Buffers, Tester is able to read from protocol buffer topics and display its samples as regular field name and value pairs, just as if it were from a regular IDL-defined topic.
The Tester feature for Google Protocol Buffer topic reading is enabled only on Vortex OpenSplice middleware installs where Google Protocol Buffer support is included. For installations where it is not included, the feature is disabled in Tester.
The main feature of using Google Protocol Buffers as the type definition for a topic is the ability to change, or ‘evolve’, a topic’s type. Tester can become aware of changes to a protocol buffer topic’s type, and can display the topic type definition for each type evolution that is registered.
To view the type evolutions for a protocol buffer topic, right-click the topic in the Topics tab, and select View Topic Type from the pop-up menu.
View Topic Type from the Topics list
Upon selection of the menu item, the View Topic Type window will appear for the selected topic. By default, it shows the type name for the topic and the DDS type definition. If the topic is a protocol buffer topic, it will display additional information:
View Topic Type window for a protocol buffer topic
Proto Typedef with external definitions
Tester reads protocol buffer data by reading in the byte sequence data contained in the user data, and then replacing all fields with regular field name and value pairs just as if it were data from a regular topic. The process for creating readers for protocol buffer topics is almost identical to the process described in Section 3.3.3, To Add a Reader from the Topic list, on page 24.
Add Reader dialog with type evolution chooser
It is possible to declare which type evolution to read protocol buffer topics as, via the Reader script command (defined in Section 5.2.15, Reader, on page 83). The topicname parameter for the reader command can be modified with a type evolution’s type hash to specify which type evolution view protocol buffer user data as. The type hash can be viewed and copied from the View Topic Type window (see Section 7.2.1 on page 96).
To create a default reader with the most recently-registered type evolution, the command is:
reader(Person);
To create a reader with a specific type evolution, the command is the same, but with the type hash pasted in after the topic name, separated by a ‘#’:
reader(Person#73979410269545042249851605221960719319);
Editing samples from protocol buffer topics is the same as samples from a regular topic. Protobuf fields can be declared as optional or required, so to reflect that in the Sample Edit window (see Section 3.4.1.1, To Write Sample Topic data, on page 28), a Cyan color highlight is added to required protocol buffer fields. In all other senses, though, editing samples in either the Sample Edit window or in scripting is precisely the same as it is for normal topics.
The Sample Edit Window for a protocol buffer sample