From 76b22c1434f117d53bc7fff4864a22e14b809f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20L=C3=BCke?= Date: Thu, 26 Dec 2024 03:09:08 +0100 Subject: [PATCH] mana: don't need to pass analysisContext to process_one_buffer() --- src/tools/mana_auto_replay.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tools/mana_auto_replay.cc b/src/tools/mana_auto_replay.cc index 32320c4..256ed05 100644 --- a/src/tools/mana_auto_replay.cc +++ b/src/tools/mana_auto_replay.cc @@ -135,8 +135,14 @@ std::optional make_parser_context(const mvlc::CrateConfig &crateC } } +struct ProcessingStrategy +{ + virtual ~ProcessingStrategy() = default; + virtual void run(ListfileContext &listfileContext, ParserContext &parserContext) = 0; +}; + size_t process_one_buffer(size_t bufferNumber, ListfileContext &listfileContext, - ParserContext &parserContext, mana::ModuleDataStage &analysisContext) + ParserContext &parserContext) { listfileContext.readerHelper.destBuf().clear(); auto buffer = mvlc::listfile::read_next_buffer(listfileContext.readerHelper); @@ -145,7 +151,6 @@ size_t process_one_buffer(size_t bufferNumber, ListfileContext &listfileContext, return 0; auto bufferView = buffer->viewU32(); - parserContext.parser.userContext = &analysisContext; mvlc::readout_parser::parse_readout_buffer( listfileContext.readerHelper.bufferFormat, parserContext.parser, parserContext.callbacks, @@ -226,6 +231,8 @@ int main(int argc, char *argv[]) if (!parserContext) return 1; + parserContext->parser.userContext = &mana; + mana.sinkContext = mana.sink->init(); mana.sink->begin_run(mana.sinkContext, mana.runDescriptor.dump().c_str()); @@ -249,7 +256,7 @@ int main(int argc, char *argv[]) do { - bytesProcessed = process_one_buffer(bufferNumber, *listfileContext, *parserContext, mana); + bytesProcessed = process_one_buffer(bufferNumber, *listfileContext, *parserContext); totalBytesProcessed += bytesProcessed; ++bufferNumber;