OpenSplice examples - BuiltInTopics

# EXAMPLES

- Summary
- PingPong
- Tutorial
- HelloWorld
- WaitSet
- Listener
- ContentFilteredTopic
- QueryCondition
- Lifecycle
- Durability
- Ownership
- BuiltInTopics
- NetworkPartitions
- RoundTrip
- Throughput

## BuiltInTopics

- Running of examples in Standalone Mode

### 1) Description

The BuiltInTopics example is used to illustrate the use of built-in topics. This application monitors the number of nodes that participate in a DDS domain.

### 2) Design

It consists of 3 units :

- CheckStatus : provides return status checking
- DDSEntityManager : implements a class providing operations to set up DCPS entities (creation, deletion)
- BuiltInTopicsSubscriber : implements the subscriber's main (uses DDSEntityManager)

### 3) Scenario

When it receives the built-in sample, the subscriber displays the number of nodes running and the host name of each node .

## Running of examples in Standalone Mode

- Running examples in Posix
- Running examples in Visual Studio

### Running the examples in a Posix environment

#### Environment Setup

Let's call OpenSplice_install_dir the OpenSplice installation directory.

The OpenSplice environment variables must be set in order for the examples to build/run correctly. To do this, open a terminal and source the "OpenSplice_install_dir/release.com" script supplied with the distribution.

- C/C++ Examples
- Java/Java5 examples
- ISO C++ 2 examples

#### C and C++ Executables

Building the examples is described on the Summary page>

One executable is generated in the standalone directory when the example is built:

For C++

- sacpp_builtintopics_sub

For C

- sac_builtintopics_sub

#### Java executables

Building the examples is described on the Summary page

One jar is generated in the standalone or java5 directory when the example is built:

For java

- saj_builtintopics_sub.jar

For java5

- java5_BuiltInTopics.jar

#### ISO C++ 2 executables

Building the examples is described on the Summary page

One executable is generated in the isocpp2 directory when the example is built:

- subscriber

#### Running the example

Ensure that the environment for OpenSplice is set up correctly as described above for each new terminal used.

Running in single process (heap memory) configuration : the application starts OpenSplice middleware

- OpenSplice is deployed in this mode by default.
- The OpenSplice daemon should not be started manually. Instead the OpenSplice middleware and optional services are implicitly started by the single process applications as required
- Open a terminal. Set up the environment and go to example directory as described above

Running in multiple process shared memory configuration

To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir/etc/config directory.

- Open a terminal
- Setup the environment and go to the example directory as described above
- Set the required configuraton file e.g. OSPL_URI=file://$OSPL_HOME/etc/config/ospl_shmem_ddsi.xml
- Start the OpenSplice daemon. You can do this by typing ospl start

Starting the subscriber

- In the terminal start the subscriber by running either
  - sac_builtintopics_sub for C
  - sacpp_builtintopics_sub for C++
  - java -jar saj_builtintopics_sub.jar for Java
  - java -jar java5_BuiltInTopics.jar for Java5
  - subscriber for ISO C++ 2

### Running C/C++/C#/Java/ISO C++ 2 examples on Windows

#### Environment Setup

Let's call OpenSplice_install_dir the OpenSplice installation directory.

The OpenSplice environment variables must be set in order for the examples to run correctly. To do this open an OpenSplice Command Prompt which will set up the environment variables for OpenSplice automatically. The OpenSplice Command Prompt can be selected from the start menu. Alternatively, open a windows Command Prompt and execute the "OpenSplice_install_dir\release.bat" batch script supplied with the distribution.

- C/C++/C# Examples
- Java examples
- ISO C++ 2 examples

#### C/C++/C# Executables

Building the examples is described on the Summary page

One executable is generated in the standalone directory when the example is built:

For C

- sac_builtintopics_sub.exe

For C++

- sacpp_builtintopics_sub.exe

For C#

- sacs_builtintopics_sub.exe

#### Java Executables

Building the examples is described on the Summary page

One jar is generated in the java\standalone or java5 directory when the example is built:

For java

- saj_builtintopics_sub.jar

For java5

- java5_BuiltInTopics.jar

#### ISO C++ 2 executables

Building the examples is described on the Summary page

One executable is generated in the isocpp2 directory when the example is built:

- subscriber

#### Running the C/C++/C#/Java/ISO C++ 2 Examples

Ensure that the environment for OpenSplice is set up correctly as described above for each new command prompt used.

The following steps describe how to run the examples:

Running in single process (heap memory) configuration : the application starts OpenSplice middleware

- OpenSplice is deployed in this mode by default.
- The OpenSplice daemon should not be started manually. Instead the OpenSplice middleware and optional services are implicitly started by the single process applications as required
- Open an OpenSplice Command Prompt and go to the example directory as described above

Running in multiple process shared memory configuration

To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir\etc\config directory.

- Open an OpenSplice Command Prompt
- Go to the example directory as described above
- Set the required configuration file e.g. set OSPL_URI=file://%OSPL_HOME%\etc\config\ospl_shmem_ddsi.xml
- Start the OpenSplice daemon. You can do this by typing ospl start

Starting the subscriber

- In the command prompt start the subscriber by running either
  - sac_builtintopics_sub for C
  - sacpp_builtintopics_sub for C++
  - sacs_builtintopics_sub for C#
  - java -jar saj_builtintopics_sub.jar for Java
  - java -jar java5_BuiltInTopics.jar for Java5
  - subscriber for isocpp2