Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
ParameterCache.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: ParameterCache.h
3//-----------------------------------------------------------------------------
4// Project: Kactus2
5// Author: Esko Pekkarinen
6// Date: 06.09.2016
7//
8// Description:
9// The cached implementation for finding parameters with the correct ID.
10//-----------------------------------------------------------------------------
11
12#ifndef PARAMETERCACHE_H
13#define PARAMETERCACHE_H
14
15#include <KactusAPI/KactusAPIGlobal.h>
16
17#include "ParameterFinder.h"
19
20#include <QHash>
21#include <QObject>
22
23class Component;
24class Parameter;
25
26//-----------------------------------------------------------------------------
28//-----------------------------------------------------------------------------
29class KACTUS2_API ParameterCache : public QObject, public ComponentParameterFinder
30{
31 Q_OBJECT
32public:
33
39 ParameterCache(QSharedPointer<const Component> component);
40
44 ~ParameterCache() override = default;
45
47 ParameterCache(const ParameterCache& other) = delete;
49 ParameterCache& operator=(const ParameterCache& other) = delete;
50
56 QSharedPointer<Parameter> getParameterWithID(QStringView parameterId) const final;
57
65 bool hasId(QStringView id) const final;
66
72 QStringList getAllParameterIds() const final;
73
79 int getNumberOfParameters() const final;
80
86 void setComponent(QSharedPointer<Component const> component) final;
87
93 void registerParameterModel(QAbstractItemModel const* model) final;
94
95private slots:
96
97 void resetCache();
98
99private:
100
101
102 //-----------------------------------------------------------------------------
103 // Data.
104 //-----------------------------------------------------------------------------
105
107 QHash<QString, QSharedPointer<Parameter> > availableParameters_;
108
109};
110
111#endif // PARAMETERCACHE_H
ComponentParameterFinder(QSharedPointer< Component const > component) noexcept
void setComponent(QSharedPointer< Component const > component) final
QStringList getAllParameterIds() const final
~ParameterCache() override=default
ParameterCache(QSharedPointer< const Component > component)
ParameterCache & operator=(const ParameterCache &other)=delete
No assignment.
ParameterCache(const ParameterCache &other)=delete
No copying.
int getNumberOfParameters() const final
bool hasId(QStringView id) const final
QSharedPointer< Parameter > getParameterWithID(QStringView parameterId) const final
void registerParameterModel(QAbstractItemModel const *model) final