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

b3.entrypoint.fixp.sbe.OrderCancelRequestDecoder Maven / Gradle / Ivy

There is a newer version: 0.157
Show newest version
/* Generated SBE (Simple Binary Encoding) message codec. */
package b3.entrypoint.fixp.sbe;

import org.agrona.DirectBuffer;
import org.agrona.sbe.*;


/**
 * OrderCancelRequest message submits a deletion of an existing order by referencing the original client order id.
 */
@SuppressWarnings("all")
public final class OrderCancelRequestDecoder implements MessageDecoderFlyweight
{
    public static final int BLOCK_LENGTH = 37;
    public static final int TEMPLATE_ID = 105;
    public static final int SCHEMA_ID = 1;
    public static final int SCHEMA_VERSION = 5;
    public static final String SEMANTIC_VERSION = "5.6";
    public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;

    private final OrderCancelRequestDecoder parentMessage = this;
    private DirectBuffer buffer;
    private int offset;
    private int limit;
    int actingBlockLength;
    int actingVersion;

    public int sbeBlockLength()
    {
        return BLOCK_LENGTH;
    }

    public int sbeTemplateId()
    {
        return TEMPLATE_ID;
    }

    public int sbeSchemaId()
    {
        return SCHEMA_ID;
    }

    public int sbeSchemaVersion()
    {
        return SCHEMA_VERSION;
    }

    public String sbeSemanticType()
    {
        return "";
    }

    public DirectBuffer buffer()
    {
        return buffer;
    }

    public int offset()
    {
        return offset;
    }

    public OrderCancelRequestDecoder wrap(
        final DirectBuffer buffer,
        final int offset,
        final int actingBlockLength,
        final int actingVersion)
    {
        if (buffer != this.buffer)
        {
            this.buffer = buffer;
        }
        this.offset = offset;
        this.actingBlockLength = actingBlockLength;
        this.actingVersion = actingVersion;
        limit(offset + actingBlockLength);

        return this;
    }

    public OrderCancelRequestDecoder wrapAndApplyHeader(
        final DirectBuffer buffer,
        final int offset,
        final MessageHeaderDecoder headerDecoder)
    {
        headerDecoder.wrap(buffer, offset);

        final int templateId = headerDecoder.templateId();
        if (TEMPLATE_ID != templateId)
        {
            throw new IllegalStateException("Invalid TEMPLATE_ID: " + templateId);
        }

        return wrap(
            buffer,
            offset + MessageHeaderDecoder.ENCODED_LENGTH,
            headerDecoder.blockLength(),
            headerDecoder.version());
    }

    public OrderCancelRequestDecoder sbeRewind()
    {
        return wrap(buffer, offset, actingBlockLength, actingVersion);
    }

    public int sbeDecodedLength()
    {
        final int currentLimit = limit();
        sbeSkip();
        final int decodedLength = encodedLength();
        limit(currentLimit);

        return decodedLength;
    }

    public int actingVersion()
    {
        return actingVersion;
    }

    public int encodedLength()
    {
        return limit - offset;
    }

    public int limit()
    {
        return limit;
    }

    public void limit(final int limit)
    {
        this.limit = limit;
    }

    public static int messageTypeId()
    {
        return 35;
    }

    public static int messageTypeSinceVersion()
    {
        return 0;
    }

    public static int messageTypeEncodingOffset()
    {
        return 0;
    }

    public static int messageTypeEncodingLength()
    {
        return 1;
    }

