[graph] Fix StorageCartesianFunction

This commit is contained in:
Émilie Feral
2018-10-10 17:33:16 +02:00
parent 21b214e60f
commit 8aff120bf3
4 changed files with 39 additions and 30 deletions

View File

@@ -5,22 +5,14 @@ extern "C" {
}
#include <ion.h>
using namespace Shared;
namespace Graph {
//constexpr const char * StorageCartesianFunctionStore::k_functionNames[k_maxNumberOfFunctions];
Shared::StorageCartesianFunction StorageCartesianFunctionStore::NullModel() {
return Shared::StorageCartesianFunction("");
}
StorageCartesianFunctionStore::StorageCartesianFunctionStore() :
Shared::StorageFunctionStore<Shared::StorageCartesianFunction>()
Shared::StorageFunctionStore()
{
//addEmptyModel();
}
char StorageCartesianFunctionStore::symbol() const {
return 'x';
addEmptyModel();
}
void StorageCartesianFunctionStore::removeAll() {
@@ -28,5 +20,26 @@ void StorageCartesianFunctionStore::removeAll() {
addEmptyModel();
}
void StorageCartesianFunctionStore::addEmptyModel() {
Ion::Storage::Record::ErrorStatus error;
StorageCartesianFunction newModel = StorageCartesianFunction::NewModel(&error);
assert(error == Ion::Storage::Record::ErrorStatus::None);
}
void StorageCartesianFunctionStore::privateSetMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
assert(cacheIndex >= 0 && cacheIndex < k_maxNumberOfMemoizedModels);
m_functions[cacheIndex] = StorageCartesianFunction(record);
}
void StorageCartesianFunctionStore::moveMemoizedModel(int previousIndex, int nextIndex) const {
assert(nextIndex >= 0 && nextIndex < k_maxNumberOfMemoizedModels);
assert(previousIndex >= 0 && previousIndex < k_maxNumberOfMemoizedModels);
m_functions[nextIndex] = m_functions[previousIndex];
}
StorageExpressionModel * StorageCartesianFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
assert(cacheIndex >= 0 && cacheIndex < k_maxNumberOfMemoizedModels);
return &m_functions[cacheIndex];
}
}