Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IgnoreLocal reader, writer QoS setting #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ddscxx/include/dds/core/policy/CorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ TypeConsistencyEnforcement;
typedef dds::core::policy::detail::PSMXInstances
PSMXInstances;

typedef dds::core::policy::detail::IgnoreLocal
IgnoreLocal;

typedef dds::core::policy::detail::UserData
UserData;

Expand Down Expand Up @@ -199,6 +202,7 @@ OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24)
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
OMG_DDS_POLICY_TRAITS(WriterBatching, 25)
OMG_DDS_POLICY_TRAITS(PSMXInstances, 34)
OMG_DDS_POLICY_TRAITS(IgnoreLocal, 35)

}
}
Expand Down
11 changes: 11 additions & 0 deletions src/ddscxx/include/dds/core/policy/PolicyKind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ struct TypeConsistencyKind_def

typedef dds::core::safe_enum<TypeConsistencyKind_def> TypeConsistencyKind;

struct IgnoreLocalKind_def
{
enum Type
{
NONE,
PARTICIPANT,
PROCESS
};
};
typedef dds::core::safe_enum<IgnoreLocalKind_def> IgnoreLocalKind;

}
}
}
Expand Down
67 changes: 67 additions & 0 deletions src/ddscxx/include/dds/core/policy/TCorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,73 @@ class TPSMXInstances : public dds::core::Value<D>
const dds::core::StringSeq instances() const;
};

//==============================================================================

/**
* \copydoc DCPS_QoS_Durability
*/
template <typename D>
class TIgnoreLocal : public dds::core::Value<D>
{
public:
/**
* Creates a IgnoreLocal QoS instance
*
* @param kind the kind
*/
explicit TIgnoreLocal(
dds::core::policy::IgnoreLocalKind::Type kind = dds::core::policy::IgnoreLocalKind::NONE);

/**
* Copies a IgnoreLocal QoS instance
*
* @param other the IgnoreLocal QoS instance to copy
*/
TIgnoreLocal(const TIgnoreLocal& other);

/**
* Copies a IgnoreLocal QoS instance
*
* @param other the IgnoreLocal QoS instance to copy
*
* @return reference to the IgnoreLocal QoS that was copied to
*/
TIgnoreLocal& operator=(const TIgnoreLocal& other) = default;

public:
/**
* Set the kind
*
* @param kind the kind to set
*
* @return the kind that was set
*/
TIgnoreLocal& kind(dds::core::policy::IgnoreLocalKind::Type kind);

/**
* Get the kind
*
* @return the kind
*/
dds::core::policy::IgnoreLocalKind::Type kind() const;

public:
/**
* @return a IgnoreLocal QoS instance with the kind set to NONE
*/
static TIgnoreLocal None();

/**
* @return a IgnoreLocal QoS instance with the kind set to PARTICIPANT
*/
static TIgnoreLocal Participant();

/**
* @return a IgnoreLocal QoS instance with the kind set to PROCESS
*/
static TIgnoreLocal Process();
};

}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ namespace dds { namespace core { namespace policy { namespace detail {

typedef dds::core::policy::TWriterBatching<org::eclipse::cyclonedds::core::policy::WriterBatchingDelegate>
WriterBatching;

typedef dds::core::policy::TIgnoreLocal<org::eclipse::cyclonedds::core::policy::IgnoreLocalDelegate>
IgnoreLocal;
} } } } // namespace dds::core::policy::detail


Expand Down
39 changes: 39 additions & 0 deletions src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,45 @@ const dds::core::StringSeq TPSMXInstances<D>::instances() const
return this->delegate().instances();
}

//TIgnoreLocal

template <typename D>
TIgnoreLocal<D>::TIgnoreLocal(dds::core::policy::IgnoreLocalKind::Type kind) : dds::core::Value<D>(kind) { }

template <typename D>
TIgnoreLocal<D>::TIgnoreLocal(const TIgnoreLocal& other) : dds::core::Value<D>(other.delegate()) { }

template <typename D>
TIgnoreLocal<D>& TIgnoreLocal<D>::kind(dds::core::policy::IgnoreLocalKind::Type kind)
{
this->delegate().kind(kind);
return *this;
}

template <typename D>
dds::core::policy::IgnoreLocalKind::Type TIgnoreLocal<D>::kind() const
{
return this->delegate().kind();
}

template <typename D>
TIgnoreLocal<D> TIgnoreLocal<D>::None()
{
return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::NONE);
}

template <typename D>
TIgnoreLocal<D> TIgnoreLocal<D>::Participant()
{
return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::PARTICIPANT);
}