    public static String messageTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "constant";
        }

        return "";
    }

    public short messageTypeRaw()
    {
        return MessageType.OrderCancelRequest.value();
    }


    public MessageType messageType()
    {
        return MessageType.OrderCancelRequest;
    }


    public static int origClOrdIDId()
    {
        return 41;
    }

    public static int origClOrdIDSinceVersion()
    {
        return 0;
    }

    public static int origClOrdIDEncodingOffset()
    {
        return 0;
    }

    public static int origClOrdIDEncodingLength()
    {
        return 8;
    }

    public static String origClOrdIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long origClOrdIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

    public static long origClOrdIDMinValue()
    {
        return 0x0L;
    }

    public static long origClOrdIDMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public long origClOrdID()
    {
        return buffer.getLong(offset + 0, BYTE_ORDER);
    }


    public static int clOrdIDId()
    {
        return 11;
    }

    public static int clOrdIDSinceVersion()
    {
        return 0;
    }

    public static int clOrdIDEncodingOffset()
    {
        return 8;
    }

    public static int clOrdIDEncodingLength()
    {
        return 8;
    }

    public static String clOrdIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long clOrdIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

    public static long clOrdIDMinValue()
    {
        return 0x0L;
    }

    public static long clOrdIDMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public long clOrdID()
    {
        return buffer.getLong(offset + 8, BYTE_ORDER);
    }


    public static int marketSegmentIDId()
    {
        return 1300;
    }

    public static int marketSegmentIDSinceVersion()
    {
        return 0;
    }

    public static int marketSegmentIDEncodingOffset()
    {
        return 16;
    }

    public static int marketSegmentIDEncodingLength()
    {
        return 1;
    }

    public static String marketSegmentIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static short marketSegmentIDNullValue()
    {
        return (short)255;
    }

    public static short marketSegmentIDMinValue()
    {
        return (short)0;
    }

    public static short marketSegmentIDMaxValue()
    {
        return (short)254;
    }

    public short marketSegmentID()
    {
        return ((short)(buffer.getByte(offset + 16) & 0xFF));
    }


    public static int senderLocationId()
    {
        return 35503;
    }

    public static int senderLocationSinceVersion()
    {
        return 0;
    }

    public static int senderLocationEncodingOffset()
    {
        return 17;
    }

    public static int senderLocationEncodingLength()
    {
        return 10;
    }

    public static String senderLocationMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static byte senderLocationNullValue()
    {
        return (byte)0;
    }

    public static byte senderLocationMinValue()
    {
        return (byte)32;
    }

    public static byte senderLocationMaxValue()
    {
        return (byte)126;
    }

    public static int senderLocationLength()
    {
        return 10;
    }


    public byte senderLocation(final int index)
    {
        if (index < 0 || index >= 10)
        {
            throw new IndexOutOfBoundsException("index out of range: index=" + index);
        }

        final int pos = offset + 17 + (index * 1);

        return buffer.getByte(pos);
    }


    public static String senderLocationCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public int getSenderLocation(final byte[] dst, final int dstOffset)
    {
        final int length = 10;
        if (dstOffset < 0 || dstOffset > (dst.length - length))
        {
            throw new IndexOutOfBoundsException("Copy will go out of range: offset=" + dstOffset);
        }

        buffer.getBytes(offset + 17, dst, dstOffset, length);

        return length;
    }

    public String senderLocation()
    {
        final byte[] dst = new byte[10];
        buffer.getBytes(offset + 17, dst, 0, 10);

        int end = 0;
        for (; end < 10 && dst[end] != 0; ++end);

        return new String(dst, 0, end, java.nio.charset.StandardCharsets.US_ASCII);
    }


    public int getSenderLocation(final Appendable value)
    {
        for (int i = 0; i < 10; ++i)
        {
            final int c = buffer.getByte(offset + 17 + i) & 0xFF;
            if (c == 0)
            {
                return i;
            }

            try
            {
                value.append(c > 127 ? '?' : (char)c);
            }
            catch (final java.io.IOException ex)
            {
                throw new java.io.UncheckedIOException(ex);
            }
        }

        return 10;
    }


    public static int enteringTraderId()
    {
        return 35502;
    }

    public static int enteringTraderSinceVersion()
    {
        return 0;
    }

    public static int enteringTraderEncodingOffset()
    {
        return 27;
    }

    public static int enteringTraderEncodingLength()
    {
        return 5;
    }

    public static String enteringTraderMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static byte enteringTraderNullValue()
    {
        return (byte)0;
    }

    public static byte enteringTraderMinValue()
    {
        return (byte)32;
    }

    public static byte enteringTraderMaxValue()
    {
        return (byte)126;
    }

    public static int enteringTraderLength()
    {
        return 5;
    }


    public byte enteringTrader(final int index)
    {
        if (index < 0 || index >= 5)
        {
            throw new IndexOutOfBoundsException("index out of range: index=" + index);
        }

        final int pos = offset + 27 + (index * 1);

        return buffer.getByte(pos);
    }


    public static String enteringTraderCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public int getEnteringTrader(final byte[] dst, final int dstOffset)
    {
        final int length = 5;
        if (dstOffset < 0 || dstOffset > (dst.length - length))
        {
            throw new IndexOutOfBoundsException("Copy will go out of range: offset=" + dstOffset);
        }

        buffer.getBytes(offset + 27, dst, dstOffset, length);

        return length;
    }

    public String enteringTrader()
    {
        final byte[] dst = new byte[5];
        buffer.getBytes(offset + 27, dst, 0, 5);

        int end = 0;
        for (; end < 5 && dst[end] != 0; ++end);

        return new String(dst, 0, end, java.nio.charset.StandardCharsets.US_ASCII);
    }


    public int getEnteringTrader(final Appendable value)
    {
        for (int i = 0; i < 5; ++i)
        {
            final int c = buffer.getByte(offset + 27 + i) & 0xFF;
            if (c == 0)
            {
                return i;
            }

            try
            {
                value.append(c > 127 ? '?' : (char)c);
            }
            catch (final java.io.IOException ex)
            {
                throw new java.io.UncheckedIOException(ex);
            }
        }

        return 5;
    }


    public static int executingTraderId()
    {
        return 35506;
    }

    public static int executingTraderSinceVersion()
    {
        return 0;
    }

    public static int executingTraderEncodingOffset()
    {
        return 32;
    }

    public static int executingTraderEncodingLength()
    {
        return 5;
    }

    public static String executingTraderMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "optional";
        }

        return "";
    }

    public static byte executingTraderNullValue()
    {
        return (byte)0;
    }

    public static byte executingTraderMinValue()
    {
        return (byte)32;
    }

    public static byte executingTraderMaxValue()
    {
        return (byte)126;
    }

    public static int executingTraderLength()
    {
        return 5;
    }


    public byte executingTrader(final int index)
    {
        if (index < 0 || index >= 5)
        {
            throw new IndexOutOfBoundsException("index out of range: index=" + index);
        }

        final int pos = offset + 32 + (index * 1);

        return buffer.getByte(pos);
    }


    public static String executingTraderCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public int getExecutingTrader(final byte[] dst, final int dstOffset)
    {
        final int length = 5;
        if (dstOffset < 0 || dstOffset > (dst.length - length))
        {
            throw new IndexOutOfBoundsException("Copy will go out of range: offset=" + dstOffset);
        }

        buffer.getBytes(offset + 32, dst, dstOffset, length);

        return length;
    }

    public String executingTrader()
    {
        final byte[] dst = new byte[5];
        buffer.getBytes(offset + 32, dst, 0, 5);

        int end = 0;
        for (; end < 5 && dst[end] != 0; ++end);

        return new String(dst, 0, end, java.nio.charset.StandardCharsets.US_ASCII);
    }


    public int getExecutingTrader(final Appendable value)
    {
        for (int i = 0; i < 5; ++i)
        {
            final int c = buffer.getByte(offset + 32 + i) & 0xFF;
            if (c == 0)
            {
                return i;
            }

            try
            {
                value.append(c > 127 ? '?' : (char)c);
            }
            catch (final java.io.IOException ex)
            {
                throw new java.io.UncheckedIOException(ex);
            }
        }

        return 5;
    }


    public String toString()
    {
        if (null == buffer)
        {
            return "";
        }

        final OrderCancelRequestDecoder decoder = new OrderCancelRequestDecoder();
        decoder.wrap(buffer, offset, actingBlockLength, actingVersion);

        return decoder.appendTo(new StringBuilder()).toString();
    }

    public StringBuilder appendTo(final StringBuilder builder)
    {
        if (null == buffer)
        {
            return builder;
        }

        final int originalLimit = limit();
        limit(offset + actingBlockLength);
        builder.append("[OrderCancelRequest](sbeTemplateId=");
        builder.append(TEMPLATE_ID);
        builder.append("|sbeSchemaId=");
        builder.append(SCHEMA_ID);
        builder.append("|sbeSchemaVersion=");
        if (parentMessage.actingVersion != SCHEMA_VERSION)
        {
            builder.append(parentMessage.actingVersion);
            builder.append('/');
        }
        builder.append(SCHEMA_VERSION);
        builder.append("|sbeBlockLength=");
        if (actingBlockLength != BLOCK_LENGTH)
        {
            builder.append(actingBlockLength);
            builder.append('/');
        }
        builder.append(BLOCK_LENGTH);
        builder.append("):");
        builder.append("messageType=");
        builder.append(this.messageType());
        builder.append('|');
        builder.append("origClOrdID=");
        builder.append(this.origClOrdID());
        builder.append('|');
        builder.append("clOrdID=");
        builder.append(this.clOrdID());
        builder.append('|');
        builder.append("marketSegmentID=");
        builder.append(this.marketSegmentID());
        builder.append('|');
        builder.append("senderLocation=");
        for (int i = 0; i < senderLocationLength() && this.senderLocation(i) > 0; i++)
        {
            builder.append((char)this.senderLocation(i));
        }
        builder.append('|');
        builder.append("enteringTrader=");
        for (int i = 0; i < enteringTraderLength() && this.enteringTrader(i) > 0; i++)
        {
            builder.append((char)this.enteringTrader(i));
        }
        builder.append('|');
        builder.append("executingTrader=");
        for (int i = 0; i < executingTraderLength() && this.executingTrader(i) > 0; i++)
        {
            builder.append((char)this.executingTrader(i));
        }

        limit(originalLimit);

        return builder;
    }
    
    public OrderCancelRequestDecoder sbeSkip()
    {
        sbeRewind();

        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy