Numworks Epsilon  1.4.1
Graphing Calculator Operating System
interval.h
Go to the documentation of this file.
1 #ifndef SHARED_VALUES_INTERVAL_H
2 #define SHARED_VALUES_INTERVAL_H
3 
4 namespace Shared {
5 
6 class Interval {
7 public:
8  Interval();
9  // Delete the implicit copy constructor: the object is heavy
10  Interval(const Interval&) = delete;
11  int numberOfElements();
12  void deleteElementAtIndex(int index);
13  double element(int i);
14  double start();
15  double end();
16  double step();
17  void setStart(double f);
18  void setEnd(double f);
19  void setStep(double f);
20  void setElement(int i, double f);
21  // TODO: decide the max number of elements after optimization
22  constexpr static int k_maxNumberOfElements = 100;
23 private:
24  void computeElements();
25  int m_numberOfElements;
26  double m_intervalBuffer[k_maxNumberOfElements];
27  double m_start;
28  double m_end;
29  double m_step;
30  bool m_needCompute;
31 };
32 
33 typedef void (Interval::*SetterPointer)(double);
34 typedef double (Interval::*GetterPointer)();
35 
36 }
37 
38 #endif
void setStep(double f)
Definition: interval.cpp:56
double element(int i)
Definition: interval.cpp:28
void setElement(int i, double f)
Definition: interval.cpp:61
void(Interval::* SetterPointer)(double)
Definition: interval.h:33
int numberOfElements()
Definition: interval.cpp:15
static constexpr int k_maxNumberOfElements
Definition: interval.h:22
double start()
Definition: interval.cpp:34
void setStart(double f)
Definition: interval.cpp:46
double end()
Definition: interval.cpp:38
void deleteElementAtIndex(int index)
Definition: interval.cpp:20
void setEnd(double f)
Definition: interval.cpp:51
double(Interval::* GetterPointer)()
Definition: interval.h:34
double step()
Definition: interval.cpp:42