template <typename D>
TIgnoreLocal<D> TIgnoreLocal<D>::Process()
{
return TIgnoreLocal(dds::core::policy::IgnoreLocalKind::PROCESS);
}

}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/ddscxx/include/dds/pub/qos/detail/DataWriterQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1)
* dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION
* dds::core::policy::WriterBatching | Writer data batching | dds::core::policy::WriterBatching::DoNotBatchUpdates()
* dds::core::policy::IgnoreLocal | Ignore local readers | dds::core::policy::IgnoreLocal::None()
*
* A QosPolicy can be set when the DataWriter is created or modified with the set
* qos operation.
Expand Down
1 change: 1 addition & 0 deletions src/ddscxx/include/dds/sub/qos/detail/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* dds::core::policy::ReaderDataLifecycle | Instance state changes and notifications (@ref DCPS_QoS_ReaderDataLifecycle "info") | ReaderDataLifecycle::NoAutoPurgeDisposedSamples()
* dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1)
* dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION
* dds::core::policy::IgnoreLocal | Ignore local readers | dds::core::policy::IgnoreLocal::None()
*
* A QosPolicy can be set when the DataReader is created or modified with the set
* qos operation.
Expand Down
28 changes: 28 additions & 0 deletions src/ddscxx/include/org/eclipse/cyclonedds/core/policy/Policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@
static const std::string& name(); \
};

namespace org
{
namespace eclipse
{
namespace cyclonedds
{
namespace core
{
namespace policy
{
template <typename Policy>
class policy_id;
template <typename Policy>
class policy_name;

/*
* Proprietary policies values
*/
typedef dds::core::policy::TIgnoreLocal<org::eclipse::cyclonedds::core::policy::IgnoreLocalDelegate> IgnoreLocal;

}
}
}
}
}


namespace dds
{
namespace core
Expand All @@ -49,6 +76,7 @@ template <typename Policy>
class policy_id;
template <typename Policy>
class policy_name;

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,31 @@ class OMG_DDS_API WriterBatchingDelegate
bool batch_updates_;
};

//==============================================================================

class OMG_DDS_API IgnoreLocalDelegate
{
public:
IgnoreLocalDelegate(const IgnoreLocalDelegate& other);
explicit IgnoreLocalDelegate(dds::core::policy::IgnoreLocalKind::Type kind);

IgnoreLocalDelegate& operator=(const IgnoreLocalDelegate& other) = default;

void kind(dds::core::policy::IgnoreLocalKind::Type kind);
dds::core::policy::IgnoreLocalKind::Type kind() const;

bool operator ==(const IgnoreLocalDelegate& other) const;

void check() const;

void set_iso_policy(const dds_qos_t* qos);
void set_c_policy(dds_qos_t* qos) const;

public:
dds::core::policy::IgnoreLocalKind::Type kind_;
};

//==============================================================================

#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class OMG_DDS_API DataWriterQosDelegate
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
void policy(const dds::core::policy::WriterBatching& writerbatching);
void policy(const dds::core::policy::PSMXInstances& psmxinstances);
void policy(const dds::core::policy::IgnoreLocal& ignorelocal);

template <typename POLICY> const POLICY& policy() const;
template <typename POLICY> POLICY& policy();
Expand Down Expand Up @@ -106,6 +107,7 @@ class OMG_DDS_API DataWriterQosDelegate
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
dds::core::policy::WriterBatching writerbatching_;
dds::core::policy::PSMXInstances psmxinstances_;
dds::core::policy::IgnoreLocal ignorelocal_;
};


Expand Down Expand Up @@ -294,6 +296,16 @@ DataWriterQosDelegate::policy<dds::core::policy::PSMXInstances>() const
return psmxinstances_;
}

template<> inline const dds::core::policy::IgnoreLocal&
DataWriterQosDelegate::policy<dds::core::policy::IgnoreLocal>() const
{
return ignorelocal_;
}

template<> OMG_DDS_API dds::core::policy::IgnoreLocal&
DataWriterQosDelegate::policy<dds::core::policy::IgnoreLocal>();


}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OMG_DDS_API DataReaderQosDelegate
void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement);
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
void policy(const dds::core::policy::PSMXInstances& psmxinstances);
void policy(const dds::core::policy::IgnoreLocal& ignorelocal);

template <typename POLICY> const POLICY& policy() const;
template <typename POLICY> POLICY& policy();
Expand Down Expand Up @@ -90,6 +91,7 @@ class OMG_DDS_API DataReaderQosDelegate
dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_;
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
dds::core::policy::PSMXInstances psmxinstances_;
dds::core::policy::IgnoreLocal ignorelocal_;
};


Expand Down Expand Up @@ -251,6 +253,19 @@ DataReaderQosDelegate::policy<dds::core::policy::PSMXInstances>() const
return psmxinstances_;
}


template<>
inline const dds::core::policy::IgnoreLocal&
DataReaderQosDelegate::policy<dds::core::policy::IgnoreLocal>() const
{
return ignorelocal_;
}

template<>
OMG_DDS_API dds::core::policy::IgnoreLocal&
DataReaderQosDelegate::policy<dds::core::policy::IgnoreLocal>();


}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/ddscxx/src/dds/core/policy/CorePolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::DurabilityService, DurabilityS
#endif // OMG_DDS_PERSISTENCE_SUPPORT
OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::WriterBatching, WriterBatching)
OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::PSMXInstances, PSMXInstances)
OMG_DDS_DEFINE_POLICY_TRAITS(dds::core::policy::IgnoreLocal, IgnoreLocal)
Loading
Loading