Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+89
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* The GroupHandler class handles all group related classes and writes the groups state to DDS.
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2016-02-15
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "logger.h"
|
||||
#include "dds_handler.h"
|
||||
#include "group.h"
|
||||
|
||||
namespace ServiceManagement
|
||||
{
|
||||
class HeartbeatListener;
|
||||
class ServiceDonator;
|
||||
|
||||
struct GroupScheme
|
||||
{
|
||||
const Core::ServiceGroupType groupType;
|
||||
const QString groupName;
|
||||
QSet<int> services;
|
||||
|
||||
explicit GroupScheme(Core::ServiceGroupType type, const QString &name) : groupType(type) , groupName(name) {}
|
||||
|
||||
void addServiceId(int serviceId)
|
||||
{
|
||||
services += serviceId;
|
||||
}
|
||||
};
|
||||
|
||||
class GroupHandler final
|
||||
: public QObject
|
||||
, protected Interface::Fts::StartGroupRequestHandler
|
||||
, protected Interface::Fts::StopGroupRequestHandler
|
||||
, protected Interface::Fts::RestartGroupRequestHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GroupHandler(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<ServiceDonator> &donator);
|
||||
~GroupHandler();
|
||||
|
||||
bool init(int32_t coreDomain);
|
||||
|
||||
void addServiceLink(int serviceId, Core::ServiceGroupType groupType);
|
||||
|
||||
QVector<Group *> groups() const;
|
||||
|
||||
virtual void onStartGroupRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GroupRequest &request) override final;
|
||||
virtual void onStopGroupRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GroupRequest &request) override final;
|
||||
virtual void onRestartGroupRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GroupRequest &request) override final;
|
||||
public Q_SLOTS:
|
||||
void slotStartGroupRequest(const GroupRequest &request);
|
||||
void slotStopGroupRequest(const GroupRequest &request);
|
||||
Q_SIGNALS:
|
||||
void startGroupReply(const Core::FunctionReplyObject &reply);
|
||||
void stopGroupReply(const Core::FunctionReplyObject &reply);
|
||||
private:
|
||||
Core::FunctionReplyObject onStartGroup(const GroupRequest &request);
|
||||
Core::FunctionReplyObject onStopAllForExercise(int domainId, int exercisePartitionId);
|
||||
Core::FunctionReplyObject onStopGroup(const GroupRequest &request);
|
||||
Core::FunctionReplyObject onRestartGroup(const GroupRequest &request);
|
||||
private: // methods
|
||||
GroupScheme *groupSchemeFromType(Core::ServiceGroupType type);
|
||||
Group *getGroup(const GroupRequest &groupToFind) const;
|
||||
Group *getSimilarGroup(const GroupRequest &groupToFind) const;
|
||||
bool startGroupCore(int32_t domainId);
|
||||
|
||||
private: // attributes
|
||||
QVector<GroupScheme *> m_groupSchemes;
|
||||
QVector<Group *> m_groups;
|
||||
std::shared_ptr<ServiceDonator>m_serviceDonator;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
HeartbeatListener *m_heartbeatListener;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
static qint64 groupIdCounter;
|
||||
};
|
||||
} // namespace ServiceManagement
|
||||
Reference in new issue
Block a user