Files
Upsilon/apps/graph/cartesian_function_store.h
2018-06-12 10:25:54 +02:00

40 lines
1.3 KiB
C++

#ifndef GRAPH_CARTESIAN_FUNCTION_STORE_H
#define GRAPH_CARTESIAN_FUNCTION_STORE_H
#include "cartesian_function.h"
#include "../shared/function_store.h"
#include <stdint.h>
#include <escher.h>
namespace Graph {
class CartesianFunctionStore : public Shared::FunctionStore {
public:
CartesianFunctionStore();
uint32_t storeChecksum() override;
CartesianFunction * modelAtIndex(int i) override { return &m_functions[i]; }
CartesianFunction * activeFunctionAtIndex(int i) override { return (CartesianFunction *)Shared::FunctionStore::activeFunctionAtIndex(i); }
CartesianFunction * definedFunctionAtIndex(int i) override { return (CartesianFunction *)Shared::FunctionStore::definedFunctionAtIndex(i); }
int maxNumberOfModels() const override {
return k_maxNumberOfFunctions;
}
char symbol() const override;
void removeAll() override;
static constexpr int k_maxNumberOfFunctions = 4;
private:
static constexpr const char * k_functionNames[k_maxNumberOfFunctions] = {
"f", "g", "h", "p",
};
CartesianFunction * emptyModel() override;
CartesianFunction * nullModel() override;
void setModelAtIndex(Shared::ExpressionModel * f, int i) override;
const char * firstAvailableName() override {
return firstAvailableAttribute(k_functionNames, FunctionStore::name);
}
CartesianFunction m_functions[k_maxNumberOfFunctions];
};
}
#endif