|
The ArmarX shared memory provides unidirectional shared memory communication. Further, classes are provided which allow unidirectional communication which either uses Ice or shared memory dependent on whether a local or a remote connection is used.
The API documentation can be found here: SharedMemory
The simple shared memory mechanism provides mechanisms to share memory between a SharedMemoryProvider and a SharedMemoryConsumer. Both provider and consumer can be running in different processes in the same machine. The SharedMemoryProvider needs to be constructed before the SharedMemoryConsumer. Otherwise the SharedMemoryConsumer construction will fail.
Methods for synchronization are providing using either a scoped mechanism or lock / unlock methods.
The combined Ice and shared memory mechanism allows to exchange high amounts of data between two processes either via shared memory or using Ice. Whether Ice or shared memory transfer is used is selected automatically using the hardware id of the both machines involved in the communications. If the hardware ids of both sides are the same, shared memory transfer is used. Otherwise Ice transfer is used.
In general, the Provider needs to be started using start() before start() of the component can be called. The correct sequence is guaranteed when calling the constructors in onInitComponent() or equivalent and the start() methods in onConnectComponent(). The sequence is achieve making use of the components dependency mechanism.
A component that writes to the IceSharedMemory mechanism can be implemented in the following way:
In a similar manner, read access to the IceSharedMemory mechanism is provided: