Migrates Participant and OperatorManagement to generated rtiddsgen API
Converts accessor calls to plain member access in ppm and opm services and plugins.
This commit is contained in:
36 files changed
+513
-529
No files matched your search
+91
-91
@@ -136,20 +136,20 @@ void ParticipantManagement::PpmTests::tryCreateTemplate()
|
||||
std::vector<ParticipantManagement::TemplateData> data;
|
||||
|
||||
ParticipantManagement::TemplateData td;
|
||||
td.modId(100);
|
||||
td.name("Test Template 100");
|
||||
td.designator("100");
|
||||
td.hierarchyNumber(100);
|
||||
td.typeId(19);
|
||||
td.superiorModId(1);
|
||||
td.tacticalIdentifier("100");
|
||||
td.modId = 100;
|
||||
td.name = "Test Template 100";
|
||||
td.designator = "100";
|
||||
td.hierarchyNumber = 100;
|
||||
td.typeId = 19;
|
||||
td.superiorModId = 1;
|
||||
td.tacticalIdentifier = "100";
|
||||
|
||||
data.push_back(td);
|
||||
|
||||
m_dtc->waitForHistoricalDataTemplateParticipant();
|
||||
ParticipantManagement::TemplateParticipant tp = m_dtc->templateParticipant(1);
|
||||
const ParticipantManagement::TemplateData tdSup(m_dtc->convertFromParticipantTemplateToTemplateData(tp));
|
||||
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId();
|
||||
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId;
|
||||
|
||||
data.push_back(tdSup);
|
||||
|
||||
@@ -168,18 +168,18 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send Create ParticipantData per ModifyParticipantData";
|
||||
|
||||
ParticipantManagement::ParticipantData ptd;
|
||||
ptd.modId(1);
|
||||
ptd.name("Test Participant 1");
|
||||
ptd.typeId(m_typeId);
|
||||
ptd.partyId(m_partyId);
|
||||
ptd.equipmentNumber(m_equipmentId);
|
||||
ptd.hierarchyNumber(1);
|
||||
ptd.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
ptd.modId = 1;
|
||||
ptd.name = "Test Participant 1";
|
||||
ptd.typeId = m_typeId;
|
||||
ptd.partyId = m_partyId;
|
||||
ptd.equipmentNumber = m_equipmentId;
|
||||
ptd.hierarchyNumber = 1;
|
||||
ptd.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
|
||||
std::vector<ParticipantManagement::ParticipantData> data;
|
||||
data.push_back(ptd);
|
||||
ModifyParticipantDataRequest req;
|
||||
req.data(data);
|
||||
req.data = data;
|
||||
|
||||
if (!m_ftc->modifyParticipantDataRequest(req,this))
|
||||
{
|
||||
@@ -196,11 +196,11 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send update info per registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
rpr.equipmentNumber(m_equipmentId);
|
||||
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
rpr.identification("Test Indentification");
|
||||
rpr.info("Test Info2");
|
||||
rpr.participantId = m_participantId;
|
||||
rpr.equipmentNumber = m_equipmentId;
|
||||
rpr.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
rpr.identification = "Test Indentification";
|
||||
rpr.info = "Test Info2";
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
@@ -216,11 +216,11 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
rpr.equipmentNumber(m_equipmentId);
|
||||
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
rpr.identification("Test");
|
||||
rpr.info("Test Info");
|
||||
rpr.participantId = m_participantId;
|
||||
rpr.equipmentNumber = m_equipmentId;
|
||||
rpr.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
rpr.identification = "Test";
|
||||
rpr.info = "Test Info";
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
@@ -237,18 +237,18 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
party.name("Test Party AAA");
|
||||
party.role(ParticipantManagement::Role::Friend);
|
||||
party.color(-65536);
|
||||
party.fadingColor(-65536);
|
||||
party.name = "Test Party AAA";
|
||||
party.role = ParticipantManagement::Role::Friend;
|
||||
party.color = -65536;
|
||||
party.fadingColor = -65536;
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -256,17 +256,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party BBB");
|
||||
party.role(ParticipantManagement::Role::Friend);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party BBB";
|
||||
party.role = ParticipantManagement::Role::Friend;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -274,17 +274,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party CCC");
|
||||
party.role(ParticipantManagement::Role::Enemy);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party CCC";
|
||||
party.role = ParticipantManagement::Role::Enemy;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -292,17 +292,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party DDD");
|
||||
party.role(ParticipantManagement::Role::Enemy);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party DDD";
|
||||
party.role = ParticipantManagement::Role::Enemy;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -323,19 +323,19 @@ void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(m_partyId);
|
||||
req.name(std::string("Test Party ")+QString::number(m_partyId).toStdString()); // updating name
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(true); // updating isUsed
|
||||
req.id = m_partyId;
|
||||
req.name = std::string("Test Party ")+QString::number(m_partyId).toStdString(); // updating name
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = true; // updating isUsed
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -355,18 +355,18 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
RemovePartyRequest req;
|
||||
req.partyId(m_partyId);
|
||||
req.partyId = m_partyId;
|
||||
|
||||
if (!m_ftc->removePartyRequest(req,this))
|
||||
{
|
||||
if (party.isUsedBy())
|
||||
if (party.isUsedBy)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Not possible to delete used party!" ;
|
||||
successExit();
|
||||
@@ -387,7 +387,7 @@ void ParticipantManagement::PpmTests::trySyncParties()
|
||||
INFO_LOG(m_logger) << "Trying to sync parties with Ex 0";
|
||||
|
||||
SyncPartiesRequest req;
|
||||
req.exerciseId(42);
|
||||
req.exerciseId = 42;
|
||||
|
||||
if (!m_ftc->syncPartiesRequest(req, this))
|
||||
{
|
||||
@@ -407,15 +407,15 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
ChangePartyUsedStateRequest req;
|
||||
req.partyId(m_partyId);
|
||||
req.isUsedBy(false); // updating isUsed
|
||||
req.partyId = m_partyId;
|
||||
req.isUsedBy = false; // updating isUsed
|
||||
|
||||
if (!m_ftc->changePartyUsedStateRequest(req, this))
|
||||
{
|
||||
@@ -433,14 +433,14 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
||||
INFO_LOG(m_logger) << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
|
||||
|
||||
ParticipantManagement::EquipmentType etd;
|
||||
etd.id(1);
|
||||
etd.name("Test Equipment Type 1");
|
||||
etd.minEquipNo(1000);
|
||||
etd.maxEquipNo(1999);
|
||||
etd.traVulnerabilityModelId(1);
|
||||
etd.traPlayerTypeId(110);
|
||||
etd.wmsTypeClass(ParticipantManagement::WmsTypeClass::Human);
|
||||
etd.deletedInWms(false);
|
||||
etd.id = 1;
|
||||
etd.name = "Test Equipment Type 1";
|
||||
etd.minEquipNo = 1000;
|
||||
etd.maxEquipNo = 1999;
|
||||
etd.traVulnerabilityModelId = 1;
|
||||
etd.traPlayerTypeId = 110;
|
||||
etd.wmsTypeClass = ParticipantManagement::WmsTypeClass::Human;
|
||||
etd.deletedInWms = false;
|
||||
|
||||
std::vector<ParticipantManagement::EquipmentType> data;
|
||||
data.push_back(etd);
|
||||
@@ -581,7 +581,7 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
|
||||
if (replyObject.error() && !party.isUsedBy())
|
||||
if (replyObject.error() && !party.isUsedBy)
|
||||
{
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
@@ -593,8 +593,8 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
|
||||
|
||||
void ParticipantManagement::PpmTests::onRegisterParticipantReply(const RegisterReply &reply)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
|
||||
for ( std::string str : reply.errorParams())
|
||||
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString << "exerciseId: " << reply.exerciseId;
|
||||
for ( std::string str : reply.errorParams)
|
||||
ERROR_LOG(m_logger) << "error params: " << str;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -108,17 +108,17 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
m_mutex.unlock();
|
||||
|
||||
// When a participant can have mounted participants, then there is always mountedParticipants set, can be empty
|
||||
if (newPosition.mountedParticipants().is_set())
|
||||
if (newPosition.mountedParticipants.is_set())
|
||||
{
|
||||
// list of new mounted participants
|
||||
std::vector<int32_t> newMountedParticipantIds;
|
||||
// list of already mounted participants
|
||||
std::vector<int32_t> currentMountedParticipantIds;
|
||||
if (m_positionPublished.mountedParticipants().is_set())
|
||||
currentMountedParticipantIds = m_positionPublished.mountedParticipants().get();
|
||||
if (m_positionPublished.mountedParticipants.is_set())
|
||||
currentMountedParticipantIds = m_positionPublished.mountedParticipants.get();
|
||||
|
||||
// set new position for all mounted participants
|
||||
for (const auto mountedEqId : newPosition.mountedParticipants().get())
|
||||
for (const auto mountedEqId : newPosition.mountedParticipants.get())
|
||||
{
|
||||
Participant *mountedParticipant = particpantHandler()->participantByEquipmentNumber(mountedEqId);
|
||||
|
||||
@@ -196,7 +196,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
|
||||
// set position if (new mounted position) or (unmounting and participant is still mounted)
|
||||
if ((mountedToId > 0) ||
|
||||
(mountedToId <= 0 && m_positionPublished.mountedOn().is_set()))
|
||||
(mountedToId <= 0 && m_positionPublished.mountedOn.is_set()))
|
||||
setPosition(mountedPosition);
|
||||
|
||||
m_positionToPublish.reportingSource(newPosition.position().reportingSource());
|
||||
@@ -802,17 +802,17 @@ bool Participant::hasToBeChanged(const ParticipantManagement::ParticipantBase &d
|
||||
|
||||
int newEquipmentNumber = 0;
|
||||
// don't know why this is needed though
|
||||
if (m_participantData.equipmentNumber().is_set())
|
||||
newEquipmentNumber = m_participantData.equipmentNumber().get();
|
||||
if (m_participantData.equipmentNumber.is_set())
|
||||
newEquipmentNumber = m_participantData.equipmentNumber.get();
|
||||
|
||||
if (data.equipmentNumber().is_set() && m_participantData.equipmentNumber() != data.equipmentNumber())
|
||||
if (data.equipmentNumber.is_set() && m_participantData.equipmentNumber() != data.equipmentNumber())
|
||||
{
|
||||
newEquipmentNumber = data.equipmentNumber().get();
|
||||
newEquipmentNumber = data.equipmentNumber.get();
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// = Reserved for excon
|
||||
if (!data.equipmentNumber().is_set() &&
|
||||
if (!data.equipmentNumber.is_set() &&
|
||||
assignState == ParticipantManagement::ParticipantAssignState::HandoutExcon)
|
||||
{
|
||||
newEquipmentNumber = 0;
|
||||
@@ -836,7 +836,7 @@ bool Participant::hasToBeChanged(const ParticipantManagement::ParticipantBase &d
|
||||
if (curData.typeId() != data.typeId())
|
||||
m_bPublishPosition = !m_participantHandler->isUnitType(data.typeId());
|
||||
|
||||
const int oldEquipNo = curData.equipmentNumber().is_set() ? curData.equipmentNumber().get() : 0;
|
||||
const int oldEquipNo = curData.equipmentNumber.is_set() ? curData.equipmentNumber.get() : 0;
|
||||
|
||||
curData = data;
|
||||
|
||||
@@ -882,12 +882,12 @@ bool Participant::setOperationalState(const TrainingAreaBase::EquipmentOperation
|
||||
bool bRet = false;
|
||||
if (operationalState.isManipulation().is_set())
|
||||
{
|
||||
if (operationalState.equipmentFunctionId().is_set() &&
|
||||
if (operationalState.equipmentFunctionId.is_set() &&
|
||||
operationalState.isManipulation().get() &&
|
||||
operationalState.sampleTime() > m_lastManipulationReset) // add if there is a new manipulation which is not outdated
|
||||
{
|
||||
removeManipulation(operationalState.equipmentFunctionId().get()); // precautionary
|
||||
m_dynamicData.manipulation().emplace_back(operationalState.equipmentFunctionId().get(),
|
||||
removeManipulation(operationalState.equipmentFunctionId.get()); // precautionary
|
||||
m_dynamicData.manipulation().emplace_back(operationalState.equipmentFunctionId.get(),
|
||||
operationalState.sampleTime());
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public:
|
||||
int32_t typeId() const { return m_participantData.typeId(); }
|
||||
int32_t superiorId() const { return m_participantData.superiorId(); }
|
||||
// return optional?
|
||||
int32_t equipmentNumber() const { return m_participantData.equipmentNumber().is_set() ? m_participantData.equipmentNumber().get() : 0; }
|
||||
int32_t equipmentNumber() const { return m_participantData.equipmentNumber.is_set() ? m_participantData.equipmentNumber.get() : 0; }
|
||||
int32_t partyId() const { return m_participantData.partyId(); }
|
||||
bool isDeleted() const { return m_participantData.isDeleted(); }
|
||||
ParticipantAssignState assignState() const { return m_participantData.assignState(); }
|
||||
|
||||
+4
-4
@@ -174,9 +174,9 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
pos.equipmentNumber(data.equipmentNumber());
|
||||
pos.sampleTime(data.sampleTime());
|
||||
if (data.position().is_set())
|
||||
if (data.position.is_set())
|
||||
{
|
||||
pos.position(data.position().get());
|
||||
pos.position(data.position.get());
|
||||
onNewPositionFromProxy(pos);
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
pos.equipmentNumber(data.equipmentNumber());
|
||||
pos.sampleTime(data.sampleTime());
|
||||
if (data.position().is_set())
|
||||
if (data.position.is_set())
|
||||
{
|
||||
Core::GeoPosition geoPos(data.position().get().lon(), data.position().get().lat(), 0);
|
||||
Core::GeoPosition geoPos(data.position.get().lon(), data.position.get().lat(), 0);
|
||||
pos.position().position(geoPos);
|
||||
if (participant->setPosition(pos))
|
||||
participant->publishPosition();
|
||||
|
||||
+10
-10
@@ -53,8 +53,8 @@ static inline Database::PpmParticipant toDbParticipant(const ParticipantData &cu
|
||||
newDbParticipant.isDeleted = currentData.isDeleted();
|
||||
newDbParticipant.isSimulated = currentData.isSimulated();
|
||||
newDbParticipant.assignState = currentData.assignState();
|
||||
if (currentData.equipmentNumber().is_set())
|
||||
newDbParticipant.equipmentNumber = currentData.equipmentNumber().get();
|
||||
if (currentData.equipmentNumber.is_set())
|
||||
newDbParticipant.equipmentNumber = currentData.equipmentNumber.get();
|
||||
newDbParticipant.hierarchyNumber = currentData.hierarchyNumber();
|
||||
newDbParticipant.properties = QString::fromStdString(currentData.properties());
|
||||
|
||||
@@ -677,9 +677,9 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
m_participantOrganisations.erase(it);
|
||||
}
|
||||
}
|
||||
if (request.participantOrganisation().is_set())
|
||||
if (request.participantOrganisation.is_set())
|
||||
{
|
||||
const ParticipantOrganisation &newOrga = request.participantOrganisation().get();
|
||||
const ParticipantOrganisation &newOrga = request.participantOrganisation.get();
|
||||
auto it = m_participantOrganisations.find(newOrga.participantId());
|
||||
|
||||
const int originPartyId = (it == m_participantOrganisations.end() ? -1 : it.value().originPartyId());
|
||||
@@ -1446,8 +1446,8 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
// assign state valid?
|
||||
DEBUG_LOG(m_logger) << "checking assign state";
|
||||
int32_t equipmentNumber = 0;
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
equipmentNumber = participantToValidate.equipmentNumber().get();
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
equipmentNumber = participantToValidate.equipmentNumber.get();
|
||||
|
||||
bool isAssignStateValid = existingParticipant->isNewAssignStateValid(participantToValidate.assignState(), equipmentNumber);
|
||||
if (!isAssignStateValid)
|
||||
@@ -1485,13 +1485,13 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
// new participant
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
{
|
||||
if (participantToValidate.assignState() != ParticipantAssignState::HandoutExcon)
|
||||
|
||||
return Core::FunctionReplyObject(participantToValidate.modId(),
|
||||
tr_lts("dds", "Got a new participant with an equipment number (%1) but assign state is not HandoutExcon"))
|
||||
.arg(participantToValidate.equipmentNumber().get());
|
||||
.arg(participantToValidate.equipmentNumber.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1583,9 +1583,9 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
{
|
||||
const int equipNo = participantToValidate.equipmentNumber().get();
|
||||
const int equipNo = participantToValidate.equipmentNumber.get();
|
||||
const int participantId = participantToValidate.id();
|
||||
DEBUG_LOG(m_logger) << "Check if equipment number is globally unique " << equipNo;
|
||||
int partIdLookup = m_equipNumber2ParticipantId.value(equipNo);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ static inline Database::PpmParticipant toDb(const ParticipantManagement::Partici
|
||||
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.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());
|
||||
|
||||
+2
-2
@@ -124,8 +124,8 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
// {
|
||||
// for (const auto &p : m_participantMap)
|
||||
// {
|
||||
// if (p.equipmentNumber().is_set())
|
||||
// m_equipmentNumbers.insert(p.equipmentNumber().get());
|
||||
// if (p.equipmentNumber.is_set())
|
||||
// m_equipmentNumbers.insert(p.equipmentNumber.get());
|
||||
// }
|
||||
// DEBUG_LOG(m_logger) << "setReplayStartTime-m_equipmentNumbers after" << m_equipmentNumbers.count();
|
||||
// }
|
||||
|
||||
@@ -115,7 +115,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "ParticipantHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_participantHandler->getWebSocketPort(), Core::PortType::WebSocketPositionServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_participantHandler->getWebSocketPort(), Core::CorePortType::WebSocketPositionServer);
|
||||
|
||||
m_targetInformationHandler = std::make_shared<ParticipantManagement::HandlerTargetInformation>(this);
|
||||
if (!m_targetInformationHandler->init())
|
||||
@@ -168,7 +168,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_websocketHandler->webSocketPort(), Core::PortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_websocketHandler->webSocketPort(), Core::CorePortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
// UasHandler
|
||||
|
||||
@@ -24,7 +24,9 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
qWarning() << "########## youngestStateInformation ##########";
|
||||
|
||||
ParticipantManagement::StateInformation ret;
|
||||
ret.vulnerabilityState(ProjectDataManagement::VulnerabilityState::NotReady);
|
||||
// rtiddsgen 7.7 generates plain public members (no setters) and prefixed
|
||||
// PDM enumerators (commit be912de9d resolved duplicate enumerators).
|
||||
ret.vulnerabilityState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady;
|
||||
|
||||
if (stateList.empty())
|
||||
{
|
||||
@@ -58,7 +60,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
std::sort(sortedStateList.begin(), sortedStateList.end(),
|
||||
[/*&debug,readyToDebug*/](const ParticipantManagement::StateInformation &left, const ParticipantManagement::StateInformation &right)
|
||||
{
|
||||
if (left.stateTime() == right.stateTime() && left.vulnerabilityState() != right.vulnerabilityState())
|
||||
if (left.stateTime == right.stateTime && left.vulnerabilityState != right.vulnerabilityState)
|
||||
{
|
||||
// if (readyToDebug)
|
||||
// debug = true;
|
||||
@@ -66,10 +68,10 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
// qWarning() << "WARNING: StateInformation with state" << (int)left.vulnerabilityState().underlying() << "has the same stateTime as StateInformation with state" << (int)right.vulnerabilityState().underlying();
|
||||
|
||||
// sort by state if time is the same (higher state = winner)
|
||||
return (left.vulnerabilityState() > right.vulnerabilityState());
|
||||
return (left.vulnerabilityState > right.vulnerabilityState);
|
||||
}
|
||||
|
||||
return (left.stateTime() > right.stateTime());
|
||||
return (left.stateTime > right.stateTime);
|
||||
});
|
||||
|
||||
|
||||
@@ -77,7 +79,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
{
|
||||
qWarning() << ">> printing all SIs";
|
||||
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
|
||||
qWarning() << ">>>> si" << "siVulnId" << (uint8_t)si.vulnerabilityState().underlying() << "bits" << si.vulnerabilityBits() << "time" << si.stateTime();
|
||||
qWarning() << ">>>> si" << "siVulnId" << (uint8_t)si.vulnerabilityState << "bits" << si.vulnerabilityBits << "time" << si.stateTime;
|
||||
|
||||
qWarning() << ">> checking SIs";
|
||||
}
|
||||
@@ -85,7 +87,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
|
||||
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
|
||||
{
|
||||
const uint8_t siVulnId = si.vulnerabilityState().underlying();
|
||||
const uint8_t siVulnId = static_cast<uint8_t>(si.vulnerabilityState);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@@ -94,14 +96,14 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
}
|
||||
|
||||
// we're only interested in 'visible' VBGs, don't care about near miss etc. here
|
||||
if (bSkipVbgGreaterCatastrophicKill && si.vulnerabilityState() > ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (bSkipVbgGreaterCatastrophicKill && si.vulnerabilityState > ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
{
|
||||
if (debug)
|
||||
qWarning() << ">>>> vulnId is higher than CK!";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bSkipSanitation && si.originatorType() == ProjectDataManagement::StateChangeOriginator::Sanitation)
|
||||
if (bSkipSanitation && si.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation)
|
||||
{
|
||||
if (debug)
|
||||
qWarning() << ">>>> is sanitation!";
|
||||
@@ -125,29 +127,29 @@ StateInformation youngestRealStateInformation(const std::vector<ParticipantManag
|
||||
if (stateList.size() == 0)
|
||||
{
|
||||
ParticipantManagement::StateInformation ret;
|
||||
ret.vulnerabilityState(ProjectDataManagement::VulnerabilityState::NotReady);
|
||||
ret.vulnerabilityState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady;
|
||||
return ret;
|
||||
}
|
||||
StateInformation youngestState = youngestStateInformation(stateList);
|
||||
size_t youngest = 0;
|
||||
for (size_t i = 1; i < stateList.size(); ++i)
|
||||
{
|
||||
const auto &tCurrent = stateList.at(i).stateTime();
|
||||
const auto &tYoungest = stateList.at(youngest).stateTime();
|
||||
const auto &tCurrent = stateList.at(i).stateTime;
|
||||
const auto &tYoungest = stateList.at(youngest).stateTime;
|
||||
|
||||
// we're only interested in 'visible' VBGs, don't care about near miss etc. here
|
||||
if (bSkipVbgGreaterCatastrophicKill && stateList.at(i).vulnerabilityState() > ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (bSkipVbgGreaterCatastrophicKill && stateList.at(i).vulnerabilityState > ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
continue;
|
||||
if (stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::Sanitation ||
|
||||
stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::MedicalTimeout)
|
||||
if (stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation ||
|
||||
stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MedicalTimeout)
|
||||
continue;
|
||||
if (tCurrent > youngestState.stateTime())
|
||||
if (tCurrent > youngestState.stateTime)
|
||||
continue;
|
||||
|
||||
bool higherState = (stateList.at(i).vulnerabilityState() > stateList.at(youngest).vulnerabilityState() ) ||
|
||||
(stateList.at(i).vulnerabilityState() == stateList.at(youngest).vulnerabilityState() && (stateList.at(i).vitality() < stateList.at(youngest).vitality()));
|
||||
bool higherState = (stateList.at(i).vulnerabilityState > stateList.at(youngest).vulnerabilityState ) ||
|
||||
(stateList.at(i).vulnerabilityState == stateList.at(youngest).vulnerabilityState && (stateList.at(i).vitality < stateList.at(youngest).vitality));
|
||||
|
||||
if ((tCurrent > tYoungest && (stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::ObserverController || stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::ExerciseControl)) ||
|
||||
if ((tCurrent > tYoungest && (stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController || stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl)) ||
|
||||
(tCurrent > tYoungest && higherState) ||
|
||||
(tCurrent == tYoungest && higherState))
|
||||
youngest = i;
|
||||
@@ -165,7 +167,7 @@ ParticipantManagement::SanitationResult proceduresDone(const std::vector<StateIn
|
||||
|
||||
// If that guy is killed: NoEffect
|
||||
StateInformation youngestReal = youngestRealStateInformation(stateList);
|
||||
if (youngestReal.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (youngestReal.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
return SanitationResult::NoEffect;
|
||||
|
||||
|
||||
@@ -174,19 +176,19 @@ ParticipantManagement::SanitationResult proceduresDone(const std::vector<StateIn
|
||||
for (size_t i = 1; i < stateList.size(); ++i)
|
||||
{
|
||||
// Better than "Unhandled" can only occur if this is done by Sanitation or O/C
|
||||
if (stateList.at(i).originatorType() != ProjectDataManagement::StateChangeOriginator::Sanitation
|
||||
&& stateList.at(i).originatorType() != ProjectDataManagement::StateChangeOriginator::ObserverController )
|
||||
if (stateList.at(i).originatorType != ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation
|
||||
&& stateList.at(i).originatorType != ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController )
|
||||
continue;
|
||||
// Let's find the newest
|
||||
if (stateList.at(i).stateTime() < youngestReal.stateTime())
|
||||
if (stateList.at(i).stateTime < youngestReal.stateTime)
|
||||
continue;
|
||||
//
|
||||
if (ret == SanitationResult::Unhandled ) //we have a sanitation so at least 1
|
||||
ret = stateList.at(i).sanitationResult();
|
||||
ret = stateList.at(i).sanitationResult;
|
||||
|
||||
if (stateList.at(i).sanitationResult() == SanitationResult::Sufficient && ret != SanitationResult::Optimal )
|
||||
if (stateList.at(i).sanitationResult == SanitationResult::Sufficient && ret != SanitationResult::Optimal )
|
||||
ret = SanitationResult::Sufficient;
|
||||
if (stateList.at(i).sanitationResult() == SanitationResult::Optimal)
|
||||
if (stateList.at(i).sanitationResult == SanitationResult::Optimal)
|
||||
ret = SanitationResult::Optimal;
|
||||
|
||||
}
|
||||
|
||||
+100
-100
@@ -38,7 +38,7 @@ bool DtcImplCustom::rootTemplates(QVector<TemplateParticipant> &templateVector)
|
||||
|
||||
for (const auto &sample : m_dtcTemplateParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().superiorTemplateId() == 0)
|
||||
if (sample.data().superiorTemplateId == 0)
|
||||
templateVector.append(sample.data());
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ TemplateData DtcImplCustom::convertFromParticipantTemplateToTemplateData(const T
|
||||
TemplateBase &out = outputData;
|
||||
out = inputTemplate;
|
||||
// in cases where the ids are not updated by the treeModel
|
||||
outputData.modId(inputTemplate.templateId());
|
||||
outputData.superiorModId(inputTemplate.superiorTemplateId());
|
||||
outputData.modId = inputTemplate.templateId;
|
||||
outputData.superiorModId = inputTemplate.superiorTemplateId;
|
||||
|
||||
return outputData;
|
||||
}
|
||||
@@ -69,8 +69,8 @@ ParticipantData Interface::DtcImplCustom::convertParticipantToParticipantData(co
|
||||
ParticipantBase &out = outputData;
|
||||
out = inputParticipant;
|
||||
// in cases where the ids are not updated by the treeModel
|
||||
outputData.modId(inputParticipant.id());
|
||||
outputData.superiorModId(inputParticipant.superiorId());
|
||||
outputData.modId = inputParticipant.id;
|
||||
outputData.superiorModId = inputParticipant.superiorId;
|
||||
|
||||
return outputData;
|
||||
}
|
||||
@@ -104,14 +104,14 @@ QMap<int, Participant> DtcImplCustom::units() const
|
||||
QSet<int> unitTypeIds;
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
if (sample.data().typeClass() == TypeClass::Unit || sample.data().typeClass() == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id());
|
||||
if (sample.data().typeClass == TypeClass::Unit || sample.data().typeClass == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id);
|
||||
}
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (unitTypeIds.contains(sample.data().typeId()))
|
||||
ret.insert(sample.data().id(), sample.data());
|
||||
if (unitTypeIds.contains(sample.data().typeId))
|
||||
ret.insert(sample.data().id, sample.data());
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -120,11 +120,11 @@ QMap<int, Participant> DtcImplCustom::units() const
|
||||
bool DtcImplCustom::participantIdsByUnit(int unitId, const QMap<int, Participant> &participants, QSet<int> &participantIds)
|
||||
{
|
||||
const ParticipantManagement::Participant unit(participants.value(unitId));
|
||||
if (unit.id() != unitId)
|
||||
if (unit.id != unitId)
|
||||
return false;
|
||||
|
||||
const ParticipantManagement::Type unitType(type(unit.typeId()));
|
||||
if (unitType.typeClass() != ParticipantManagement::TypeClass::Unit && unitType.typeClass() != ParticipantManagement::TypeClass::SupportUnit)
|
||||
const ParticipantManagement::Type unitType(type(unit.typeId));
|
||||
if (unitType.typeClass != ParticipantManagement::TypeClass::Unit && unitType.typeClass != ParticipantManagement::TypeClass::SupportUnit)
|
||||
return false;
|
||||
|
||||
participantIds += recursiveInferiosForParticipant(unitId, participants);
|
||||
@@ -141,8 +141,8 @@ bool DtcImplCustom::visibleParties(QMap<int32_t, Party> &visibleParties, const Q
|
||||
|
||||
const bool bAll = (filter.size() == 1 && filter.first() == -1);
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
if (bAll || filter.contains(sample.data().id()))
|
||||
visibleParties.insert(sample.data().id(), sample);
|
||||
if (bAll || filter.contains(sample.data().id))
|
||||
visibleParties.insert(sample.data().id, sample);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -161,11 +161,11 @@ bool DtcImplCustom::isEquipmentNumberInUse(int equipmentNumber, int &exerciseId)
|
||||
|
||||
for (const auto &sample : m_dtcEquipmentExerciseMapping->readAlive())
|
||||
{
|
||||
for (const Equipment2ParticipantId &e2p : sample.data().mapping())
|
||||
for (const Equipment2ParticipantId &e2p : sample.data().mapping)
|
||||
{
|
||||
if (e2p.equipmentNumber() == equipmentNumber)
|
||||
if (e2p.equipmentNumber == equipmentNumber)
|
||||
{
|
||||
exerciseId = sample.data().exerciseId();
|
||||
exerciseId = sample.data().exerciseId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ bool DtcImplCustom::isTypeInUse(int typeId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().typeId() == typeId)
|
||||
if (sample.data().typeId == typeId)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -193,8 +193,8 @@ int DtcImplCustom::participantIdByEquipmentNumber(int equipmentNumber) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().equipmentNumber().is_set() && sample.data().equipmentNumber().get() == equipmentNumber)
|
||||
return sample.data().id();
|
||||
if (sample.data().equipmentNumber.is_set() && sample.data().equipmentNumber.get() == equipmentNumber)
|
||||
return sample.data().id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -207,10 +207,10 @@ int DtcImplCustom::equipmentNumberByParticipantId(int participantId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().id() == participantId)
|
||||
if (sample.data().id == participantId)
|
||||
{
|
||||
if (sample.data().equipmentNumber().is_set())
|
||||
return sample.data().equipmentNumber().get();
|
||||
if (sample.data().equipmentNumber.is_set())
|
||||
return sample.data().equipmentNumber.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,9 +231,9 @@ int DtcImplCustom::uasMissionIdByEquipmentNumber(int equipmentNumber) const
|
||||
}
|
||||
for (const auto &sample : m_dtcMissionPlan->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() == participantId)
|
||||
if (sample.data().participantId == participantId)
|
||||
{
|
||||
return sample.data().id();
|
||||
return sample.data().id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +247,8 @@ int DtcImplCustom::partyIdFromForceIdentifier(HlaForceIdentifierEnum inputForceI
|
||||
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
{
|
||||
if (sample.data().hlaForceIdentifier() == inputForceIdentifier)
|
||||
return sample.data().id();
|
||||
if (sample.data().hlaForceIdentifier == inputForceIdentifier)
|
||||
return sample.data().id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -268,16 +268,16 @@ ConnectState DtcImplCustom::saaConnectedState(const int partyId)
|
||||
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
{
|
||||
if (partyId != sample.data().id())
|
||||
if (partyId != sample.data().id)
|
||||
continue;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(sample.data().properties()));
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(sample.data().properties));
|
||||
QJsonObject prop = doc.object();
|
||||
QJsonObject propAdler;
|
||||
if (prop.contains(QStringLiteral("Adler")))
|
||||
{
|
||||
propAdler = prop[QStringLiteral("Adler")].toObject();
|
||||
if (propAdler.contains(QStringLiteral("saaConnectedState")))
|
||||
return static_cast<ConnectState::inner_enum>(propAdler[QStringLiteral("saaConnectedState")].toInt());
|
||||
return static_cast<ConnectState>(propAdler[QStringLiteral("saaConnectedState")].toInt());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -291,8 +291,8 @@ QVector<int> DtcImplCustom::getSubordinatesByParticipant(const int participantId
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().superiorId() == participantId)
|
||||
result.append(sample.data().id());
|
||||
if (sample.data().superiorId == participantId)
|
||||
result.append(sample.data().id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -317,8 +317,8 @@ QVector<int> DtcImplCustom::getParticipantsByPolygon(const QPolygonF &polygon, b
|
||||
}
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
if (sample.data().typeClass() == TypeClass::Unit || sample.data().typeClass() == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id());
|
||||
if (sample.data().typeClass == TypeClass::Unit || sample.data().typeClass == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,17 +326,17 @@ QVector<int> DtcImplCustom::getParticipantsByPolygon(const QPolygonF &polygon, b
|
||||
|
||||
for (const auto ¤tPosition : m_dtcParticipantPosition->readAlive())
|
||||
{
|
||||
if (!includeUnits && unitTypeIds.contains(currentPosition.data().participantTypeId()))
|
||||
if (!includeUnits && unitTypeIds.contains(currentPosition.data().participantTypeId))
|
||||
continue;
|
||||
|
||||
if (!includeOc && currentPosition.data().partyId() == 1) // partyId 1 = OC
|
||||
if (!includeOc && currentPosition.data().partyId == 1) // partyId 1 = OC
|
||||
continue;
|
||||
|
||||
const Core::GeoPosition ¤tGeoPosition = currentPosition.data().pos();
|
||||
const QPointF positionPoint(currentGeoPosition.lon(), currentGeoPosition.lat());
|
||||
const Core::GeoPosition ¤tGeoPosition = currentPosition.data().pos;
|
||||
const QPointF positionPoint(currentGeoPosition.lon, currentGeoPosition.lat);
|
||||
|
||||
if (polygon.containsPoint(positionPoint, Qt::OddEvenFill))
|
||||
participantsInPolygon.append(currentPosition.data().participantId());
|
||||
participantsInPolygon.append(currentPosition.data().participantId);
|
||||
}
|
||||
|
||||
return participantsInPolygon;
|
||||
@@ -351,9 +351,9 @@ QVector<int> DtcImplCustom::getUasIds()
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (isTypeUas(sample.data().typeId()))
|
||||
if (isTypeUas(sample.data().typeId))
|
||||
{
|
||||
result.append(sample.data().id());
|
||||
result.append(sample.data().id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,13 +363,13 @@ QVector<int> DtcImplCustom::getUasIds()
|
||||
UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId) const
|
||||
{
|
||||
ParticipantManagement::UAS uas;
|
||||
uas.id(-1); // if not found
|
||||
uas.id = -1; // if not found
|
||||
|
||||
for (const auto &sample : m_dtcUAS->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() != participantId)
|
||||
if (sample.data().participantId != participantId)
|
||||
continue;
|
||||
if (sample.data().exerciseId() != exerciseId)
|
||||
if (sample.data().exerciseId != exerciseId)
|
||||
continue;
|
||||
uas = sample;
|
||||
break;
|
||||
@@ -380,20 +380,20 @@ UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId) cons
|
||||
MissionAction DtcImplCustom::currentMissionAction(int missionPlanId) const
|
||||
{
|
||||
ParticipantManagement::MissionAction missionAction;
|
||||
missionAction.planId(0); // default compare value in case nothing found
|
||||
missionAction.planId = 0; // default compare value in case nothing found
|
||||
for (const auto &sample : m_dtcMissionPlan->readAlive())
|
||||
{
|
||||
if (sample.data().id() != missionPlanId)
|
||||
if (sample.data().id != missionPlanId)
|
||||
continue;
|
||||
const std::vector<ParticipantManagement::MissionItem> &items = sample.data().items();
|
||||
const std::vector<ParticipantManagement::MissionItem> &items = sample.data().items;
|
||||
for (const auto &item : items)
|
||||
{
|
||||
if (item.fulfilled() > 0)
|
||||
if (item.fulfilled > 0)
|
||||
continue;
|
||||
const std::vector<ParticipantManagement::MissionAction> &actions = item.actions();
|
||||
const std::vector<ParticipantManagement::MissionAction> &actions = item.actions;
|
||||
for (const auto &action : actions)
|
||||
{
|
||||
if (action.fulfilled() > 0)
|
||||
if (action.fulfilled > 0)
|
||||
continue;
|
||||
return action;
|
||||
}
|
||||
@@ -406,11 +406,11 @@ ParticipantManagement::Participant DtcImplCustom::getParticipantByInternalName(i
|
||||
{
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().partyId() != partyId)
|
||||
if (sample.data().partyId != partyId)
|
||||
continue;
|
||||
if (sample.data().isDeleted())
|
||||
if (sample.data().isDeleted)
|
||||
continue;
|
||||
if (sample.data().name() != unitName.toStdString())
|
||||
if (sample.data().name != unitName.toStdString())
|
||||
continue;
|
||||
// Found Unit
|
||||
|
||||
@@ -420,12 +420,12 @@ ParticipantManagement::Participant DtcImplCustom::getParticipantByInternalName(i
|
||||
return sample;
|
||||
}
|
||||
|
||||
for (auto inferiorId : sample.data().inferiorIds())
|
||||
for (auto inferiorId : sample.data().inferiorIds)
|
||||
{
|
||||
const auto &inferiorParticipant = m_participantCont.value(inferiorId);
|
||||
if (inferiorParticipant.id() <= 0 || inferiorParticipant.isDeleted())
|
||||
if (inferiorParticipant.id <= 0 || inferiorParticipant.isDeleted)
|
||||
continue;
|
||||
if (inferiorParticipant.name() == internalName.toStdString())
|
||||
if (inferiorParticipant.name == internalName.toStdString())
|
||||
return inferiorParticipant;
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,7 @@ QSet<int> DtcImplCustom::recursiveInferiosForParticipant(int32_t participantId,
|
||||
|
||||
result += participantId;
|
||||
const Participant &p = it.value();
|
||||
for (int childId : p.inferiorIds())
|
||||
for (int childId : p.inferiorIds)
|
||||
result += recursiveInferiosForParticipant(childId, participants);
|
||||
return result;
|
||||
}
|
||||
@@ -457,10 +457,10 @@ QString DtcImplCustom::lookUpHierachy(int participantId, const QMap<int, Partici
|
||||
return QString();
|
||||
const auto &part = itPart.value();
|
||||
|
||||
QString supStr = lookUpHierachy(part.superiorId(), participants);
|
||||
QString ret = QString::fromStdString(part.designator());
|
||||
QString supStr = lookUpHierachy(part.superiorId, participants);
|
||||
QString ret = QString::fromStdString(part.designator);
|
||||
// First separator is "./"
|
||||
if (part.superiorId() == 0)
|
||||
if (part.superiorId == 0)
|
||||
return (ret + QLatin1String("./"));
|
||||
|
||||
if (supStr.endsWith(QLatin1String("./")))
|
||||
@@ -476,10 +476,10 @@ QVector<TemplateParticipant> DtcImplCustom::inferiorTemplates(int templateId)
|
||||
const TemplateParticipant participant = templateParticipant(templateId);
|
||||
retVector.append(participant);
|
||||
|
||||
if (participant.inferiorIds().is_set())
|
||||
if (participant.inferiorIds.is_set())
|
||||
{
|
||||
retVector.reserve(participant.inferiorIds().get().size() + retVector.size());
|
||||
for (int inferiorId : participant.inferiorIds().get())
|
||||
retVector.reserve(participant.inferiorIds.get().size() + retVector.size());
|
||||
for (int inferiorId : participant.inferiorIds.get())
|
||||
retVector.append(inferiorTemplates(inferiorId));
|
||||
}
|
||||
|
||||
@@ -493,9 +493,9 @@ bool DtcImplCustom::isTypePatientSimulator(int typeId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().typeId() == typeId)
|
||||
if (sample.data().typeId == typeId)
|
||||
{
|
||||
const std::string &str = sample.data().properties();
|
||||
const std::string &str = sample.data().properties;
|
||||
if (str.size() > 0 && getNeedsIp(str) && getNeedsPort(str))
|
||||
return true;
|
||||
else
|
||||
@@ -512,9 +512,9 @@ bool DtcImplCustom::isAdlerType(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -539,9 +539,9 @@ bool DtcImplCustom::isArtilleryType(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -566,9 +566,9 @@ bool DtcImplCustom::isEditable(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -593,9 +593,9 @@ bool DtcImplCustom::isAdlerVerbund(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -620,9 +620,9 @@ bool DtcImplCustom::isPartyAdlerVerbund(int partyId) const
|
||||
|
||||
for (const Party &party : m_dtcParty->readAlive())
|
||||
{
|
||||
if (party.id() != partyId)
|
||||
if (party.id != partyId)
|
||||
continue;
|
||||
const auto &prob = party.properties();
|
||||
const auto &prob = party.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -654,11 +654,11 @@ Type DtcImplCustom::getTypeFromAdlerType(const QString &adlerTypeName, bool isUn
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (isUnit && type.typeClass() != TypeClass::Unit)
|
||||
if (isUnit && type.typeClass != TypeClass::Unit)
|
||||
continue;
|
||||
if (!isUnit && type.typeClass() != TypeClass::WeaponSystem)
|
||||
if (!isUnit && type.typeClass != TypeClass::WeaponSystem)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(props, &parserError));
|
||||
@@ -673,11 +673,11 @@ Type DtcImplCustom::getTypeFromAdlerType(const QString &adlerTypeName, bool isUn
|
||||
if (val.toString() != adlerTypeName)
|
||||
continue;
|
||||
|
||||
if (isAdlerVerbund(type.id()) != isVerbund)
|
||||
if (isAdlerVerbund(type.id) != isVerbund)
|
||||
continue;
|
||||
// Found exact Type
|
||||
DEBUG_LOG(m_logger) << "--- "
|
||||
<< "Found exact type --> typeId= " << type.id() << " ---";
|
||||
<< "Found exact type --> typeId= " << type.id << " ---";
|
||||
return type;
|
||||
}
|
||||
return ret;
|
||||
@@ -698,9 +698,9 @@ bool DtcImplCustom::isTypeUas(int typeId)
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
// DEBUG_LOG(m_logger) << " sample equipmentTypeId=" << sample.data().equipmentTypeId();
|
||||
if (sample.data().id() == typeId)
|
||||
if (sample.data().id == typeId)
|
||||
{
|
||||
const std::string &str = sample.data().properties();
|
||||
const std::string &str = sample.data().properties;
|
||||
if (str.size() > 0 && getIsUAS(str))
|
||||
return true;
|
||||
else
|
||||
@@ -724,9 +724,9 @@ UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId)
|
||||
|
||||
for (const auto &sample : m_dtcUAS->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() != participantId)
|
||||
if (sample.data().participantId != participantId)
|
||||
continue;
|
||||
if (sample.data().exerciseId() != exerciseId)
|
||||
if (sample.data().exerciseId != exerciseId)
|
||||
continue;
|
||||
return sample;
|
||||
}
|
||||
@@ -744,13 +744,13 @@ int DtcImplCustom::getParticipantFromPrf(int prf) const
|
||||
|
||||
for (const DynamicParticipantData &sample : m_dtcDynamicParticipantData->readAlive())
|
||||
{
|
||||
for (const auto &designation : qAsConst(sample.designations()))
|
||||
for (const auto &designation : qAsConst(sample.designations))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code();
|
||||
if (designation.code() == prf)
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code;
|
||||
if (designation.code == prf)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code();
|
||||
return sample.participantId();
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code;
|
||||
return sample.participantId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,16 +765,16 @@ int DtcImplCustom::getPrfFromParticipant(int participantId) const
|
||||
|
||||
for (const DynamicParticipantData &sample : m_dtcDynamicParticipantData->readAlive())
|
||||
{
|
||||
if (participantId == sample.participantId())
|
||||
if (participantId == sample.participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "participantId=" << sample.participantId() << " designations.size()=" << sample.designations().size();
|
||||
for (const auto &designation : qAsConst(sample.designations()))
|
||||
DEBUG_LOG(m_logger) << "participantId=" << sample.participantId << " designations.size()=" << sample.designations.size();
|
||||
for (const auto &designation : qAsConst(sample.designations))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code();
|
||||
if (designation.code() > 0)
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code;
|
||||
if (designation.code > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code();
|
||||
return designation.code();
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code;
|
||||
return designation.code;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -821,17 +821,17 @@ QMap<double, int> DtcImplCustom::sortByDistance(const double lon, const double l
|
||||
|
||||
for (const auto ¤tPosition : m_dtcParticipantPosition->readAlive())
|
||||
{
|
||||
if (participantIds.contains(currentPosition.data().participantId()))
|
||||
if (participantIds.contains(currentPosition.data().participantId))
|
||||
{
|
||||
auto pOrigin = LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat, zone);
|
||||
auto pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(currentPosition.data().pos().lon(), currentPosition.data().pos().lat(), zone);
|
||||
auto pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(currentPosition.data().pos.lon, currentPosition.data().pos.lat, zone);
|
||||
double distance = LtsCoordTrans::distance(pPos, pOrigin);
|
||||
DEBUG_LOG(m_logger) << distance;
|
||||
// Save distance and particiapnt Id into temporar map.
|
||||
// the map is sorted so we can use that later instead of writing a sort method vor a vec
|
||||
// for now
|
||||
distanceMapSorted.insert(distance, currentPosition.data().participantId());
|
||||
DEBUG_LOG(m_logger) << "insert distance=" << distance << ", participantId=" << currentPosition.data().participantId();
|
||||
distanceMapSorted.insert(distance, currentPosition.data().participantId);
|
||||
DEBUG_LOG(m_logger) << "insert distance=" << distance << ", participantId=" << currentPosition.data().participantId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user