[apps/sequence] Fix SequenceStore: sequences are not memoized but all

kept in the store (because we need all of them to evaluate one
sequence). setMemoizedModelAtIndex now store u, v and w sequences in
this order to avoid requiring expiring pointers.
This commit is contained in:
Émilie Feral
2019-08-12 17:30:26 +02:00
parent cbe6d312d4
commit 503e07fe5a
8 changed files with 25 additions and 12 deletions

View File

@@ -47,9 +47,14 @@ int SequenceStore::sequenceIndexForName(char name) {
return 0;
}
void SequenceStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
Shared::ExpressionModelHandle * SequenceStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
m_sequences[cacheIndex] = Sequence(record);
int index = cacheIndex;
if (!record.isNull()) {
index = SequenceStore::sequenceIndexForName(record.fullName()[0]);
}
m_sequences[index] = Sequence(record);
return &m_sequences[index];
}
Shared::ExpressionModelHandle * SequenceStore::memoizedModelAtIndex(int cacheIndex) const {