Numworks Epsilon  1.4.1
Graphing Calculator Operating System
app.h
Go to the documentation of this file.
1 #ifndef PROBABILITY_PROBABILITY_APP_H
2 #define PROBABILITY_PROBABILITY_APP_H
3 
4 #include <escher.h>
5 #include <poincare.h>
6 #include "law_controller.h"
9 #include "../shared/text_field_delegate_app.h"
10 #include "law/binomial_law.h"
11 #include "law/exponential_law.h"
12 #include "law/normal_law.h"
13 #include "law/poisson_law.h"
14 #include "law/uniform_law.h"
18 
19 constexpr static size_t max(const int * data, int seed = 0) {
20  return (*data == 0 ? seed : max(data+1, *data > seed ? *data : seed));
21 }
22 
23 namespace Probability {
24 
26 public:
27  class Descriptor : public ::App::Descriptor {
28  public:
29  I18n::Message name() override;
30  I18n::Message upperName() override;
31  const Image * icon() override;
32  };
33  class Snapshot : public ::App::Snapshot {
34  public:
35  enum class Page {
36  Law,
37  Parameters,
39  };
40  Snapshot();
41  ~Snapshot();
42  App * unpack(Container * container) override;
43  Descriptor * descriptor() override;
44  void reset() override;
45  Law * law();
47  Page activePage();
49  private:
50  constexpr static int k_lawSizes[] = {sizeof(BinomialLaw),sizeof(ExponentialLaw), sizeof(NormalLaw), sizeof(PoissonLaw), sizeof(UniformLaw), 0};
51  constexpr static size_t k_lawSize = max(k_lawSizes);
52  char m_law[k_lawSize];
53  constexpr static int k_calculationSizes[] = {sizeof(LeftIntegralCalculation),sizeof(FiniteIntegralCalculation), sizeof(RightIntegralCalculation), 0};
54  constexpr static size_t k_calculationSize = max(k_calculationSizes);
55  char m_calculation[k_calculationSize];
56  Page m_activePage;
57  };
58 private:
59  App(Container * container, Snapshot * snapshot);
60  CalculationController m_calculationController;
61  ParametersController m_parametersController;
62  LawController m_lawController;
63  StackViewController m_stackViewController;
64 };
65 
66 }
67 
68 #endif
def data
Definition: i18n.py:176
Snapshot * snapshot()
Definition: app.cpp:41
Calculation * calculation()
Definition: app.cpp:58
Descriptor * descriptor() override
Definition: app.cpp:41
Definition: image.h:6
App * unpack(Container *container) override
Definition: app.cpp:37
Definition: app.h:23
I18n::Message name() override
Definition: app.cpp:10
void reset() override
Definition: app.cpp:46
const Image * icon() override
Definition: app.cpp:18
void setActivePage(Page activePage)
Definition: app.cpp:62
I18n::Message upperName() override
Definition: app.cpp:14