Resolves latest issues in Lts/Common Lts/DDS
This commit is contained in:
25 files changed
+537
-47
No files matched your search
@@ -23,14 +23,15 @@
|
||||
#ifdef BUILD_RTI
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
#include "INGLLogger.h"
|
||||
#include "DDS/Core/core_dtc_types.h"
|
||||
namespace DDSConnector { class DdsConnector; }
|
||||
namespace DTC { template<typename T> class GenericDTCImpl; }
|
||||
namespace Core { struct PartitionTime; }
|
||||
namespace DataPluginBase { class Interface; }
|
||||
class Fetcher;
|
||||
namespace GuiPluginBase { class Interface; }
|
||||
#else
|
||||
// Forward declarations for stub types
|
||||
namespace DataPluginBase { class Interface; }
|
||||
namespace GuiPluginBase { class Interface; }
|
||||
#endif
|
||||
|
||||
namespace LtsSession
|
||||
@@ -46,6 +47,8 @@ enum class PartitionType {
|
||||
Invalid = -1
|
||||
};
|
||||
|
||||
class Fetcher;
|
||||
|
||||
struct DdsConnectionParams
|
||||
{
|
||||
int domainId = -1;
|
||||
@@ -150,6 +153,26 @@ class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds : public QObject
|
||||
template<typename T, typename S>
|
||||
bool getDtc(std::shared_ptr<S> &val) const;
|
||||
|
||||
// Foreign GUI interface retrieval - used by Fetcher helper class
|
||||
template<typename S>
|
||||
bool getForeignGuiInterface(std::shared_ptr<S> &val) const
|
||||
{
|
||||
#ifdef BUILD_RTI
|
||||
for (const auto &i : m_guiPluginInterfaces)
|
||||
{
|
||||
val = std::dynamic_pointer_cast<S>(i);
|
||||
if (val)
|
||||
return true;
|
||||
}
|
||||
val.reset();
|
||||
if (m_logger.isDebug())
|
||||
m_logger.debug() << "Cannot find foreign gui ifc " << typeid(S).name() << " in " << toString();
|
||||
#else
|
||||
val.reset();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
signals:
|
||||
void partitionTimeChanged(qint64 newPartitionTime);
|
||||
void partitionTimeChangedInternal();
|
||||
@@ -158,6 +181,7 @@ class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds : public QObject
|
||||
#ifdef BUILD_RTI
|
||||
bool initInternal();
|
||||
void onPartitionTimeChangedInternal();
|
||||
static LtsSession::PartitionType toPartitionType(IDL::PartitionType idlType);
|
||||
|
||||
// Member variables - only with RTI
|
||||
int m_exerciseId;
|
||||
@@ -170,6 +194,8 @@ class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds : public QObject
|
||||
std::shared_ptr<DTC::GenericDTCImpl<Core::PartitionTime>> m_dtcPartitionTime;
|
||||
NGL::INGLLogger& m_logger;
|
||||
QMap<QString, std::shared_ptr<DataPluginBase::Interface>> m_dataPluginInterfaces;
|
||||
QMap<QString, std::shared_ptr<GuiPluginBase::Interface>> m_guiPluginInterfaces;
|
||||
QStringList m_qosFileList;
|
||||
#else
|
||||
// Stub implementation - minimal members
|
||||
bool initInternal();
|
||||
@@ -183,6 +209,65 @@ class LTSSESSIONDATADDS_EXPORT LtsSessionDataDds : public QObject
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef BUILD_RTI
|
||||
class Fetcher
|
||||
{
|
||||
public:
|
||||
Fetcher(LtsSessionDataDds *sessionDataDds, const QString &caller)
|
||||
: m_sessionDataDds(sessionDataDds)
|
||||
, m_errors(false)
|
||||
, m_caller(caller)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsSession.Fetcher"))
|
||||
, m_optional(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LtsSessionDataDds *m_sessionDataDds;
|
||||
bool m_errors;
|
||||
QString m_caller;
|
||||
QString m_whatWillNotWork;
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_optional;
|
||||
QString m_resultType;
|
||||
QString m_getterFunctionType;
|
||||
|
||||
template <typename ForeignGuiInterface>
|
||||
void getForeignGuiInterface(std::shared_ptr<ForeignGuiInterface> &foreignGuiInterface, const QString &whatWillNotWork /* only fill if optional */, bool optional)
|
||||
{
|
||||
if (!m_sessionDataDds->getForeignGuiInterface(foreignGuiInterface))
|
||||
{
|
||||
m_whatWillNotWork = whatWillNotWork;
|
||||
m_optional = optional;
|
||||
m_resultType = QString::fromUtf8(typeid(ForeignGuiInterface).name());
|
||||
m_getterFunctionType = QStringLiteral("gui interface");
|
||||
print();
|
||||
}
|
||||
}
|
||||
|
||||
bool status() const
|
||||
{
|
||||
return !m_errors;
|
||||
}
|
||||
|
||||
void print()
|
||||
{
|
||||
m_errors = true;
|
||||
|
||||
QString msg(QStringLiteral("%1 cannot find '%2' in %3 %4"));
|
||||
|
||||
if (m_optional)
|
||||
{
|
||||
INFO_LOG(m_logger) << msg.arg(m_caller, m_resultType, m_sessionDataDds->toString(), QStringLiteral("' - optional but %1 will not work").arg(m_whatWillNotWork));
|
||||
}
|
||||
else // critical
|
||||
{
|
||||
ERROR_LOG(m_logger) << msg.arg(m_caller, m_resultType, m_sessionDataDds->toString(), QStringLiteral(" which is required"));
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace LtsSession
|
||||
|
||||
// Template method implementations - must be in header
|
||||
|
||||
Reference in new issue
Block a user