encapsulation & docs

This commit is contained in:
rusefillc 2024-02-25 23:25:39 -05:00
parent 4efa51de4b
commit 589a8b044a
3 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package com.rusefi.test;
import com.rusefi.ReaderState;
import com.rusefi.ldmp.LiveDataProcessor;
import com.rusefi.output.ConfigStructure;
import com.rusefi.output.ConfigurationConsumer;
import com.rusefi.output.DataLogConsumer;
@ -26,7 +25,7 @@ public class SdCardFieldsTestConsumer implements ConfigurationConsumer {
@Override
public void endFile() throws IOException {
LiveDataProcessor.wrapContent(output, getBody());
SdCardFieldsContent.wrapContent(output, getBody());
output.close();
}

View File

@ -80,15 +80,7 @@ public class LiveDataProcessor {
return yaml.load(reader);
}
public static void wrapContent(LazyFile output, String content) {
output.write("static const LogField fields[] = {\r\n" +
"{packedTime, GAUGE_NAME_TIME, \"sec\", 0},\n");
output.write(content);
output.write("};\r\n");
}
private void end(int sensorTsPosition) throws IOException {
log.info("TS_TOTAL_OUTPUT_SIZE=" + sensorTsPosition);
try (FileWriter fw = new FileWriter("console/binary/generated/total_live_data_generated.h")) {
fw.write(header);
@ -257,7 +249,7 @@ public class LiveDataProcessor {
enumContent.append("} live_data_e;\n");
LazyFile lazyFile = fileFactory.create("console/binary_log/log_fields_generated.h");
wrapContent(lazyFile, sdCardFieldsConsumer.getBody());
SdCardFieldsContent.wrapContent(lazyFile, sdCardFieldsConsumer.getBody());
lazyFile.close();
dataLogConsumer.endFile();

View File

@ -2,6 +2,7 @@ package com.rusefi.output;
import com.rusefi.ConfigField;
import com.rusefi.ReaderState;
import com.rusefi.util.LazyFile;
import java.io.IOException;
@ -14,6 +15,14 @@ public class SdCardFieldsContent {
public String conditional;
public Boolean isPtr = false;
public static void wrapContent(LazyFile output, String content) {
output.write("// generated by " + SdCardFieldsContent.class + "\n");
output.write("static const LogField fields[] = {\n" +
"{packedTime, GAUGE_NAME_TIME, \"sec\", 0},\n");
output.write(content);
output.write("};\n");
}
public void handleEndStruct(ReaderState state, ConfigStructure structure) throws IOException {
if (state.isStackEmpty()) {
PerFieldWithStructuresIterator.Strategy strategy = new PerFieldWithStructuresIterator.Strategy() {