From 97b769a80d50ddc8e0f29f65340f35f1b5d7ea7c Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Thu, 7 Sep 2023 10:11:32 +0200 Subject: [PATCH] Replace SampleFlags IS_FIRST/IS_LAST with NEW_SIMULATION Signed-off-by: Philipp Jungkamp --- include/villas/sample.hpp | 4 ++-- lib/hooks/restart.cpp | 2 +- lib/path_source.cpp | 2 +- lua/hooks/test.lua | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/villas/sample.hpp b/include/villas/sample.hpp index 80f3f3878..e5965e757 100644 --- a/include/villas/sample.hpp +++ b/include/villas/sample.hpp @@ -49,8 +49,8 @@ enum class SampleFlags { HAS_TS_ORIGIN | HAS_TS_RECEIVED, // Include origin timestamp in output. HAS_ALL = (1 << 5) - 1, // Enable all output options. - IS_FIRST = (1 << 16), // This sample is the first of a new simulation case - IS_LAST = (1 << 17) // This sample is the last of a running simulation case + NEW_SIMULATION = + (1 << 16), // This sample is the first of a new simulation case }; struct Sample { diff --git a/lib/hooks/restart.cpp b/lib/hooks/restart.cpp index 216a932b1..c541cc972 100644 --- a/lib/hooks/restart.cpp +++ b/lib/hooks/restart.cpp @@ -50,7 +50,7 @@ public: "(previous->sequence={}, current->sequence={})", node->getName(), prev->sequence, smp->sequence); - smp->flags |= (int)SampleFlags::IS_FIRST; + smp->flags |= (int)SampleFlags::NEW_SIMULATION; // Restart hooks for (auto k : node->in.hooks) diff --git a/lib/path_source.cpp b/lib/path_source.cpp index ec138e71d..e61577e2b 100644 --- a/lib/path_source.cpp +++ b/lib/path_source.cpp @@ -108,7 +108,7 @@ int PathSource::read(int i) { /* We reset the sample length after each restart of the simulation. * This is necessary for the test_rtt node to work properly. */ - if (tomux_smps[i]->flags & (int)SampleFlags::IS_FIRST) + if (tomux_smps[i]->flags & (int)SampleFlags::NEW_SIMULATION) muxed_smps[i]->length = 0; muxed_smps[i]->ts = tomux_smps[i]->ts; diff --git a/lua/hooks/test.lua b/lua/hooks/test.lua index 3ed71af18..d4aa24e15 100644 --- a/lua/hooks/test.lua +++ b/lua/hooks/test.lua @@ -22,8 +22,7 @@ SampleFlags = { HAS_DATA = 16, -- "(1 << 5)" Include values in output. HAS_ALL = 15, -- "(1 << 6) -1" Enable all output options. - IS_FIRST = 65536, -- "(1 << 16)" This sample is the first of a new simulation case - IS_LAST = 131072 -- "(1 << 17)" This sample is the last of a running simulation case + NEW_SIMULATION = 65536, -- "(1 << 16)" This sample is the first of a new simulation case } @@ -71,7 +70,7 @@ end function process(smp) - info("Process test_hook") + info("Process test_hook") if smp.sequence == 1 then dump_sample(smp)