Example #1
0
            public int Read(ref DirectBuffer source, out SampleStruct value)
            {
                var val = source.ReadInt32(0);

                value = new SampleStruct(val);
                return(4);
            }
Example #2
0
        /// <summary>
        /// Insert a packet of frames into the log at the appropriate offset as indicated by the term offset header.
        /// </summary>
        /// <param name="termBuffer"> into which the packet should be inserted. </param>
        /// <param name="offset">     offset in the term at which the packet should be inserted. </param>
        /// <param name="packet">     containing a sequence of frames. </param>
        /// <param name="length">     of the sequence of frames in bytes. </param>

        public static void Insert(DirectBuffer termBuffer, int offset, DirectBuffer packet, int length)
        {
            int firstFrameLength = packet.ReadInt32(0);

            packet.VolatileWriteInt32(0, 0);

            termBuffer.WriteBytes(offset, packet, 0, length);
            FrameDescriptor.FrameLengthOrdered(termBuffer, offset, firstFrameLength);
        }
Example #3
0
 /**
  * Get the value of the MTU length used for this log.
  *
  * @param logMetaDataBuffer containing the meta data.
  * @return the value of the MTU length used for this log.
  */
 public static int MtuLength(DirectBuffer logMetaDataBuffer)
 {
     return(logMetaDataBuffer.ReadInt32(LOG_MTU_LENGTH_OFFSET));
 }
Example #4
0
 /**
  * Get the value of the initial Term id used for this log.
  *
  * @param logMetaDataBuffer containing the meta data.
  * @return the value of the initial Term id used for this log.
  */
 public static int InitialTermId(DirectBuffer logMetaDataBuffer)
 {
     return(logMetaDataBuffer.ReadInt32(LOG_INITIAL_TERM_ID_OFFSET));
 }
Example #5
0
 /**
  * Get the length of a frame from the header.
  *
  * @param buffer     containing the frame.
  * @param termOffset at which a frame begins.
  * @return the value for the frame length.
  */
 public static int FrameLength(DirectBuffer buffer, int termOffset)
 {
     return(buffer.ReadInt32(termOffset));
 }