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
|
#ifndef SHARED_FUNCTION_STORE_H
#define SHARED_FUNCTION_STORE_H
#include "function.h"
#include "expression_model_store.h"
#include <stdint.h>
namespace Shared {
/* FunctionStore is a dumb class.
* Its only job is to store functions and to give them a color. */
class FunctionStore : public ExpressionModelStore {
public:
FunctionStore();
virtual uint32_t storeChecksum() = 0;
virtual Function * modelAtIndex(int i) override = 0;
virtual Function * activeFunctionAtIndex(int i);
virtual Function * definedFunctionAtIndex(int i) { return static_cast<Function *>(definedModelAtIndex(i)); }
// An active function must be defined to be counted
int numberOfActiveFunctions();
virtual char symbol() const = 0;
protected:
static const char * const name(Shared::Function * f) { return f->name(); }
static KDColor const color(Shared::Function * f) { return f->color(); }
template<typename T> using AttributeGetter = T (*)(Function * f);
template<typename T> T firstAvailableAttribute(T attributes[], AttributeGetter<T> attribute);
const KDColor firstAvailableColor() {
return firstAvailableAttribute(Palette::DataColor, FunctionStore::color);
}
private:
virtual const char * firstAvailableName() = 0;
};
}
#endif
|