mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/graph/cartesian_function_store] Define activeRecordOfTypeAtIndex
This commit is contained in:
@@ -9,6 +9,32 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
int CartesianFunctionStore::numberOfActiveFunctionsOfType(CartesianFunction::PlotType plotType) const {
|
||||
int count = 0;
|
||||
for (int i = 0; i < numberOfActiveFunctions(); i++) {
|
||||
Ion::Storage::Record record = activeRecordAtIndex(i);
|
||||
ExpiringPointer<CartesianFunction> function = modelForRecord(record);
|
||||
count += (plotType == function->plotType());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
Ion::Storage::Record CartesianFunctionStore::activeRecordOfTypeAtIndex(CartesianFunction::PlotType plotType, int index) const {
|
||||
int count = 0;
|
||||
Ion::Storage::Record record;
|
||||
for (int i = 0; i < numberOfActiveFunctions(); i++) {
|
||||
record = activeRecordAtIndex(i);
|
||||
ExpiringPointer<CartesianFunction> function = modelForRecord(record);
|
||||
if (plotType == function->plotType()) {
|
||||
if (count == index) {
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus CartesianFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus error;
|
||||
CartesianFunction newModel = CartesianFunction::NewModel(&error);
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Graph {
|
||||
class CartesianFunctionStore : public Shared::FunctionStore {
|
||||
public:
|
||||
Shared::ExpiringPointer<Shared::CartesianFunction> modelForRecord(Ion::Storage::Record record) const { return Shared::ExpiringPointer<Shared::CartesianFunction>(static_cast<Shared::CartesianFunction *>(privateModelForRecord(record))); }
|
||||
int numberOfActiveFunctionsOfType(Shared::CartesianFunction::PlotType plotType) const;
|
||||
Ion::Storage::Record activeRecordOfTypeAtIndex(Shared::CartesianFunction::PlotType plotType, int index) const;
|
||||
private:
|
||||
Ion::Storage::Record::ErrorStatus addEmptyModel() override;
|
||||
const char * modelExtension() const override { return Ion::Storage::funcExtension; }
|
||||
|
||||
Reference in New Issue
Block a user