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
+16
-16
@@ -14,7 +14,7 @@ namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
HandlerTechnicalArea::HandlerTechnicalArea(MainHandler *mainHandler)
|
||||
: HandlerBaseTmpl<ObjectTechnicalArea>(mainHandler, QStringLiteral("TechnicalArea"), s_areaCount[AesType::AtTechnicalArea], s_areaCountCentral[AesType::AtTechnicalArea])
|
||||
: HandlerBaseTmpl<ObjectTechnicalArea>(mainHandler, QStringLiteral("TechnicalArea"), s_areaCount[static_cast<int>(AesType::AtTechnicalArea)], s_areaCountCentral[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
, Interface::Fts::TechnicalAreaModifyRequestHandler(mainHandler->dds()->fts())
|
||||
, Interface::Fts::TechnicalAreaRemoveRequestHandler(mainHandler->dds()->fts())
|
||||
{
|
||||
@@ -43,7 +43,7 @@ bool HandlerTechnicalArea::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtTechnicalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
{
|
||||
ERROR_LOG(m_logger) << "More active technical areas in database than allowed - ignoring the rest!";
|
||||
delete ifs;
|
||||
@@ -65,31 +65,31 @@ bool HandlerTechnicalArea::init()
|
||||
|
||||
int HandlerTechnicalArea::totalAreas() const
|
||||
{
|
||||
return s_areaCount[AesType::AtTechnicalArea];
|
||||
return s_areaCount[static_cast<int>(AesType::AtTechnicalArea)];
|
||||
}
|
||||
|
||||
int HandlerTechnicalArea::totalAreasCentral() const
|
||||
{
|
||||
return s_areaCountCentral[AesType::AtTechnicalArea];
|
||||
return s_areaCountCentral[static_cast<int>(AesType::AtTechnicalArea)];
|
||||
}
|
||||
|
||||
static void fillData(const TechnicalAreaModifyRequest &src, Database::AesTechnicalArea &dst)
|
||||
{
|
||||
dst.name = QString::fromStdString(src.name());
|
||||
dst.name = QString::fromStdString(src.name);
|
||||
dst.chargeTypeId = 421; // dummy
|
||||
dst.effectDuration = 0; // forever active
|
||||
dst.typeId = src.type().underlying();
|
||||
dst.position.rx() = src.area().cornerBottomLeft().lon();
|
||||
dst.position.ry() = src.area().cornerBottomLeft().lat();
|
||||
dst.length = src.area().height();
|
||||
dst.width = src.area().width();
|
||||
dst.typeId = src.type;
|
||||
dst.position.rx() = src.area.cornerBottomLeft.lon;
|
||||
dst.position.ry() = src.area.cornerBottomLeft.lat;
|
||||
dst.length = src.area.height;
|
||||
dst.width = src.area.width;
|
||||
}
|
||||
|
||||
void HandlerTechnicalArea::onTechnicalAreaModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTechnicalAreaModifyRequest: " << request;
|
||||
Core::FunctionReplyObject ret = request.id() > 0 ? technicalAreaModifyRequest(request) : technicalAreaCreateRequest(request);
|
||||
Core::FunctionReplyObject ret = request.id > 0 ? technicalAreaModifyRequest(request) : technicalAreaCreateRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->dds()->fts()->technicalAreaModifyReply(cookie, ret);
|
||||
@@ -97,7 +97,7 @@ void HandlerTechnicalArea::onTechnicalAreaModifyRequest(const rti::core::SampleI
|
||||
|
||||
Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaCreateRequest(const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
if (totalAreas() >= s_maxActiveAreas[AesType::AtTechnicalArea])
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)])
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Too many active technical areas."));
|
||||
|
||||
Database::AesTechnicalArea newData;
|
||||
@@ -129,20 +129,20 @@ Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaCreateRequest(const
|
||||
Core::FunctionReplyObject HandlerTechnicalArea::technicalAreaModifyRequest(const TechnicalAreaModifyRequest &request)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectTechnicalArea *ifs = getObjectFromMap(m_objectMap, request.id(), ret);
|
||||
ObjectTechnicalArea *ifs = getObjectFromMap(m_objectMap, 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::AtTechnicalArea] && !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Too many active technical areas."));
|
||||
if (totalAreas() >= s_maxActiveAreas[static_cast<int>(AesType::AtTechnicalArea)] && !ifs->isObjectModifiable())
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Too many active technical areas."));
|
||||
|
||||
// Todo: IsObjectModifiable() ?!?
|
||||
|
||||
AreaEffectSimulation::Database::AesTechnicalArea aea(ifs->data());
|
||||
fillData(request, aea);
|
||||
if (request.id() < 0 && checkStateForSfm(ifs))
|
||||
if (request.id < 0 && checkStateForSfm(ifs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Overwrite technical area Effect State for OC";
|
||||
aea.effectStateId = AesEffectState::EsPrepared;
|
||||
|
||||
Reference in new issue
Block a user