OpenSplice ISO C++ 2 DCPS  v7.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org::opensplice::core::policy::Share Class Reference

QoS Policy to share a DataReader between multiple processes. More...

#include "ProprietaryApi.hpp"

Inheritance diagram for org::opensplice::core::policy::Share:
Inheritance graph

Public Member Functions

 Share ()
 
 Share (const std::string &name, bool enable)
 
 Share (const Share &other)
 
Shareenable (bool enable)
 
bool enable () const
 
Sharename (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Share() [1/3]

org::opensplice::core::policy::Share::Share ( )

Creates a Share QoS Policy instance

◆ Share() [2/3]

org::opensplice::core::policy::Share::Share ( const std::string &  name,
bool  enable 
)

Creates a Share QoS Policy instance

Parameters
namethe name
enablestate

◆ Share() [3/3]

org::opensplice::core::policy::Share::Share ( const Share other)

Copies a Share QoS Policy instance

Parameters
otherthe Share QoS Policy instance to copy

Member Function Documentation

◆ enable() [1/2]

Share& org::opensplice::core::policy::Share::enable ( bool  enable)

Sets enable state

Parameters
enablestate

◆ enable() [2/2]

bool org::opensplice::core::policy::Share::enable ( ) const

Gets enable state

Returns
enable state

◆ name() [1/2]

Share& org::opensplice::core::policy::Share::name ( const std::string &  name)

Sets the name

Parameters
namethe name

◆ name() [2/2]

std::string org::opensplice::core::policy::Share::name ( ) const

Gets the name

Returns
the name

◆ operator!=()

template<typename D >
bool dds::core::Value< D >::operator!= ( const Value< D > &  other) const
inherited

Compare this Value with another Value

Parameters
otherValue
Returns
true if not equal

Definition at line 99 of file Value.hpp.

◆ operator->() [1/2]

template<typename D >
D * dds::core::Value< D >::operator-> ( )
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:

my_dds_value.standard_function();
my_dds_value->vendor_specific_extension();
Returns
a reference to delegate.

Definition at line 111 of file Value.hpp.

◆ operator->() [2/2]

template<typename D >
const D * dds::core::Value< D >::operator-> ( ) const
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:

my_dds_value.standard_function();
my_dds_value->vendor_specific_extension();
Returns
a reference to delegate.

Definition at line 105 of file Value.hpp.

◆ operator==()

template<typename D >
bool dds::core::Value< D >::operator== ( const Value< D > &  other) const
inherited

Compare this Value with another Value

Parameters
otherValue
Returns
true if equal

Definition at line 93 of file Value.hpp.


The documentation for this class was generated from the following file: