us.ihmc.pubsub.impl.intraprocess.IntraProcessUtil Maven / Gradle / Ivy
package us.ihmc.pubsub.impl.intraprocess;
import com.eprosima.xmlschemas.fastrtps_profiles.DurabilityQosKindPolicyType;
import com.eprosima.xmlschemas.fastrtps_profiles.ReliabilityQosKindPolicyType;
import us.ihmc.pubsub.attributes.PublisherAttributes;
import us.ihmc.pubsub.attributes.SubscriberAttributes;
@Deprecated
public class IntraProcessUtil {
public static boolean subscriberPublisherMatches(SubscriberAttributes subscriberAttributes, PublisherAttributes publisherAttributes)
{
if (!subscriberAttributes.getTopicName().equals(publisherAttributes.getTopicName()))
return false;
if (!subscriberAttributes.getTopicDataType().getClass().equals(publisherAttributes.getTopicDataType().getClass()))
return false;
if (subscriberAttributes.getOwnerShipPolicyKind() != publisherAttributes.getOwnerShipPolicyKind())
return false;
if (publisherAttributes.getReliabilityKind() == ReliabilityQosKindPolicyType.BEST_EFFORT && subscriberAttributes.getReliabilityKind() == ReliabilityQosKindPolicyType.RELIABLE)
return false;
if (publisherAttributes.getDurabilityKind() == DurabilityQosKindPolicyType.TRANSIENT_LOCAL
&& subscriberAttributes.getDurabilityKind() == DurabilityQosKindPolicyType.VOLATILE)
return false;
if (subscriberAttributes.getPartitions().isEmpty() && publisherAttributes.getPartitions().isEmpty())
{
return true;
}
else
{
for (String partition : subscriberAttributes.getPartitions())
{
for (String subPartition : publisherAttributes.getPartitions())
{
if (partition.equals(subPartition))
{
return true;
}
}
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy