Files
Upsilon/apps/shared/storage_function_store.h
Émilie Feral c70278941a [graph] Do not keep a function pointer as member variable but a record.
Indeed, function pointers can become invalid at any point...
2018-11-23 12:04:02 +01:00

28 lines
1.1 KiB
C++

#ifndef SHARED_STORAGE_FUNCTION_STORE_H
#define SHARED_STORAGE_FUNCTION_STORE_H
#include "storage_function.h"
#include "storage_expression_model_store.h"
#include <stdint.h>
namespace Shared {
/* FunctionStore storse functions and gives them a color. */
class StorageFunctionStore : public StorageExpressionModelStore {
public:
StorageFunctionStore() : StorageExpressionModelStore() {}
uint32_t storeChecksum();
// An active function must be defined to be counted
int numberOfActiveFunctions() const { return numberOfModelsSatisfyingTest([](StorageExpressionModel * m) { return m->isDefined() && static_cast<StorageFunction *>(m)->isActive(); }); }
Ion::Storage::Record activeRecordAtIndex(int i) const { return recordStatifyingTestAtIndex(i, [](StorageExpressionModel * m) { return m->isDefined() && static_cast<StorageFunction *>(m)->isActive(); }); }
StorageFunction * modelForRecord(Ion::Storage::Record record) const override { return static_cast<StorageFunction *>(StorageExpressionModelStore::modelForRecord(record)); }
virtual char symbol() const = 0;
};
}
#endif