Warning, file /plasma/libksysguard/systemstats/SensorObject.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include <QObject>
0012 
0013 #include "SensorPlugin.h"
0014 #include "SensorProperty.h"
0015 
0016 #include "systemstats_export.h"
0017 
0018 namespace KSysGuard
0019 {
0020 class SensorContainer;
0021 class SensorObject;
0022 
0023 /**
0024  * Represents a physical or virtual object for example
0025  * A CPU core, or a disk
0026  */
0027 class SYSTEMSTATS_EXPORT SensorObject : public QObject
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit SensorObject(const QString &id, const QString &name, SensorContainer *parent = nullptr);
0032     explicit SensorObject(const QString &id, SensorContainer *parent = nullptr);
0033     ~SensorObject() override;
0034 
0035     QString id() const;
0036     QString path() const;
0037     QString name() const;
0038 
0039     void setName(const QString &newName);
0040     void setParentContainer(SensorContainer *parent);
0041 
0042     QList<SensorProperty *> sensors() const;
0043     SensorProperty *sensor(const QString &sensorId) const;
0044 
0045     void addProperty(SensorProperty *property);
0046 
0047     bool isSubscribed() const;
0048 
0049 Q_SIGNALS:
0050     /**
0051      * Emitted when a client subscribes to one or more of the underlying properties of this object
0052      */
0053     void subscribedChanged(bool);
0054 
0055     /**
0056      * Emitted just before deletion
0057      * The object is still valid at this point
0058      */
0059     void aboutToBeRemoved();
0060 
0061     /**
0062      * Emitted whenever the object's name changes.
0063      */
0064     void nameChanged();
0065 
0066 private:
0067     class Private;
0068     const std::unique_ptr<Private> d;
0069 };
0070 
0071 } // namespace KSysGuard