/** * The Service class holds information about a single service, which was read from a xxx_service.xml file. * $Id$ * $HeadURL$ * $Author$ * Created by Hannes Baeuerle, SLSE, 2016-02-15 */ #pragma once #include #include #include #include #include "logger.h" class QProcess; namespace ServiceManagement { class LicenceDonator; class ServiceInformation; class ServiceProcess; class Service final : public QObject { Q_OBJECT public: explicit Service(const QString &name, const QString &exe, const QString &dir, const QString &abbr, const QStringList &groups, bool isInDevMode, const int prio); int id() const; const QString &name() const; const int &prio() const; const QString &abbreviation() const; const QStringList &groups() const; bool devMode() const; std::shared_ptr licenceDonator(); ServiceProcess *toServiceProcess(const GroupRequest &groupData); ServiceProcess *procFromPid(qint64 pid); ServiceProcess *procFromServiceProcId(int32_t id); const QVector &allProcs() const; void stopAllProcs(); void waitForStopped(); void setLicenceDonator(const std::shared_ptr &licenceDonator) { m_licenceDonator = licenceDonator; } private Q_SLOTS: void onServiceProcessDestroyed(QObject *obj); Q_SIGNALS: void newServiceInfo(const ServiceInformation &info); private: QString m_name; QString m_executable; QString m_directory; QString m_abbreviation; QStringList m_groups; bool m_isInDevMode; unsigned int m_id; QVector m_procs; std::shared_ptr m_licenceDonator; int m_prio; LOGGER_T m_logger; static int32_t idCounter; }; } // namespace ServiceManagement