All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jrtps.message.parameter.QosOwnershipStrength Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
package net.sf.jrtps.message.parameter;

import net.sf.jrtps.transport.RTPSByteBuffer;

public class QosOwnershipStrength extends Parameter implements DataWriterPolicy, InlineQoS {
    private int strength;

    QosOwnershipStrength() {
        super(ParameterEnum.PID_OWNERSHIP_STRENGTH);
    }

    /**
     * Constructor
     * 
     * @param strength
     */
    public QosOwnershipStrength(int strength) {
        super(ParameterEnum.PID_OWNERSHIP_STRENGTH);
        this.strength = strength;
    }

    /**
     * Get the strength.
     * 
     * @return strength
     */
    public int getStrength() {
        return strength;
    }

    @Override
    public void read(RTPSByteBuffer bb, int length) {
        strength = bb.read_long();
    }

    @Override
    public void writeTo(RTPSByteBuffer bb) {
        bb.write_long(strength);
    }

    @Override
    public boolean isCompatible(QosOwnershipStrength other) {
        return true; // Always true
    }

    /**
     * Get the default QosOwnershipStrength: 0
     * 
     * @return default QosOwnershipStrength
     */
    public static QosOwnershipStrength defaultOwnershipStrength() {
        return new QosOwnershipStrength(0);
    }

    public String toString() {
        return super.toString() + "(" + strength + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy