Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+62
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/AdvancedSymbology/CMakeLists.txt
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2016-09-05
|
||||
#
|
||||
|
||||
NGL_ADD_LIBRARY(WS AsbData STATIC
|
||||
asb_foreign_interface_impl.cpp
|
||||
asb_foreign_interface_impl.h
|
||||
logger.cpp
|
||||
logger.h
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(AsbData
|
||||
GimDataPluginInterface
|
||||
AsbDataPluginInterface
|
||||
AesDataPluginInterface
|
||||
PpmDataPluginInterface
|
||||
advancedSymbology
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY(WS AsbDataPlugin MODULE
|
||||
asb_data_plugin.cpp
|
||||
asb_data_plugin.h
|
||||
asb_foreign_interface_impl.cpp
|
||||
asb_foreign_interface_impl.h
|
||||
logger.cpp
|
||||
logger.h
|
||||
)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(AsbDataPlugin
|
||||
AsbData
|
||||
Qt5::Core
|
||||
AsbDataPluginInterface
|
||||
GimDataPluginInterface
|
||||
svcAesCommon
|
||||
advancedSymbology
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
NGL_INSTALL_TARGET(AsbDataPlugin)
|
||||
|
||||
NGL_ADD_LIBRARY(WS AsbForeignDataPluginThp STATIC
|
||||
asb_foreign_interface_impl.cpp
|
||||
asb_foreign_interface_impl.h
|
||||
logger.cpp
|
||||
logger.h
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(AsbForeignDataPluginThp
|
||||
AsbData
|
||||
Qt5::Core
|
||||
AsbDataPluginInterface
|
||||
GimDataPluginInterface
|
||||
svcAesCommon
|
||||
advancedSymbology
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AdvancedSymbology
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "asb_data_plugin.h"
|
||||
#include "asb_foreign_interface_impl.h"
|
||||
#include "logger.h"
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
|
||||
#include <SymbologyImpl/advanced_symbology_logging.h>
|
||||
#include <Symbology/symbol_data_to_render_role.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
|
||||
AdvancedSymbology::SidcDefinitions::Identity roleToIdentity(const ParticipantManagement::Role role)
|
||||
{
|
||||
AdvancedSymbology::SidcDefinitions::Identity identity = AdvancedSymbology::SidcDefinitions::Identity::Unknown;
|
||||
switch (role.underlying()) {
|
||||
case ParticipantManagement::Role_def::Unknown:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::Unknown;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::Friend:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::Friend;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::Neutral:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::Neutral;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::Enemy:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::HostileFaker;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::Pending:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::Pending;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::AssumedFriend:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::AssumedFriend;
|
||||
break;
|
||||
case ParticipantManagement::Role_def::Suspect:
|
||||
identity = AdvancedSymbology::SidcDefinitions::Identity::SuspectJoker;
|
||||
break;
|
||||
} // switch
|
||||
|
||||
return identity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
return std::make_shared<DataInterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(LtsSession::LtsSessionDataDds *session)
|
||||
: DataInterface()
|
||||
, m_foreignInterface(nullptr)
|
||||
, m_session(session)
|
||||
{}
|
||||
|
||||
std::shared_ptr<ForeignDataInterface> DataInterfaceImpl::getForeignDataInterface()
|
||||
{
|
||||
if (!m_foreignInterface)
|
||||
{
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> aesDtc;
|
||||
std::shared_ptr<GuezIedManagement::Interface::Dtc> gimDtc;
|
||||
m_session->getDtc<ParticipantManagement::DataInterface>(ppmDtc);
|
||||
m_session->getDtc<AreaEffectSimulation::DataInterface>(aesDtc);
|
||||
m_session->getDtc<GuezIedManagement::DataInterface>(gimDtc);
|
||||
m_foreignInterface = std::make_shared<ForeignInterfaceImpl>(ppmDtc, aesDtc, gimDtc);
|
||||
}
|
||||
return m_foreignInterface;
|
||||
}
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AdvancedSymbology
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:asb")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("AdvancedSymbology"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override { Q_UNUSED(partition); return true; }
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
explicit DataInterfaceImpl(LtsSession::LtsSessionDataDds *session);
|
||||
std::shared_ptr<ForeignDataInterface> getForeignDataInterface() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ForeignDataInterface> m_foreignInterface;
|
||||
LtsSession::LtsSessionDataDds *m_session;
|
||||
};
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AdvancedSymbology
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "asb_foreign_interface_impl.h"
|
||||
#include "logger.h"
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <SymbologyImpl/advanced_symbology_logging.h>
|
||||
#include <Symbology/symbol_data_to_render_role.h>
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc,
|
||||
const std::shared_ptr<GuezIedManagement::Interface::Dtc> &guezIedDtc)
|
||||
: m_ppmDtc(ppmDtc)
|
||||
, m_aesDtc(aesDtc)
|
||||
, m_guezIedDtc(guezIedDtc)
|
||||
, m_logger(getLogger("AdvancedSymbologyPlugin"))
|
||||
{
|
||||
if (!m_ppmDtc)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "m_ppmDtc not available, No color and injury information will be included in created symbols";
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AdvancedSymbology::SymbolDictionary &ForeignInterfaceImpl::getSymbolDictionary(AdvancedSymbology::SymbologyType type) const
|
||||
{
|
||||
// The underlying dictionary should be created and initialized during login.
|
||||
return AdvancedSymbology::SymbolDictionary::dictionary(type);
|
||||
}
|
||||
|
||||
|
||||
AdvancedSymbology::SymbologyType ForeignInterfaceImpl::defaultSymbologyType() const
|
||||
{
|
||||
return AdvancedSymbology::SymbolDictionary::defaultSymbologyType();
|
||||
} // AdvancedSymbology::SymbologyType ForeignInterfaceImpl::defaultSymbologyType() const
|
||||
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const SymbolDictionary &dict,
|
||||
const SymbolDataToRender &symDataToRender) const
|
||||
{
|
||||
return dict.findImage(symDataToRender);
|
||||
}
|
||||
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const SymbolDataToRender &symDataToRender) const
|
||||
{
|
||||
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findImage(symDataToRender);
|
||||
}
|
||||
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findImage(const ParticipantManagement::Participant &participant, int sizeL, const QColor &desiredColor) const
|
||||
{
|
||||
AdvancedSymbology::SymbolDataToRender symDataToRender(QString::fromStdString(participant.symbol()), sizeL);
|
||||
|
||||
if (!m_ppmDtc)
|
||||
return findImage(symDataToRender);
|
||||
|
||||
// Party Role (aka Identity / Affiliation)
|
||||
const ParticipantManagement::Party &party = m_ppmDtc->party(participant.partyId());
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole<>(party.role());
|
||||
|
||||
// Party color
|
||||
symDataToRender.fillColor = desiredColor.isValid() ? desiredColor : QColor::fromRgb(QRgb(party.color()));
|
||||
symDataToRender.fillColorReplace = true;
|
||||
|
||||
// Injury color (which party caused the damage)
|
||||
QColor injuryColor = QColor(100, 100, 0); // 100, 100, 0 -> ocker;;
|
||||
ProjectDataManagement::VulnerabilityState currentState = ProjectDataManagement::VulnerabilityState::CombatReady;
|
||||
|
||||
const ParticipantManagement::DynamicParticipantData dData = m_ppmDtc->dynamicParticipantData(participant.id());
|
||||
|
||||
if (dData.stateHistory().size())
|
||||
{
|
||||
const ParticipantManagement::StateInformation &lastState = m_ppmDtc->youngestStateInformation(dData.stateHistory());
|
||||
currentState = lastState.vulnerabilityState();
|
||||
|
||||
switch (lastState.originatorType().underlying())
|
||||
{
|
||||
case ProjectDataManagement::StateChangeOriginator::ImprovisedExplosiveDevice:
|
||||
{
|
||||
if (m_guezIedDtc)
|
||||
{
|
||||
const GuezIedManagement::Ied &gIed = m_guezIedDtc->iedForEquipmentNumber(lastState.originatorId());
|
||||
if (gIed.id() > 0)
|
||||
{
|
||||
int injuryPartyId = gIed.partyId();
|
||||
if (injuryPartyId >= 0)
|
||||
injuryColor = m_ppmDtc->party(injuryPartyId).color();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::DusMine:
|
||||
{
|
||||
if (!m_aesDtc)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
|
||||
return findImage(symDataToRender);
|
||||
}
|
||||
const int partyId = m_aesDtc->partyForDusMine(lastState.originatorId());
|
||||
if (partyId >= 0)
|
||||
injuryColor = m_ppmDtc->party(partyId).color();
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation:
|
||||
case ProjectDataManagement::StateChangeOriginator::FunctionalArea:
|
||||
{
|
||||
if (!m_aesDtc)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Fetching 'm_aesDtc' failed, No color and injury information will be included in symbol created for participant.id() " << participant.id();
|
||||
return findImage(symDataToRender);
|
||||
}
|
||||
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
m_aesDtc->aesItemFromId(lastState.originatorId(), aesItem);
|
||||
|
||||
if (aesItem.partyId().is_set())
|
||||
injuryColor = m_ppmDtc->party(aesItem.partyId().get()).color();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ProjectDataManagement::StateChangeOriginator::Participant: // it's a participant not a party
|
||||
{
|
||||
const ParticipantManagement::Participant &participantOrigin = m_ppmDtc->participant(lastState.originatorId());
|
||||
|
||||
// Is the participant which caused the damaged known?
|
||||
if (participantOrigin.id())
|
||||
injuryColor = m_ppmDtc->party(participantOrigin.partyId()).color();
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::Party:
|
||||
{
|
||||
const ParticipantManagement::Party &partyOrigin = m_ppmDtc->party(lastState.originatorId());
|
||||
|
||||
if (partyOrigin.id())
|
||||
injuryColor = partyOrigin.color();
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::ObserverController:
|
||||
case ProjectDataManagement::StateChangeOriginator::ExerciseControl:
|
||||
case ProjectDataManagement::StateChangeOriginator::Initialization:
|
||||
injuryColor = m_ppmDtc->party(1).color(); //OC
|
||||
break;
|
||||
case ProjectDataManagement::StateChangeOriginator::WoundTreatmentDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::MedicalTimeout:
|
||||
case ProjectDataManagement::StateChangeOriginator::Sanitation:
|
||||
case ProjectDataManagement::StateChangeOriginator::MaintainanceDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::Unknown:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
symDataToRender.injury = stateToInjury(currentState);
|
||||
symDataToRender.injuryColor = injuryColor;
|
||||
|
||||
return findImage(symDataToRender);
|
||||
}
|
||||
|
||||
|
||||
AdvancedSymbology::Injury ForeignInterfaceImpl::stateToInjury(const ProjectDataManagement::VulnerabilityState &state)
|
||||
{
|
||||
switch (state.underlying())
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState::CombatReady:
|
||||
case ProjectDataManagement::VulnerabilityState::TemporarySeverance:
|
||||
case ProjectDataManagement::VulnerabilityState::NearMiss:
|
||||
case ProjectDataManagement::VulnerabilityState::HitWithNoEffect:
|
||||
return AdvancedSymbology::Injury::NoInjury;
|
||||
case ProjectDataManagement::VulnerabilityState::LightDamage:
|
||||
case ProjectDataManagement::VulnerabilityState::MediumDamage:
|
||||
case ProjectDataManagement::VulnerabilityState::HeavyDamage:
|
||||
case ProjectDataManagement::VulnerabilityState::NotReady:
|
||||
return AdvancedSymbology::Injury::Hit;
|
||||
case ProjectDataManagement::VulnerabilityState::MobilityKill:
|
||||
case ProjectDataManagement::VulnerabilityState::VisibleMobilityKill:
|
||||
return AdvancedSymbology::Injury::MobilityKill;
|
||||
case ProjectDataManagement::VulnerabilityState::WeaponSystemDamage:
|
||||
case ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage:
|
||||
return AdvancedSymbology::Injury::WeaponKill;
|
||||
case ProjectDataManagement::VulnerabilityState::CatastrophicKill:
|
||||
return AdvancedSymbology::Injury::TotalKill;
|
||||
case ProjectDataManagement::VulnerabilityState::NContamination:
|
||||
case ProjectDataManagement::VulnerabilityState::BContamination:
|
||||
case ProjectDataManagement::VulnerabilityState::CContamination:
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityBitsChanged:
|
||||
case ProjectDataManagement::VulnerabilityState::Reserved:
|
||||
case ProjectDataManagement::VulnerabilityState::NoChange:
|
||||
break;
|
||||
} // switch
|
||||
return AdvancedSymbology::Injury::NoInjury;
|
||||
}
|
||||
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findPreview(const SymbolDictionary &dict, const QString &sidc) const
|
||||
{
|
||||
return dict.findPreview(sidc);
|
||||
}
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findPreview(const QString &sidc) const
|
||||
{
|
||||
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findPreview(sidc);
|
||||
}
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findBaseSymbol(const SymbolDictionary &dict, const QString &sidc) const
|
||||
{
|
||||
return dict.findBaseSymbol(sidc);
|
||||
}
|
||||
|
||||
QSharedPointer<SymbolResult> ForeignInterfaceImpl::findBaseSymbol(const QString &sidc) const
|
||||
{
|
||||
return AdvancedSymbology::SymbolDictionary::dictionary(defaultSymbologyType()).findBaseSymbol(sidc);
|
||||
}
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AdvancedSymbology
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_enums.hpp>
|
||||
#include <Plugins/GuezIedManagement/gim_data_plugin_interface.h>
|
||||
#include <Symbology/symbol_dictionary.h>
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
namespace Interface
|
||||
{
|
||||
class Dtc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace AdvancedSymbology
|
||||
{
|
||||
class ForeignInterfaceImpl final : public QObject, public ForeignDataInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ForeignInterfaceImpl(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AreaEffectSimulation::Interface::Dtc> &aesDtc,
|
||||
const std::shared_ptr<GuezIedManagement::Interface::Dtc> &guezIedDtc);
|
||||
|
||||
//
|
||||
// SymbolDictionary: Access and find methods
|
||||
//
|
||||
AdvancedSymbology::SymbolDictionary &getSymbolDictionary(AdvancedSymbology::SymbologyType type) const override;
|
||||
|
||||
QSharedPointer<SymbolResult> findImage(const SymbolDictionary &dict, const SymbolDataToRender &symDataToRender) const override;
|
||||
QSharedPointer<SymbolResult> findImage(const SymbolDataToRender &symDataToRender) const override;
|
||||
QSharedPointer<SymbolResult> findImage(const ParticipantManagement::Participant &participant, int sizeL = 100, const QColor& desiredColor = QColor()) const override;
|
||||
|
||||
QSharedPointer<SymbolResult> findPreview(const SymbolDictionary &dict, const QString &sidc) const override;
|
||||
QSharedPointer<SymbolResult> findPreview(const QString &sidc) const override;
|
||||
|
||||
QSharedPointer<SymbolResult> findBaseSymbol(const SymbolDictionary &dict, const QString &sidc) const override;
|
||||
QSharedPointer<SymbolResult> findBaseSymbol(const QString &sidc) const override;
|
||||
|
||||
AdvancedSymbology::SymbologyType defaultSymbologyType() const override;
|
||||
|
||||
private:
|
||||
static AdvancedSymbology::Injury stateToInjury(const ProjectDataManagement::VulnerabilityState &state);
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_guezIedDtc;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace AdvancedSymbology
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Building - logging facility
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace BuildingViewer
|
||||
{
|
||||
|
||||
LOGGER_T getLogger(const char *name)
|
||||
{
|
||||
static const char ns[] = "ASB.";
|
||||
std::string loggerName;
|
||||
const size_t len = strlen(name);
|
||||
loggerName.reserve(sizeof(ns) + len);
|
||||
loggerName.append(ns, sizeof(ns) - 1);
|
||||
loggerName.append(name, len);
|
||||
|
||||
try
|
||||
{
|
||||
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
|
||||
getNGLLogger(loggerName);
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
fprintf(stderr, "Error retrieving logger: %s", ex.what());
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BuildingViewer
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Logging for BuildingViewer
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-08-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
namespace BuildingViewer
|
||||
{
|
||||
typedef NGL::INGLLogger &LOGGER_T;
|
||||
|
||||
LOGGER_T getLogger(const char *name);
|
||||
inline LOGGER_T getLogger(const QString &loggerName)
|
||||
{
|
||||
return getLogger(loggerName.toUtf8().constData());
|
||||
}
|
||||
} // namespace BuildingViewer
|
||||
Reference in new issue
Block a user