add QoS to ignore local readers/writers (#78)
Adds a new "ignorelocal" QoS to the readers/writers to ignore local matching readers/writers, with three settings: * DDS_IGNORELOCAL_NONE: default * DDS_IGNORELOCAL_PARTICIPANT: ignores readers/writers in the same participant * DDS_IGNORELOCAL_PROCESS: ignores readers/writers in the same process These can be set/got using dds_qset_ignorelocal and dds_qget_ignorelocal. If a matching reader or writer is ignored because of this setting, it is as-if that reader or writer doesn't exist. No traffic will be generated or data retained on its behalf. There are no consequences for interoperability as this is (by definition) a local affair. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
6e2068173a
commit
14148aceb5
5 changed files with 103 additions and 0 deletions
|
@ -136,6 +136,16 @@ typedef enum dds_presentation_access_scope_kind
|
|||
}
|
||||
dds_presentation_access_scope_kind_t;
|
||||
|
||||
/** Ignore-local QoS: Applies to DataReader, DataWriter */
|
||||
typedef enum dds_ignorelocal_kind
|
||||
{
|
||||
DDS_IGNORELOCAL_NONE,
|
||||
DDS_IGNORELOCAL_PARTICIPANT,
|
||||
DDS_IGNORELOCAL_PROCESS
|
||||
}
|
||||
dds_ignorelocal_kind_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allocate memory and initialize default QoS-policies
|
||||
*
|
||||
|
@ -465,6 +475,16 @@ dds_qset_durability_service (
|
|||
int32_t max_instances,
|
||||
int32_t max_samples_per_instance);
|
||||
|
||||
/**
|
||||
* @brief Set the ignore-local policy of a qos structure
|
||||
*
|
||||
* @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy
|
||||
* @param[in] ignore - True if readers and writers owned by the same participant should be ignored
|
||||
*/
|
||||
DDS_EXPORT void dds_qset_ignorelocal (
|
||||
dds_qos_t * __restrict qos,
|
||||
dds_ignorelocal_kind_t ignore);
|
||||
|
||||
/**
|
||||
* @brief Get the userdata from a qos structure
|
||||
*
|
||||
|
@ -753,6 +773,19 @@ dds_qget_durability_service (
|
|||
int32_t *max_instances,
|
||||
int32_t *max_samples_per_instance);
|
||||
|
||||
/**
|
||||
* @brief Get the ignore-local qos policy
|
||||
*
|
||||
* @param[in] qos - Pointer to a dds_qos_t structure storing the policy
|
||||
* @param[in,out] ignore - Pointer that will store whether to ignore readers/writers owned by the same participant (optional)
|
||||
*
|
||||
* @returns - false iff any of the arguments is invalid or the qos is not present in the qos object
|
||||
*/
|
||||
DDS_EXPORT bool
|
||||
dds_qget_ignorelocal (
|
||||
const dds_qos_t * __restrict qos,
|
||||
dds_ignorelocal_kind_t *ignore);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -658,6 +658,16 @@ void dds_qset_durability_service
|
|||
}
|
||||
}
|
||||
|
||||
void dds_qset_ignorelocal (dds_qos_t * __restrict qos, dds_ignorelocal_kind_t ignore)
|
||||
{
|
||||
if (qos) {
|
||||
qos->ignorelocal.value = (nn_ignorelocal_kind_t) ignore;
|
||||
qos->present |= QP_CYCLONE_IGNORELOCAL;
|
||||
} else {
|
||||
DDS_ERROR("Argument QoS is NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool dds_qget_userdata (const dds_qos_t * __restrict qos, void **value, size_t *sz)
|
||||
{
|
||||
if (!qos || !(qos->present & QP_USER_DATA)) {
|
||||
|
@ -931,3 +941,14 @@ bool dds_qget_durability_service (const dds_qos_t * __restrict qos, dds_duration
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dds_qget_ignorelocal (const dds_qos_t * __restrict qos, dds_ignorelocal_kind_t *ignore)
|
||||
{
|
||||
if (!qos || !(qos->present & QP_CYCLONE_IGNORELOCAL)) {
|
||||
return false;
|
||||
}
|
||||
if (ignore) {
|
||||
*ignore = (dds_ignorelocal_kind_t) qos->ignorelocal.value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue