86 lines
2.1 KiB
C++
Executable File
86 lines
2.1 KiB
C++
Executable File
/**
|
|
* The Group class represents a group which was already startet.
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Baeuerle, SLSE, 2016-02-15
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QMap>
|
|
#include <QtCore/QProcess>
|
|
#include <QtCore/QElapsedTimer>
|
|
|
|
#include <DDS/Core/core_enums.hpp>
|
|
|
|
#include "logger.h"
|
|
#include "dds_handler.h"
|
|
#include "service_process.h"
|
|
|
|
class QTimer;
|
|
|
|
namespace ServiceManagement
|
|
{
|
|
struct GroupScheme;
|
|
|
|
class GroupInformation;
|
|
class ServiceDonator;
|
|
class ServiceInformation;
|
|
|
|
class Group final : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
Group(const std::shared_ptr<DdsHandler> &ddsHandler,
|
|
const std::shared_ptr<ServiceDonator> &serviceDonator,
|
|
const GroupRequest &groupData,
|
|
GroupScheme *scheme,
|
|
QObject *parent);
|
|
~Group();
|
|
|
|
bool setRunningState(Core::RunningState newState);
|
|
|
|
void startCore();
|
|
void start();
|
|
void stop();
|
|
void restart();
|
|
|
|
void takeServicesFromGroup(Group *otherGroup);
|
|
|
|
bool allProcsStopped() const;
|
|
Core::ServiceGroupType type() const;
|
|
int32_t domainId() const { return m_groupData.domainId(); }
|
|
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId(); }
|
|
int32_t replayPartitionId() const { return m_groupData.replayPartitionId(); }
|
|
int32_t id() const { return m_groupId; }
|
|
qint64 lastHeartbeatMSec() const;
|
|
|
|
QMap<int, ServiceProcess *> serviceProcs() const;
|
|
|
|
private Q_SLOTS:
|
|
void onNewServiceInfo();
|
|
void onCompleteCoreTick();
|
|
|
|
private: // methods
|
|
void init();
|
|
ServiceProcess *procFromPid(Q_PID pid);
|
|
|
|
private: // attributes
|
|
std::shared_ptr<DdsHandler> m_ddsHandler;
|
|
std::shared_ptr<ServiceDonator> m_serviceDonator;
|
|
GroupScheme *m_scheme;
|
|
int32_t m_groupId;
|
|
GroupRequest m_groupData;
|
|
QMap<int, ServiceProcess *> m_serviceProcs;
|
|
qint64 m_completeCoreTimeout;
|
|
QElapsedTimer m_elapsedTimer;
|
|
int m_actPrio = 1;
|
|
LOGGER_T m_logger;
|
|
|
|
static int32_t s_idCounter;
|
|
int getNextPrio(QList<int> &prioList);
|
|
};
|
|
} // namespace ServiceManagement
|