Migrates AreaEffectSimulation to generated rtiddsgen API
Converts accessor calls to plain member access across aes service and plugin.
This commit is contained in:
102 files changed
+3307
-3313
No files matched your search
+39
-39
@@ -15,7 +15,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerNContamination::HandlerNContamination(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectNContamination>(mainHandler, QStringLiteral("NContamination"), s_areaCount[AesType::AtNContamination], s_areaCountCentral[AesType::AtNContamination])
|
||||
: HandlerBaseTmpl<ObjectNContamination>(mainHandler, QStringLiteral("NContamination"), s_areaCount[static_cast<int>(AesType::AtNContamination)], s_areaCountCentral[static_cast<int>(AesType::AtNContamination)])
|
||||
, Interface::Fts::NContaminationModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::NContaminationRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{}
|
||||
@@ -48,7 +48,7 @@ bool HandlerNContamination::init()
|
||||
}
|
||||
if(!ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active n contaminations in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -58,7 +58,7 @@ bool HandlerNContamination::init()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active n contaminations in database than allowed - ignoring the rest!";
|
||||
ifs->removeObject();
|
||||
@@ -89,18 +89,18 @@ bool HandlerNContamination::init()
|
||||
|
||||
int HandlerNContamination::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtBCContamination] + s_areaCount[AesType::AtNContamination];
|
||||
return s_areaCount[static_cast<int>(AesType::AtBCContamination)] + s_areaCount[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
int HandlerNContamination::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtBCContamination] + s_areaCountCentral[AesType::AtNContamination];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtBCContamination)] + s_areaCountCentral[static_cast<int>(AesType::AtNContamination)];
|
||||
}
|
||||
|
||||
void HandlerNContamination::onChangedToCentral()
|
||||
{
|
||||
s_areaCount[AesType::AtNContamination]--;
|
||||
s_areaCountCentral[AesType::AtNContamination]++;
|
||||
s_areaCount[static_cast<int>(AesType::AtNContamination)]--;
|
||||
s_areaCountCentral[static_cast<int>(AesType::AtNContamination)]++;
|
||||
|
||||
DEBUG_LOG(m_logger) << "m_areaCount after Recount = " << m_areaCount;
|
||||
DEBUG_LOG(m_logger) << "m_areaCountCentral after Recount = " << m_areaCountCentral;
|
||||
@@ -110,25 +110,25 @@ void HandlerNContamination::onChangedToCentral()
|
||||
|
||||
static void fillData(const NContaminationModifyRequest &src, Database::AesNContamination &dst)
|
||||
{
|
||||
if (src.id() < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id();
|
||||
if (src.id < 0) // is the id given as negative? set id -> used by OC-Laptop
|
||||
dst.id = src.id;
|
||||
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.effectStart = src.effectStart().is_set() && src.effectStart().get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart().get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration();
|
||||
dst.impactPosition.rx() = src.impactPosition().lon();
|
||||
dst.impactPosition.ry() = src.impactPosition().lat();
|
||||
dst.impactRadius = src.impactRadius();
|
||||
dst.borderLengthInner = src.borderLengthInner();
|
||||
dst.borderLengthOuter = src.borderLengthOuter();
|
||||
dst.spanAngle = src.spanAngle();
|
||||
dst.rotationAngle = src.rotationAngle();
|
||||
dst.detonationValue = src.detonationValue();
|
||||
dst.partyId = src.partyId().is_set() ? src.partyId().get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId();
|
||||
dst.participantId = src.participantId().is_set() ? src.participantId().get() : 0;
|
||||
dst.externalId = src.externalId().is_set() ? src.externalId().get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource();
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.effectStart = src.effectStart.is_set() && src.effectStart.get() > 0 ? QDateTime::fromMSecsSinceEpoch(src.effectStart.get()) : QDateTime();
|
||||
dst.effectDuration = src.effectDuration;
|
||||
dst.impactPosition.rx() = src.impactPosition.lon;
|
||||
dst.impactPosition.ry() = src.impactPosition.lat;
|
||||
dst.impactRadius = src.impactRadius;
|
||||
dst.borderLengthInner = src.borderLengthInner;
|
||||
dst.borderLengthOuter = src.borderLengthOuter;
|
||||
dst.spanAngle = src.spanAngle;
|
||||
dst.rotationAngle = src.rotationAngle;
|
||||
dst.detonationValue = src.detonationValue;
|
||||
dst.partyId = src.partyId.is_set() ? src.partyId.get() : 0;
|
||||
dst.chargeTypeId = src.chargeTypeId;
|
||||
dst.participantId = src.participantId.is_set() ? src.participantId.get() : 0;
|
||||
dst.externalId = src.externalId.is_set() ? src.externalId.get() : 0;
|
||||
dst.weatherSourceId = src.weatherSource;
|
||||
}
|
||||
|
||||
void HandlerNContamination::onNContaminationModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -162,7 +162,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
|
||||
if (ifs->data().isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtNContamination] + s_maxActiveAreasCentral[AesType::AtBCContamination]) && request.effectStart().is_set())
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -172,7 +172,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtNContamination] + s_maxActiveAreas[AesType::AtBCContamination]) && request.effectStart().is_set())
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)]) && request.effectStart.is_set())
|
||||
{
|
||||
ifs->removeObject(); //Not finally deleted from db after this,Fallback if DB deletion is not working correct
|
||||
ifs->removeObjectFromDb();
|
||||
@@ -202,16 +202,16 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationCreateRequest(con
|
||||
Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(const NContaminationModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
if (request.id() == 0 || ((request.id() < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id()), ret)))
|
||||
if (request.id == 0 || ((request.id < 0) && !getObjectFromMap(m_objectMap, std::abs(request.id), ret)))
|
||||
return nContaminationCreateRequest(request);
|
||||
|
||||
ObjectNContamination *ifs = getObjectFromMap(m_objectMap, std::abs(request.id()), ret);
|
||||
ObjectNContamination *ifs = getObjectFromMap(m_objectMap, std::abs(request.id), ret);
|
||||
if (!ifs)
|
||||
return ret;
|
||||
|
||||
// Anzahl aktiver Areas ist erreicht, der Wirkbeginn ist (soll) gesetzt sein, aber die Area war
|
||||
// vorher noch ohne Wirkbeginn
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]) && request.effectStart().is_set() && !ifs->isObjectModifiable())
|
||||
// if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]) && request.effectStart.is_set() && !ifs->isObjectModifiable())
|
||||
// return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active N contamination areas."));
|
||||
|
||||
Database::AesNContamination aea(ifs->data());
|
||||
@@ -228,25 +228,25 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
/*!
|
||||
* If the effect start added after creation, the max amount need to be checked
|
||||
*/
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart().is_set())
|
||||
if(!ifs->isActivationTimeSet() && request.effectStart.is_set())
|
||||
{
|
||||
if (isCentral)
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtNContamination] + s_maxActiveAreasCentral[AesType::AtBCContamination]) /*&& request.effectStart().is_set()*/)
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)]) /*&& request.effectStart.is_set()*/)
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtNContamination] + s_maxActiveAreas[AesType::AtBCContamination]) /*&& request.effectStart().is_set()*/) // upper if-condition handle start-time
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)]) /*&& request.effectStart.is_set()*/) // upper if-condition handle start-time
|
||||
{
|
||||
return Core::FunctionReplyObject(1, tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
}
|
||||
}
|
||||
}
|
||||
// For counting, only Elements being at least prepared are important:
|
||||
if (request.effectStart().is_set() && ifs->isObjectModifiable())
|
||||
if (request.effectStart.is_set() && ifs->isObjectModifiable())
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "isCentral: " << isCentral;
|
||||
@@ -258,8 +258,8 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
// Change from central to training area
|
||||
if (wasCentral)
|
||||
{
|
||||
if (totalAreas() >= (s_maxActiveAreas[AesType::AtBCContamination] + s_maxActiveAreas[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
if (totalAreas() >= (s_maxActiveAreas[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreas[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active N or B/C contamination areas."));
|
||||
|
||||
m_areaCount++;
|
||||
m_areaCountCentral--;
|
||||
@@ -268,8 +268,8 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
}
|
||||
else // Change from training area to central
|
||||
{
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[AesType::AtBCContamination] + s_maxActiveAreasCentral[AesType::AtNContamination]))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
if (totalAreasCentral() >= (s_maxActiveAreasCentral[static_cast<int>(AesType::AtBCContamination)] + s_maxActiveAreasCentral[static_cast<int>(AesType::AtNContamination)]))
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active central N or B/C contamination areas."));
|
||||
m_areaCount--;
|
||||
m_areaCountCentral++;
|
||||
DEBUG_LOG(m_logger) << "s_areaCount[AesType::AtBCContamination] = " << m_areaCount;
|
||||
@@ -281,7 +281,7 @@ Core::FunctionReplyObject HandlerNContamination::nContaminationModifyRequest(con
|
||||
|
||||
|
||||
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite n contamination Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
Reference in new issue
Block a user