Skip to content

Commit 42e2a58

Browse files
committed
Group-based layout: Parse only after beginning steps
1 parent 1e33d86 commit 42e2a58

1 file changed

Lines changed: 35 additions & 9 deletions

File tree

src/ReadIterations.cpp

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,43 @@ SeriesIterator::SeriesIterator( Series series )
4141
}
4242
else
4343
{
44-
/*
45-
* @todo
46-
* Is that really clean?
47-
* Use case: See Python ApiTest testListSeries:
48-
* Call listSeries twice.
49-
*/
50-
if( *it->second.m_closed != Iteration::CloseStatus::ClosedInBackend )
44+
auto openIteration = [ &it ]()
5145
{
52-
it->second.open();
46+
/*
47+
* @todo
48+
* Is that really clean?
49+
* Use case: See Python ApiTest testListSeries:
50+
* Call listSeries twice.
51+
*/
52+
if( *it->second.m_closed !=
53+
Iteration::CloseStatus::ClosedInBackend )
54+
{
55+
it->second.open();
56+
}
57+
};
58+
AdvanceStatus status{};
59+
switch( series.iterationEncoding() )
60+
{
61+
case IterationEncoding::fileBased:
62+
/*
63+
* The file needs to be accessed before beginning a step upon it.
64+
* In file-based iteration layout it maybe is not accessed yet,
65+
* so do that now. There is only one step per file, so beginning
66+
* the step after parsing the file is ok.
67+
*/
68+
openIteration();
69+
status = it->second.beginStep();
70+
break;
71+
default:
72+
/*
73+
* In group-based iteration layout, we have definitely already had
74+
* access to the file until now. Better to begin a step right away,
75+
* otherwise we might get another step's data.
76+
*/
77+
status = it->second.beginStep();
78+
openIteration();
79+
break;
5380
}
54-
auto status = it->second.beginStep();
5581
if( status == AdvanceStatus::OVER )
5682
{
5783
*this = end();

0 commit comments

Comments
 (0)