def build()

in transcoder/message/factory/MDPMessageFactory.py [0:0]


    def build(self, msg_buffer, offset):
        # Peek at the template id to figure out what class to build.
        # This looks past the starting 2 byte MsgSize header that is CME specific
        # and the 2 byte BlockLength that starts all SBE Messages:
        #   https://www.cmegroup.com/confluence/display/EPICSANDBOX/MDP+3.0+-+Message+Header
        template_id = unpack_from('<H', msg_buffer, offset + 4)[0]
        message_type = self.schema.get_message_type(template_id)

        if message_type is None:
            raise TemplateSchemaNotDefinedError(f'Schema not found for template_id: {template_id}')

        message = message_type()
        message.wrap(msg_buffer, offset)
        return message, message.message_size.value