6#ifndef SWIFT_MISC_VALUECACHE_PRIVATE_H
7#define SWIFT_MISC_VALUECACHE_PRIVATE_H
29 struct TClassOfPointerToMember
34 template <
typename T,
typename M>
35 struct TClassOfPointerToMember<M T::*>
44 template <
typename T,
typename... Args>
45 void reconstruct(T *
object, Args &&...args)
48 new (object) T(std::forward<Args>(args)...);
62 static const QStringList &getLogCategories();
65 static CValuePage &getPageFor(QObject *parent, CValueCache *cache);
71 using Validator = std::function<bool(
const CVariant &, QString &)>;
74 using NotifySlot = std::pair<std::function<void(QObject *)>, void (QObject::*)()>;
82 Element &createElement(
const QString &key,
const QString &name,
int metaType,
const Validator &validator,
83 const CVariant &defaultValue);
86 void setNotifySlot(Element &element,
const NotifySlot &slot);
89 bool isInitialized(
const Element &element)
const;
93 bool isValid(
const Element &element,
int typeId)
const;
96 const CVariant &getValue(
const Element &element)
const;
100 CVariant getValueCopy(
const Element &element)
const;
103 CStatusMessage setValue(Element &element, CVariant value, qint64 timestamp,
bool save =
false);
106 const QString &getKey(
const Element &element)
const;
109 qint64 getTimestamp(
const Element &element)
const;
112 bool isSaved(
const Element &element)
const;
115 bool isSaving(
const Element &element)
const;
122 void setValuesFromCache(
const swift::misc::CValueCachePacket &values, QObject *changedBy);
136 void valuesWantToCache(
const swift::misc::CValueCachePacket &values);
139 using ElementPtr = QSharedPointer<Element>;
141 CValueCache *m_cache =
nullptr;
142 QMap<QString, ElementPtr> m_elements;
144 CVariantMap m_batchedValues;
146 CValuePage(QObject *parent, CValueCache *cache);
147 CStatusMessage validate(
const Element &element,
const CVariant &value,
148 CStatusMessage::StatusSeverity invalidSeverity)
const;
Value object encapsulating information identifying a component of a modular distributed swift process...
Manages a map of { QString, CVariant } pairs, which can be distributed among multiple processes.
Value class used for signalling changed values in the cache.
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.