[apps/graph] Remove old files

This commit is contained in:
Léa Saviot
2018-10-12 11:03:00 +02:00
committed by Émilie Feral
parent 86d90e7e56
commit ca3f88185f
5 changed files with 2 additions and 123 deletions

View File

@@ -3,8 +3,6 @@ app_headers += apps/graph/app.h
app_objs += $(addprefix apps/graph/,\
app.o\
cartesian_function.o\
cartesian_function_store.o\
storage_cartesian_function_store.o\
graph/banner_view.o\
graph/calculation_graph_controller.o\

View File

@@ -1,27 +0,0 @@
#ifndef GRAPH_CARTESIAN_FUNCTION_H
#define GRAPH_CARTESIAN_FUNCTION_H
#include "../shared/function.h"
namespace Graph {
class CartesianFunction : public Shared::Function {
public:
using Shared::Function::Function;
CartesianFunction(const char * text = nullptr, KDColor color = KDColorBlack);
bool displayDerivative();
void setDisplayDerivative(bool display);
double approximateDerivative(double x, Poincare::Context * context) const;
double sumBetweenBounds(double start, double end, Poincare::Context * context) const override;
Poincare::Expression::Coordinate2D nextMinimumFrom(double start, double step, double max, Poincare::Context * context) const;
Poincare::Expression::Coordinate2D nextMaximumFrom(double start, double step, double max, Poincare::Context * context) const;
double nextRootFrom(double start, double step, double max, Poincare::Context * context) const;
Poincare::Expression::Coordinate2D nextIntersectionFrom(double start, double step, double max, Poincare::Context * context, const Shared::Function * function) const;
const char * symbol() const override { return "x"; }
private:
bool m_displayDerivative;
};
}
#endif

View File

@@ -1,55 +0,0 @@
#include "cartesian_function_store.h"
extern "C" {
#include <assert.h>
#include <stddef.h>
}
#include <ion.h>
namespace Graph {
constexpr int CartesianFunctionStore::k_maxNumberOfFunctions;
constexpr const char * CartesianFunctionStore::k_functionNames[k_maxNumberOfFunctions];
CartesianFunctionStore::CartesianFunctionStore() :
Shared::FunctionStore()
{
addEmptyModel();
}
uint32_t CartesianFunctionStore::storeChecksum() {
size_t dataLengthInBytes = k_maxNumberOfFunctions*sizeof(uint32_t);
assert((dataLengthInBytes & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4
uint32_t checksums[k_maxNumberOfFunctions];
for (int i = 0; i < k_maxNumberOfFunctions; i++) {
checksums[i] = m_functions[i].checksum();
}
return Ion::crc32((uint32_t *)checksums, dataLengthInBytes/sizeof(uint32_t));
}
char CartesianFunctionStore::symbol() const {
return 'x';
}
void CartesianFunctionStore::removeAll() {
FunctionStore::removeAll();
addEmptyModel();
}
CartesianFunction * CartesianFunctionStore::emptyModel() {
static CartesianFunction addedFunction("", KDColorBlack);
addedFunction = CartesianFunction(firstAvailableName(), firstAvailableColor());
return &addedFunction;
}
CartesianFunction * CartesianFunctionStore::nullModel() {
static CartesianFunction emptyFunction("", KDColorBlack);
return &emptyFunction;
}
void CartesianFunctionStore::setModelAtIndex(Shared::ExpressionModel * e, int i) {
assert(i>=0 && i<m_numberOfModels);
m_functions[i] = *(static_cast<CartesianFunction *>(e));
}
}

View File

@@ -1,39 +0,0 @@
#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

View File

@@ -1,6 +1,8 @@
#include "storage_cartesian_function.h"
#include "storage_expression_model_store.h"
#include "poincare_helpers.h"
#include <poincare/derivative.h>
#include <poincare/integral.h>
#include <float.h>
#include <cmath>