![]() |
OpenSplice ISO C++ 2 DCPS
v7.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
|
QoS Policy to share a DataReader between multiple processes. More...
#include "ProprietaryApi.hpp"
Public Member Functions | |
Share () | |
Share (const std::string &name, bool enable) | |
Share (const Share &other) | |
Share & | enable (bool enable) |
bool | enable () const |
Share & | name (const std::string &name) |
std::string | name () const |
bool | operator!= (const Value &other) const |
D * | operator-> () |
const D * | operator-> () const |
bool | operator== (const Value &other) const |
QoS Policy to share a DataReader between multiple processes.
This QosPolicy allows sharing of entities by multiple processes or threads. When the policy is enabled, the data distribution service will try to look up an existing entity that matches the name supplied in the Share QosPolicy. A new entity will only be created if a shared entity registered under the specified name doesn’t exist yet.
Shared Readers can be useful for implementing algorithms like the worker pattern, where a single shared reader can contain samples representing different tasks that may be processed in parallel by separate processes. In this algorithm each processes consumes the task it is going to perform (i.e. it takes the sample representing that task), thus preventing other processes from consuming and therefore performing the same task.
Entities can only be shared between processes if OpenSplice is running in federated mode, because it requires shared memory to communicate between the different processes.
By default, the Share QosPolicy is not used and enable is FALSE. Name must be set to a valid string for the Share QosPolicy to be valid when enable is set to TRUE. This QosPolicy is applicable to DataReader and Subscriber entities, and cannot be modified after the DataReader or Subscriber is enabled. Note that a DataReader can only be shared if its Subscriber is also shared.
Definition at line 723 of file ProprietaryApi.hpp.
org::opensplice::core::policy::Share::Share | ( | ) |
Creates a Share QoS Policy instance
org::opensplice::core::policy::Share::Share | ( | const std::string & | name, |
bool | enable | ||
) |
Creates a Share QoS Policy instance
name | the name |
enable | state |
org::opensplice::core::policy::Share::Share | ( | const Share & | other | ) |
Share& org::opensplice::core::policy::Share::enable | ( | bool | enable | ) |
Sets enable state
enable | state |
bool org::opensplice::core::policy::Share::enable | ( | ) | const |
Gets enable state
Share& org::opensplice::core::policy::Share::name | ( | const std::string & | name | ) |
Sets the name
name | the name |
std::string org::opensplice::core::policy::Share::name | ( | ) | const |
Gets the name
|
inherited |
|
inherited |
The operator->() is provided to be able to directly invoke functions on the delegate.
The decision to provide direct access to the delegate was motivated by the need for providing a way that was not invasive with respect to the CXXDDS API and yet would allow for vendor-specific extension. Thus vendor-specific extensions can be invoked on the Value and on all its subclasses as follows:
|
inherited |
The operator->() is provided to be able to directly invoke functions on the delegate.
The decision to provide direct access to the delegate was motivated by the need for providing a way that was not invasive with respect to the CXXDDS API and yet would allow for vendor-specific extension. Thus vendor-specific extensions can be invoked on the Value and on all its subclasses as follows:
|
inherited |