Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+93
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Exercises Handler - checks the avilable exercises and creates subhandlers fort each of them
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-04-14
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <dds/core/Optional.hpp>
|
||||
|
||||
namespace WarehouseManagement
|
||||
{
|
||||
struct ParticipantInfoStruct
|
||||
{
|
||||
int equipmentNumber = 0;
|
||||
int participantId = 0;
|
||||
int exerciseId = 0;
|
||||
};
|
||||
inline std::ostream &operator <<(std::ostream &stream, const ParticipantInfoStruct &pis)
|
||||
{
|
||||
stream << "exerciseId = " << pis.exerciseId
|
||||
<< ", participantId = " << pis.participantId
|
||||
<< ", equipmentNumber = " << pis.equipmentNumber;
|
||||
return stream;
|
||||
}
|
||||
|
||||
class ExerciseParticipantHandler;
|
||||
class ExercisesHandler : public QObject,
|
||||
protected ParticipantManagement::Interface::Ftc::ModifyEquipmentTypeDataReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExercisesHandler(const std::shared_ptr<DdsHandler> &ddsHandler);
|
||||
~ExercisesHandler();
|
||||
|
||||
bool init();
|
||||
|
||||
QMap<qint32, ExerciseManagement::Exercise> getExercises() const;
|
||||
ParticipantManagement::Party getParty(int partyId, int exerciseId) const;
|
||||
ParticipantManagement::Participant getParticipant(int participantId, int exerciseId) const;
|
||||
QString getHierarchyFromParticipant(int participantId, int exerciseId, const QMap<int, ParticipantManagement::Participant> &allParticipants) const;
|
||||
QMap<qint32, ParticipantManagement::Participant> getParticipants(int exerciseId) const;
|
||||
ParticipantManagement::Type participantType(int typeId) const;
|
||||
ParticipantManagement::TypeClass typeClassIdFromEquipmentTypeId(int equipTypeId) const;
|
||||
|
||||
bool registerParticipant(int exerciseId, qint32 participantId,
|
||||
ParticipantManagement::ParticipantAssignState assignState,
|
||||
const dds::core::optional<int> &equipNo,
|
||||
const dds::core::optional<QString> &identification,
|
||||
const dds::core::optional<QString> &info);
|
||||
|
||||
bool unregisterParticipant(int exerciseId, qint32 equipNo);
|
||||
|
||||
bool modifyEquipmentTypes(const std::vector<ParticipantManagement::EquipmentType> &vectorEquipTypes);
|
||||
|
||||
// key is the equipment number + exerciseId
|
||||
bool addParticipant(const ParticipantInfoStruct &pis);
|
||||
// key is the equipment number + exerciseId
|
||||
bool modifyParticipant(const ParticipantInfoStruct &pis);
|
||||
// key is the equipment number + exerciseId
|
||||
bool removeParticipant(const ParticipantInfoStruct &pis);
|
||||
|
||||
QVector<ParticipantInfoStruct> infoStructForEquipment(int equipmentNumber) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void registrationReturnValue(int exerciseId, qint32 participantId, ParticipantManagement::RegisterReturnValue retValue);
|
||||
void participantChanged(const ParticipantManagement::Participant &data, DataModification modType, int exerciseId);
|
||||
void exerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType);
|
||||
|
||||
private:
|
||||
void exerciseAdded(int exerciseId);
|
||||
void exerciseRemoved(int exerciseId);
|
||||
QMultiHash<int, ParticipantInfoStruct>::iterator findParticipant(const ParticipantInfoStruct &pis);
|
||||
private Q_SLOTS:
|
||||
void onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType);
|
||||
void onModifyEquipmentTypeDataReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
QHash<int, ExerciseParticipantHandler *> m_exerciseHandler;
|
||||
// QMultiMap<equipmentNumber, ParticipantInfoStruct>
|
||||
QMultiHash<int, ParticipantInfoStruct> m_participants;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace WarehouseManagement
|
||||
Reference in new issue
Block a user