[sequence] SequenceStore returns Sequence * instead of

ExpiringPointer<Sequence>

SequenceStore keep all its Sequences in an array which fix Sequence
addresses
This commit is contained in:
Émilie Feral
2019-02-28 16:43:15 +01:00
parent 2bc2506b60
commit cff3d56f22
11 changed files with 34 additions and 37 deletions

View File

@@ -50,22 +50,22 @@ void TemplatedSequenceContext<T>::step(SequenceStore * sequenceStore, SequenceCo
}
/* Evaluate new u(n) and v(n) */
ExpiringPointer<Sequence> u = sequenceStore->numberOfModels() > 0 ? sequenceStore->modelForRecord(sequenceStore->recordAtIndex(0)) : nullptr;
u = u.isNull() && u->isDefined() ? u : nullptr;
ExpiringPointer<Sequence> v = sequenceStore->numberOfModels() > 1 ? sequenceStore->modelForRecord(sequenceStore->recordAtIndex(1)) : nullptr;
v = v.isNull() && v->isDefined() ? v : nullptr;
Sequence * u = sequenceStore->numberOfModels() > 0 ? sequenceStore->modelForRecord(sequenceStore->recordAtIndex(0)) : nullptr;
u = u && u->isDefined() ? u : nullptr;
Sequence * v = sequenceStore->numberOfModels() > 1 ? sequenceStore->modelForRecord(sequenceStore->recordAtIndex(1)) : nullptr;
v = v && v->isDefined() ? v : nullptr;
/* Switch u & v if the name of u is v */
if (!u.isNull() && u->fullName()[0] == SequenceStore::k_sequenceNames[1][0]) {
ExpiringPointer<Sequence> temp = u;
if (u && u->fullName()[0] == SequenceStore::k_sequenceNames[1][0]) {
Sequence * temp = u;
u = v;
v = temp;
}
/* Approximate u & v at the new rank. We evaluate u twice in case its
* expression depends on v. */
m_values[0][0] = !u.isNull() ? u->approximateToNextRank<T>(m_rank, sqctx) : NAN;
m_values[1][0] = !v.isNull() ? v->approximateToNextRank<T>(m_rank, sqctx) : NAN;
m_values[0][0] = !u.isNull() ? u->approximateToNextRank<T>(m_rank, sqctx) : NAN;
m_values[0][0] = u ? u->approximateToNextRank<T>(m_rank, sqctx) : NAN;
m_values[1][0] = v ? v->approximateToNextRank<T>(m_rank, sqctx) : NAN;
m_values[0][0] = u ? u->approximateToNextRank<T>(m_rank, sqctx) : NAN;
}
template class TemplatedSequenceContext<float>;