Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Custom record/replay functions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include <ParticipantHandling/participant.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantForReplay final : public ParticipantHandling::Participant
|
||||
{
|
||||
public:
|
||||
ParticipantForReplay(ParticipantHandling::ParticipantHandler *participantHandler,
|
||||
ParticipantHandling::UnitPositionCalculator *unitPosCalculator,
|
||||
const Database::PpmParticipant &data)
|
||||
: ParticipantHandling::Participant(participantHandler,
|
||||
unitPosCalculator,
|
||||
data,
|
||||
"ParticipantForReplay")
|
||||
{}
|
||||
protected:
|
||||
bool updateEquipmentExerciseMapping(int, int) { return true; }
|
||||
};
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Custom record/replay functions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
#include "participant_handler_for_replay.h"
|
||||
|
||||
#include "participant_for_replay.h"
|
||||
#include "ppm_record_replay_plugin_custom.h"
|
||||
#include <ParticipantHandling/unit_position_calculator.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
//
|
||||
// ParticipantHandlerForReplay
|
||||
//
|
||||
ParticipantHandlerForReplay::ParticipantHandlerForReplay(RecordReplayPluginCustom *replayPlugin)
|
||||
: ParticipantHandling::ParticipantHandler(replayPlugin, "ParticipantHandlerForReplay")
|
||||
{}
|
||||
|
||||
static inline Database::PpmParticipant toDb(const ParticipantManagement::Participant &ddsPart)
|
||||
{
|
||||
Database::PpmParticipant db;
|
||||
db.id = ddsPart.id();
|
||||
db.assignState = ddsPart.assignState();
|
||||
db.partyId = ddsPart.partyId();
|
||||
db.typeId = ddsPart.typeId();
|
||||
db.externalId = ddsPart.externalId();
|
||||
db.designator = QString::fromStdString(ddsPart.designator());
|
||||
db.equipmentNumber = ddsPart.equipmentNumber().is_set() ? ddsPart.equipmentNumber().get() : 0;
|
||||
db.hierarchyNumber = ddsPart.hierarchyNumber();
|
||||
db.identification = QString::fromStdString(ddsPart.identification());
|
||||
db.info = QString::fromStdString(ddsPart.info());
|
||||
db.isDeleted = ddsPart.isDeleted();
|
||||
db.isSimulated = ddsPart.isSimulated();
|
||||
db.name = QString::fromStdString(ddsPart.name());
|
||||
db.superiorId = ddsPart.superiorId();
|
||||
db.symbol = QString::fromStdString(ddsPart.symbol());
|
||||
db.tacticalIdentifier = QString::fromStdString(ddsPart.tacticalIdentifier());
|
||||
db.properties = QString::fromStdString(ddsPart.properties());
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::createUpdateParticipant(const ParticipantManagement::Participant &ddsPart)
|
||||
{
|
||||
auto *p = m_participants.value(ddsPart.id());
|
||||
if (!p)
|
||||
{
|
||||
p = new ParticipantForReplay(this,
|
||||
m_unitPositionCalculator.get(),
|
||||
toDb(ddsPart));
|
||||
m_participants.insert(ddsPart.id(), p);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->hasToBeChanged(ddsPart);
|
||||
}
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::removeParticipant(const ParticipantManagement::Participant &ddsPart)
|
||||
{
|
||||
// maybe clear m_hitLineInfoMap for this participant also but is this a real-world problem?
|
||||
|
||||
auto *p = m_participants.take(ddsPart.id());
|
||||
if (p)
|
||||
{
|
||||
p->removeFromDds();
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParticipantHandlerForReplay::setDynamicParticipantData(const ParticipantManagement::DynamicParticipantData &dynPart)
|
||||
{
|
||||
auto *p = m_participants.value(dynPart.participantId());
|
||||
if (!p) {
|
||||
WARNING_LOG(m_logger) << "Got dynamic participant data for unknown participant with id " << dynPart.participantId();
|
||||
return;
|
||||
}
|
||||
p->setDynamicData(dynPart);
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::publishData()
|
||||
{
|
||||
for (auto p : qAsConst(m_participants))
|
||||
{
|
||||
p->publishParticipant();
|
||||
p->publishDynamicData();
|
||||
p->publishPosition();
|
||||
}
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::startUnitPositionCalculator()
|
||||
{
|
||||
m_unitPositionCalculator->startCalculation();
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::stopUnitPositionCalculator()
|
||||
{
|
||||
m_unitPositionCalculator->stopCalculation();
|
||||
}
|
||||
|
||||
void ParticipantHandlerForReplay::waitForUnitPositionCalculator()
|
||||
{
|
||||
m_unitPositionCalculator->waitForCalculationFinished();
|
||||
}
|
||||
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Custom record/replay functions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm_dts.h>
|
||||
#include <ParticipantHandling/participant_handler.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class RecordReplayPluginCustom;
|
||||
class ParticipantHandlerForReplay final : public ParticipantHandling::ParticipantHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ParticipantHandlerForReplay(RecordReplayPluginCustom *replayPlugin);
|
||||
|
||||
void createUpdateParticipant(const ParticipantManagement::Participant &ddsPart);
|
||||
void removeParticipant(const ParticipantManagement::Participant &ddsPart);
|
||||
void setDynamicParticipantData(const ParticipantManagement::DynamicParticipantData &dynPart);
|
||||
|
||||
void publishData();
|
||||
|
||||
void startUnitPositionCalculator();
|
||||
void stopUnitPositionCalculator();
|
||||
void waitForUnitPositionCalculator();
|
||||
protected:
|
||||
bool isSampleTimeInFuture(qint64 sampleTime) const { Q_UNUSED(sampleTime); return false; }
|
||||
bool isSampleTimeOutdated(qint64 sampleTime) const { Q_UNUSED(sampleTime); return false; }
|
||||
};
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Custom record/replay functions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "ppm_record_replay_plugin_custom.h"
|
||||
#include "participant_handler_for_replay.h"
|
||||
#include <DDS/DTS/generic_dts_impl.h>
|
||||
#include <DDS/DTC/generic_dtc_impl.h>
|
||||
|
||||
#include <QtConcurrent>
|
||||
static bool OPTIMZE = true; // GUEZE-3521 "Überarbeitung des Replays zur Performance Steigerung"
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
//
|
||||
// RecordReplayPluginCustom
|
||||
//
|
||||
RecordReplayPluginCustom::RecordReplayPluginCustom()
|
||||
: m_participantHandler(nullptr)
|
||||
, m_tabRecordReplay(nullptr)
|
||||
, m_currentReplayTime(0)
|
||||
{
|
||||
INFO_LOG(m_logger) << "RecordReplayPluginCustom ctor";
|
||||
}
|
||||
|
||||
RecordReplayPluginCustom::~RecordReplayPluginCustom()
|
||||
{
|
||||
delete m_tabRecordReplay;
|
||||
delete m_participantHandler;
|
||||
}
|
||||
|
||||
bool RecordReplayPluginCustom::initDts(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
|
||||
int exerciseId,
|
||||
bool bCanHandleSchemas,
|
||||
NSqlQuery &query)
|
||||
{
|
||||
m_tabRecordReplay = new TrainingAreaBase::RecordReplayPluginCustom;
|
||||
// they will both return false due to missing ddsConnector...
|
||||
m_tabRecordReplay->initDts(nullptr, exerciseId, bCanHandleSchemas, query);
|
||||
RecordReplayPlugin::initDts(nullptr, exerciseId, bCanHandleSchemas, query);
|
||||
|
||||
// *after* initDts
|
||||
m_ddsConnector = ddsConnector;
|
||||
|
||||
// own published data
|
||||
m_ddsDts = ParticipantManagement::Interface::Dts::create(m_ddsConnector);
|
||||
m_ddsDts->enableBite();
|
||||
m_ddsDts->enableDynamicParticipantData();
|
||||
m_ddsDts->enableHitLineInfo();
|
||||
m_ddsDts->enableUAS();
|
||||
m_ddsDts->enableParticipant();
|
||||
m_ddsDts->enableParticipantGearEvent();
|
||||
m_ddsDts->enableParticipantMode();
|
||||
m_ddsDts->enableParticipantPosition();
|
||||
m_ddsDts->enableUnitPosition();
|
||||
|
||||
m_ddsDts->enableParticipant();
|
||||
|
||||
// data from recording tables (published via RecordReplayPlugin::publishFoo() functions)
|
||||
m_dtsParty.reset(m_ddsConnector->createDTS<DTS::PartyImpl>());
|
||||
// publish initial party information to be able to fill the comboboxes (e.g. for filtering)
|
||||
const qint64 startTime = time(nullptr) * 1000LL;
|
||||
readPartyAt(query, startTime);
|
||||
publishParty(startTime);
|
||||
readParticipantAt(query, startTime);
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readParticipantAt before" << m_participantMap.count();
|
||||
removeOld(m_participantMap, startTime);
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readParticipantAt AFTER " << m_participantMap.count();
|
||||
publishParticipant(startTime);
|
||||
DEBUG_LOG(m_logger) << "RecordReplayPluginCustom::initDts successful";
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void RecordReplayPluginCustom::removeOld(QMultiMap<long long, T> &map, qint64 desiredTime)
|
||||
{
|
||||
if (!OPTIMZE)
|
||||
return;
|
||||
Q_UNUSED(desiredTime);
|
||||
|
||||
auto copy = map;
|
||||
for (const auto &item : copy.keys())
|
||||
{
|
||||
for (const auto &inner : map.values(item))
|
||||
{
|
||||
// Remove delted ones
|
||||
if (inner.isDeleted())
|
||||
{
|
||||
map.remove(item, inner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime)
|
||||
{
|
||||
INFO_LOG(m_logger) << "setReplayStartTime " << startTime;
|
||||
m_currentReplayTime = 0;
|
||||
|
||||
if (!readParticipantAt(q, startTime))
|
||||
return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-readParticipantAt " << startTime << " DONE";
|
||||
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readParticipantAt before" << m_participantMap.count();
|
||||
removeOld(m_participantMap, startTime);
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readParticipantAt after" << m_participantMap.count();
|
||||
|
||||
//create eqMap
|
||||
// 2026-03-16: N.Thoden, E01562-183 "Prüfung Replay"
|
||||
// If container 'm_equipmentNumbers' is filled and used at makeConcurrent()
|
||||
// (at least for type EquipmentPosition) some participant are accidentally skipped:
|
||||
// Since manually 'move players' / 'Tln nachführen' uses the participant id (and not eqno),
|
||||
// they are not honored by preparing 'm_equipmentNumbers'
|
||||
// Later on, while preparing the publishing of the EquipmentPosition, the corresponding
|
||||
// Participant does not exist and so the EquipmentPosition could not be published.
|
||||
// So keep m_equipmentNumbers empty or remove the completly.
|
||||
m_equipmentNumbers.clear();
|
||||
// if (OPTIMZE)
|
||||
// {
|
||||
// for (const auto &p : m_participantMap)
|
||||
// {
|
||||
// if (p.equipmentNumber().is_set())
|
||||
// m_equipmentNumbers.insert(p.equipmentNumber().get());
|
||||
// }
|
||||
// DEBUG_LOG(m_logger) << "setReplayStartTime-m_equipmentNumbers after" << m_equipmentNumbers.count();
|
||||
// }
|
||||
|
||||
|
||||
if (!readDynamicParticipantDataAt(q, startTime)) return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-readDynamicParticipantDataAt " << startTime << " DONE";
|
||||
//Manual
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readDynamicParticipantDataAt before" << m_dynamicParticipantDataMap.count();
|
||||
if (OPTIMZE)
|
||||
{
|
||||
const auto &backup = m_dynamicParticipantDataMap;
|
||||
for (const auto &key : backup.keys())
|
||||
{
|
||||
const auto &inner = backup.values(key);
|
||||
for (const auto &value : inner)
|
||||
{
|
||||
if (m_participantKeys.find(value.participantId()) == m_participantKeys.end())
|
||||
m_dynamicParticipantDataMap.remove(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "setReplayStartTime-readDynamicParticipantDataAt after" << m_dynamicParticipantDataMap.count();
|
||||
|
||||
|
||||
|
||||
if (!readPartyAt(q, startTime)) return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-readPartyAt " << startTime << " DONE";
|
||||
|
||||
if (!readHitLineInfoAt(q, startTime)) return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-readHitLineInfoAt " << startTime << " DONE";
|
||||
//removeOld(m_hitLineInfoMap, startTime);
|
||||
|
||||
if (!readUASAt(q, startTime)) return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-readUASAt" << startTime << " DONE";
|
||||
|
||||
if (!m_tabRecordReplay->ppmSetReplayStartTime(q, startTime)) return false;
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-ppmSetReplayStartTime " << startTime << " DONE";
|
||||
|
||||
publishParty(startTime);
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-publishParty " << startTime << " DONE";
|
||||
|
||||
// create data for ParticipantManagement
|
||||
if (!m_participantHandler)
|
||||
{
|
||||
m_participantHandler = new ParticipantHandlerForReplay(this);
|
||||
if (!m_participantHandler->init())
|
||||
return false;
|
||||
}
|
||||
m_participantHandler->stopUnitPositionCalculator();
|
||||
m_participantHandler->clearParticipants();
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-clearParticipants " << startTime << " DONE";
|
||||
|
||||
for (const auto &ddsParticipant : qAsConst(m_participantMap))
|
||||
m_participantHandler->createUpdateParticipant(ddsParticipant);
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-createUpdateParticipant " << startTime << " DONE";
|
||||
|
||||
for (const auto &dynParticipant : qAsConst(m_dynamicParticipantDataMap))
|
||||
m_participantHandler->setDynamicParticipantData(dynParticipant);
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-setDynamicParticipantData " << startTime << " DONE";
|
||||
|
||||
|
||||
setDataForParticipants(startTime);
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-setDataForParticipants " << startTime << " DONE";
|
||||
|
||||
m_currentReplayTime = startTime;
|
||||
m_participantHandler->startUnitPositionCalculator();
|
||||
INFO_LOG(m_logger) << "setReplayStartTime-startUnitPositionCalculator " << startTime << " DONE";
|
||||
|
||||
INFO_LOG(m_logger) << "setReplayStartTime " << startTime << " ... DONE";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecordReplayPluginCustom::ddsTopicsFromDatabase(NSqlQuery &q, qint64 fromTime, qint64 toTime)
|
||||
{
|
||||
INFO_LOG(m_logger) << "ddsTopicsFromDatabase " << fromTime << " to " << toTime;
|
||||
if (!readParticipant(q, fromTime, toTime)) return false;
|
||||
if (!readParty(q, fromTime, toTime)) return false;
|
||||
if (!readHitLineInfo(q, fromTime, toTime)) return false;
|
||||
if (!readUAS(q, fromTime, toTime)) return false;
|
||||
|
||||
return m_tabRecordReplay->ppmDdsTopicsFromDatabase(q, fromTime, toTime);
|
||||
}
|
||||
|
||||
bool RecordReplayPluginCustom::publishData(qint64 desiredTime)
|
||||
{
|
||||
if (!m_participantHandler)
|
||||
return false;
|
||||
INFO_LOG(m_logger) << "publishData " << desiredTime;
|
||||
m_currentReplayTime = desiredTime;
|
||||
|
||||
if (!publishParty(desiredTime))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not publish party information for " << desiredTime;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const Participant &p : qAsConst(m_participantMap))
|
||||
m_participantHandler->createUpdateParticipant(p);
|
||||
for (const Participant &p : qAsConst(m_participantDisposedMap))
|
||||
m_participantHandler->removeParticipant(p);
|
||||
|
||||
setDataForParticipants(desiredTime);
|
||||
m_participantHandler->onHitLineInfoTimeout();
|
||||
m_participantHandler->publishData();
|
||||
|
||||
m_equipmentNumbers.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecordReplayPluginCustom::waitForAsyncOperations(qint64 desiredTime)
|
||||
{
|
||||
if (!m_participantHandler)
|
||||
return false;
|
||||
Q_UNUSED(desiredTime);
|
||||
m_participantHandler->waitForUnitPositionCalculator();
|
||||
m_participantHandler->publishData();
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecordReplayPluginCustom::clearData()
|
||||
{
|
||||
RecordReplayPlugin::clearData();
|
||||
if (m_tabRecordReplay)
|
||||
m_tabRecordReplay->clearData();
|
||||
if (m_participantHandler)
|
||||
m_participantHandler->clearParticipants();
|
||||
// we do not remove the party information here so we're able to modify the filters during stop
|
||||
// clearDataParty();
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
void RecordReplayPluginCustom::newDataForParticipants(T &cont, qint64 desiredTime)
|
||||
{
|
||||
auto it = cont.begin();
|
||||
while (it != cont.end() && it.key() <= desiredTime)
|
||||
{
|
||||
m_participantHandler->newData(*it);
|
||||
it = cont.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QVector<QFuture<void>> RecordReplayPluginCustom::makeConcurrentWithoutEquipNo(T &content, qint64 startTime)
|
||||
{
|
||||
QVector<T> contentVec;
|
||||
contentVec.append(T());
|
||||
|
||||
QVector<QFuture<void>> result;
|
||||
|
||||
// split content into several (contentVec)
|
||||
auto it = content.begin();
|
||||
while (it != content.end() && it.key() <= startTime)
|
||||
{
|
||||
contentVec[contentVec.size() - 1].insert(it.key(), it.value());
|
||||
|
||||
if (contentVec[contentVec.size() - 1].size() == 200)
|
||||
contentVec.append(T());
|
||||
|
||||
it = content.erase(it);
|
||||
} // while
|
||||
|
||||
for (auto contentIndex : qAsConst(contentVec))
|
||||
{
|
||||
// execute in workerThread
|
||||
result.append(QtConcurrent::run([this, contentIndex]()
|
||||
{
|
||||
for (auto it = contentIndex.begin(); it != contentIndex.end(); ++it)
|
||||
{
|
||||
m_participantHandler->newData(*it);
|
||||
}
|
||||
}));
|
||||
} // for
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
QVector<QFuture<void>> RecordReplayPluginCustom::makeConcurrent(T &content, qint64 startTime)
|
||||
{
|
||||
QVector<T> contentVec;
|
||||
contentVec.append(T());
|
||||
|
||||
QVector<QFuture<void>> result;
|
||||
|
||||
// split content into several (contentVec)
|
||||
auto it = content.begin();
|
||||
while (it != content.end() && it.key() <= startTime)
|
||||
{
|
||||
contentVec[contentVec.size() - 1].insert(it.key(), it.value());
|
||||
|
||||
if (contentVec[contentVec.size() - 1].size() == 200)
|
||||
contentVec.append(T());
|
||||
|
||||
it = content.erase(it);
|
||||
} // while
|
||||
|
||||
for (auto contentIndex : qAsConst(contentVec))
|
||||
{
|
||||
// execute in workerThread
|
||||
result.append(QtConcurrent::run([this, contentIndex]()
|
||||
{
|
||||
for (auto it = contentIndex.begin(); it != contentIndex.end(); ++it)
|
||||
{
|
||||
// following is relavant to a) OPTIMZE = true; // GUEZE-3521 and b) E01562-183 "Prüfung Replay"
|
||||
if (m_equipmentNumbers.isEmpty() || m_equipmentNumbers.contains(abs(it->equipmentNumber())))
|
||||
m_participantHandler->newData(*it);
|
||||
}
|
||||
}));
|
||||
} // for
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool RecordReplayPluginCustom::setDataForParticipants(qint64 startTime)
|
||||
{
|
||||
if (!m_participantHandler)
|
||||
return false;
|
||||
// now read data from Tab
|
||||
// not (yet) used functions in ParticipantHandler:
|
||||
// void onNewCtaDataErrorFromProxy(const TrainingAreaBase::CtaDataError &error);
|
||||
// void onNewParticipantModeReport(const TrainingAreaBase::ParticipantModeReport &report);
|
||||
// not (yet) used TAB topics
|
||||
// getCtaDataErrorMap()
|
||||
// getDefinitionIedMap()
|
||||
// getEquipmentConfigurationReportMap()
|
||||
// getEquipmentEventMap()
|
||||
// getEquipmentMessageMap()
|
||||
// getFireSmokeMarkerDataMap()
|
||||
// getFunctionalAreaEntryMap()
|
||||
// getGeopairingDataMap()
|
||||
// getMineTriggeredMap()
|
||||
// getMinelayerThrowerDataMap()
|
||||
// getMinelayerTrailerDataMap()
|
||||
// getOperatorActionMap()
|
||||
// getParticipantConfigurationReportMap()
|
||||
// getParticipantModeReportMap()
|
||||
// getParticipantSwVersionsMap()
|
||||
// getStateIedMap()
|
||||
// getTargetDataMap()
|
||||
|
||||
//#define USE_THIS_THREAD
|
||||
#ifdef USE_THIS_THREAD
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentBiteMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearAssignmentMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearChargeStateMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearEventMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentOperationalStateMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentPositionMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentStateMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getSpecialSensorDataMap(), startTime);
|
||||
newDataForParticipants(getHitLineInfoMap(), startTime);
|
||||
#else
|
||||
// This approach is from Hannes to overcome blocking dds writer:
|
||||
QVector<QFuture<void>> futVec = makeConcurrent(m_tabRecordReplay->getEquipmentPositionMap(), startTime);
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentBiteMap(), startTime));
|
||||
//futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentGearAssignmentMap(), startTime));
|
||||
//futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentGearChargeStateMap(), startTime));
|
||||
//futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentGearEventMap(), startTime));
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearAssignmentMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearChargeStateMap(), startTime);
|
||||
newDataForParticipants(m_tabRecordReplay->getEquipmentGearEventMap(), startTime);
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentOperationalStateMap(), startTime));
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentStateMap(), startTime));
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getSpecialSensorDataMap(), startTime));
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getParticipantSanitationMap(), startTime));
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getParticipantSanitaryMaterialStockReportMap(), startTime));
|
||||
futVec.append(makeConcurrent(m_tabRecordReplay->getEquipmentEventMap(), startTime));
|
||||
futVec.append(makeConcurrentWithoutEquipNo(getHitLineInfoMap(), startTime));
|
||||
futVec.append(makeConcurrentWithoutEquipNo(getUASMap(), startTime));
|
||||
|
||||
for (QFuture<void> &futRef : futVec)
|
||||
futRef.waitForFinished();
|
||||
#endif // USE_THIS_THREAD
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ParticipantManagement
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Custom record/replay functions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm_record_replay_plugin.h>
|
||||
#include <TrainingAreaBase/tab_record_replay_plugin_custom.h>
|
||||
#include <ParticipantManagement/ppm_dts.h>
|
||||
#include <ParticipantManagement/ParticipantHandling/participant_handler.h>
|
||||
#include <QFuture>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantHandlerForReplay;
|
||||
class PPMRECORDREPLAYPLUGIN_EXPORT RecordReplayPluginCustom final : public RecordReplayPlugin
|
||||
, public ParticipantHandling::BaseDataProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "special:3:recordreplay.ppm")
|
||||
Q_INTERFACES(RecordReplay::RecordReplayPlugin)
|
||||
public:
|
||||
RecordReplayPluginCustom();
|
||||
~RecordReplayPluginCustom();
|
||||
|
||||
bool initDts(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
|
||||
int exerciseId,
|
||||
bool bCanHandleSchemas,
|
||||
NSqlQuery &query) override;
|
||||
bool setReplayStartTime(NSqlQuery &q, qint64 startTime) override;
|
||||
bool ddsTopicsFromDatabase(NSqlQuery &q, qint64 fromTime, qint64 toTime) override;
|
||||
bool publishData(qint64 desiredTime) override;
|
||||
bool waitForAsyncOperations(qint64 desiredTime) override;
|
||||
void clearData() override;
|
||||
|
||||
qint64 currentTimeMSec() const override { return m_currentReplayTime; }
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dts> dts() const override { return m_ddsDts; }
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc() const override { return nullptr; }
|
||||
private:
|
||||
template<typename T>
|
||||
void newDataForParticipants(T &cont, qint64 desiredTime);
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
void removeOld(QMultiMap<long long int , T> &map, qint64 desiredTime);
|
||||
|
||||
|
||||
template<typename T>
|
||||
QVector<QFuture<void>> makeConcurrent(T &content, qint64 startTime);
|
||||
template<typename T>
|
||||
QVector<QFuture<void>> makeConcurrentWithoutEquipNo(T &content, qint64 startTime);
|
||||
|
||||
bool setDataForParticipants(qint64 startTime);
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dts> m_ddsDts;
|
||||
ParticipantHandlerForReplay *m_participantHandler;
|
||||
|
||||
TrainingAreaBase::RecordReplayPluginCustom *m_tabRecordReplay;
|
||||
QSet<int64_t> m_equipmentNumbers;
|
||||
qint64 m_currentReplayTime;
|
||||
};
|
||||
} // namespace ParticipantManagement
|
||||
Reference in new issue
Block a user