Files
Upsilon/apps/graph/cartesian_function_store.cpp
Émilie Feral 503e07fe5a [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.
2019-08-13 09:44:00 +02:00

30 lines
854 B
C++

#include "cartesian_function_store.h"
extern "C" {
#include <assert.h>
#include <stddef.h>
}
#include <ion.h>
using namespace Shared;
namespace Graph {
Ion::Storage::Record::ErrorStatus CartesianFunctionStore::addEmptyModel() {
Ion::Storage::Record::ErrorStatus error;
CartesianFunction newModel = CartesianFunction::NewModel(&error);
return error;
}
ExpressionModelHandle * CartesianFunctionStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
m_functions[cacheIndex] = CartesianFunction(record);
return &m_functions[cacheIndex];
}
ExpressionModelHandle * CartesianFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
return &m_functions[cacheIndex];
}
}