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

net.sf.jrtps.message.parameter.LocatorParameter 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;
import net.sf.jrtps.types.Locator;

public abstract class LocatorParameter extends Parameter {
    private Locator locator;

    /**
     * 
     * @param pe
     *            Must be one to define a locator. No check is made.
     */
    protected LocatorParameter(ParameterId pe) {
        super(pe);
    }

    /**
     * 
     * @param pe
     *            Must be one to define a locator. No check is made.
     */
    protected LocatorParameter(ParameterId pe, Locator locator) {
        super(pe);
        this.locator = locator;
    }

    @Override
    public void read(RTPSByteBuffer bb, int length) {
        this.locator = new Locator(bb);
    }

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

    public Locator getLocator() {
        return locator;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy