Blame view

Modif/epsilon-master/apps/graph/cartesian_function_store.h 1.34 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  #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