String generateMessageHeaderCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final int headerSize) throws IOException { final String messageHeaderRepresentation = "MessageHeader"; final String headerCoderType = messageTypeName + messageHeaderRepresentation + name(); try (Writer writer = outputManager.createOutput(headerCoderType)) { appendScratchWrappingStruct(writer, headerCoderType); RustGenerator.appendImplWithLifetimeHeader(writer, headerCoderType); appendWrapMethod(writer, headerCoderType); appendDirectCodeMethods(writer, "header", messageHeaderRepresentation, topType, headerSize); writer.append("}\n"); } return headerCoderType; } }
private static String generateFixedFieldCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final Optional<FieldsRepresentationSummary> fieldsRepresentationOptional, final RustCodecType codecType) throws IOException { if (!fieldsRepresentationOptional.isPresent()) { return topType; } final FieldsRepresentationSummary fieldsRepresentation = fieldsRepresentationOptional.get(); try (Writer writer = outputManager.createOutput(messageTypeName + " Fixed fields " + codecType.name())) { final String representationStruct = fieldsRepresentation.typeName; final String decoderName = representationStruct + codecType.name(); codecType.appendScratchWrappingStruct(writer, decoderName); appendImplWithLifetimeHeader(writer, decoderName); codecType.appendWrapMethod(writer, decoderName); codecType.appendDirectCodeMethods(writer, formatMethodName(messageTypeName) + "_fields", representationStruct, topType, fieldsRepresentation.numBytes); writer.append("}\n"); // TODO - Move read position further if in-message blockLength exceeds fixed fields representation size // will require piping some data from the previously-read message header return decoderName; } }
String generateMessageHeaderCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final int headerSize) throws IOException { final String messageHeaderRepresentation = "MessageHeader"; final String headerCoderType = messageTypeName + messageHeaderRepresentation + name(); try (Writer writer = outputManager.createOutput(headerCoderType)) { appendScratchWrappingStruct(writer, headerCoderType); RustGenerator.appendImplWithLifetimeHeader(writer, headerCoderType); appendWrapMethod(writer, headerCoderType); appendDirectCodeMethods(writer, "header", messageHeaderRepresentation, topType, headerSize); writer.append("}\n"); } return headerCoderType; } }
String generateMessageHeaderCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final int headerSize) throws IOException { final String messageHeaderRepresentation = "MessageHeader"; final String headerCoderType = messageTypeName + messageHeaderRepresentation + name(); try (Writer writer = outputManager.createOutput(headerCoderType)) { appendScratchWrappingStruct(writer, headerCoderType); RustGenerator.appendImplWithLifetimeHeader(writer, headerCoderType); appendWrapMethod(writer, headerCoderType); appendDirectCodeMethods(writer, "header", messageHeaderRepresentation, topType, headerSize); writer.append("}\n"); } return headerCoderType; } }
private static String generateFixedFieldCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final Optional<FieldsRepresentationSummary> fieldsRepresentationOptional, final RustCodecType codecType) throws IOException { if (!fieldsRepresentationOptional.isPresent()) { return topType; } final FieldsRepresentationSummary fieldsRepresentation = fieldsRepresentationOptional.get(); try (Writer writer = outputManager.createOutput(messageTypeName + " Fixed fields " + codecType.name())) { final String representationStruct = fieldsRepresentation.typeName; final String decoderName = representationStruct + codecType.name(); codecType.appendScratchWrappingStruct(writer, decoderName); appendImplWithLifetimeHeader(writer, decoderName); codecType.appendWrapMethod(writer, decoderName); codecType.appendDirectCodeMethods(writer, formatMethodName(messageTypeName) + "_fields", representationStruct, topType, fieldsRepresentation.numBytes); writer.append("}\n"); // TODO - Move read position further if in-message blockLength exceeds fixed fields representation size // will require piping some data from the previously-read message header return decoderName; } }
private static String generateFixedFieldCoder( final String messageTypeName, final OutputManager outputManager, final String topType, final Optional<FieldsRepresentationSummary> fieldsRepresentationOptional, final RustCodecType codecType) throws IOException { if (!fieldsRepresentationOptional.isPresent()) { return topType; } final FieldsRepresentationSummary fieldsRepresentation = fieldsRepresentationOptional.get(); try (Writer writer = outputManager.createOutput(messageTypeName + " Fixed fields " + codecType.name())) { final String representationStruct = fieldsRepresentation.typeName; final String decoderName = representationStruct + codecType.name(); codecType.appendScratchWrappingStruct(writer, decoderName); appendImplWithLifetimeHeader(writer, decoderName); codecType.appendWrapMethod(writer, decoderName); codecType.appendDirectCodeMethods(writer, formatMethodName(messageTypeName) + "_fields", representationStruct, topType, fieldsRepresentation.numBytes); writer.append("}\n"); // TODO - Move read position further if in-message blockLength exceeds fixed fields representation size // will require piping some data from the previously-read message header return decoderName; } }