Warning, file /plasma/libksysguard/systemstats/SensorContainer.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 0015 #include "systemstats_export.h" 0016 0017 namespace KSysGuard 0018 { 0019 class SensorObject; 0020 0021 /** 0022 * Represents a collection of similar sensors. 0023 * For example: a SensorContainer could represent all CPUs or represent all disks 0024 */ 0025 class SYSTEMSTATS_EXPORT SensorContainer : public QObject 0026 { 0027 Q_OBJECT 0028 public: 0029 explicit SensorContainer(const QString &id, const QString &name, SensorPlugin *parent); 0030 ~SensorContainer() override; 0031 0032 /** 0033 * A computer readable ID of this group of sensors 0034 */ 0035 QString id() const; 0036 /** 0037 * A human readable name, used for selection 0038 */ 0039 QString name() const; 0040 0041 QList<SensorObject *> objects(); 0042 SensorObject *object(const QString &id) const; 0043 0044 /** 0045 * Add an object to the container. 0046 * 0047 * It will be exposed to clients as a subitem of this container. 0048 * 0049 * \param object The SensorObject to add. 0050 */ 0051 void addObject(SensorObject *object); 0052 0053 /** 0054 * Remove an object from the container. 0055 * 0056 * It will no longer be available to clients. 0057 * 0058 * \param object The SensorObject to remove. 0059 */ 0060 void removeObject(SensorObject *object); 0061 0062 Q_SIGNALS: 0063 /** 0064 * Emitted when an object has been added 0065 */ 0066 void objectAdded(SensorObject *object); 0067 /** 0068 * Emitted after an object has been removed 0069 * it may not be valid at this time 0070 */ 0071 void objectRemoved(SensorObject *object); 0072 0073 private: 0074 class Private; 0075 const std::unique_ptr<Private> d; 0076 }; 0077 0078 } // namespace KSysGuard