Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
# DataPluginInterface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
DataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core
|
||||
)
|
||||
|
||||
# GuiPluginInterface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
GuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core LtsWidgets ProjectConfig LtsAppDescriptor LtsUtilsCore
|
||||
)
|
||||
|
||||
# projectPluginInterface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
ProjectPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/project_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core
|
||||
)
|
||||
|
||||
# stylePluginInterface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
StylePluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/style_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core
|
||||
)
|
||||
|
||||
# record_replay_plugin
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
RecordReplayPlugin
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/record_replay_plugin.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core
|
||||
)
|
||||
|
||||
# Topic Replay Interface
|
||||
ADD_INTERFACE_LIBRARY(
|
||||
TopicReplayInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/topic_replay_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
Qt5::Core
|
||||
)
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ProjectConfig/project_defines.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSessionDataDds;
|
||||
}
|
||||
|
||||
namespace DataPluginBase
|
||||
{
|
||||
|
||||
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
Interface() = default;
|
||||
virtual ~Interface() = default;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
Plugin() = default;
|
||||
virtual ~Plugin() = default;
|
||||
|
||||
virtual QString pluginName() const = 0;
|
||||
virtual std::shared_ptr<Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) = 0;
|
||||
virtual bool availableInPartition(IDL::PartitionType partition) const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(DataPluginBase::Plugin, "data:")
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_base.h>
|
||||
#include <ProjectConfig/project_defines.h>
|
||||
#include <LtsAppDescriptor/lts_app_descriptor.h>
|
||||
#include <LtsUtilsCore/lts_translatable_identifier.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QFlags>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
}
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class LtsBackgroundWidget;
|
||||
class LtsBaseLayoutWidget;
|
||||
}
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSession;
|
||||
}
|
||||
|
||||
namespace GuiPluginBase
|
||||
{
|
||||
class Interface;
|
||||
|
||||
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
Plugin() = default;
|
||||
virtual ~Plugin() = default;
|
||||
|
||||
virtual QString pluginName() = 0;
|
||||
virtual std::shared_ptr<Interface> createGuiInterface(LtsSession::LtsSession *session) = 0;
|
||||
virtual bool availableInPartition(IDL::PartitionType partition) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
Interface(LtsSession::LtsSession *session, NGL::INGLLogger &logger)
|
||||
: m_hasInit(true)
|
||||
, m_session(session)
|
||||
, m_logger(logger)
|
||||
, m_appId(LtsAppDescriptor::App::Login)
|
||||
{}
|
||||
virtual ~Interface() = default;
|
||||
|
||||
void setFlags(const QFlags<LtsAppDescriptor::PluginInfo::Flag> &flags) { m_flags = flags; }
|
||||
const QFlags<LtsAppDescriptor::PluginInfo::Flag> &getFlags() const { return m_flags; }
|
||||
void setOptions(const QStringList &options) { m_options = options; }
|
||||
const QStringList &getOptions() const { return m_options; }
|
||||
void setAppId(LtsAppDescriptor::App appId) { m_appId = appId; }
|
||||
LtsAppDescriptor::App appId() const { return m_appId; }
|
||||
|
||||
virtual QVector<LtsWidgets::PluginData> getActions() { return QVector<LtsWidgets::PluginData>(); }
|
||||
|
||||
virtual bool fetchInterfaces() { return true; }
|
||||
virtual void clearInterfaces() {}
|
||||
virtual QString menuGroup() const { return {}; }
|
||||
virtual LtsUtils::LtsTranslatableIdentifier menuGroupIdentifier() const { m_hasMenuGroupIdentifier = false; return {}; }
|
||||
virtual bool availableInPartition(IDL::PartitionType partition) const { Q_UNUSED(partition); return true; }
|
||||
virtual void init() { m_hasInit = false; }
|
||||
|
||||
|
||||
virtual void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) { (void)mainBackground; }
|
||||
virtual int executionPriority() const { return -1; }
|
||||
|
||||
|
||||
|
||||
bool m_hasInit;
|
||||
mutable bool m_hasMenuGroupIdentifier = true;
|
||||
|
||||
protected:
|
||||
LtsSession::LtsSession *m_session;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
private:
|
||||
QFlags<LtsAppDescriptor::PluginInfo::Flag> m_flags;
|
||||
QStringList m_options;
|
||||
LtsAppDescriptor::App m_appId;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(GuiPluginBase::Plugin, "gui")
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectPlugin
|
||||
{
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
Plugin() = default;
|
||||
virtual ~Plugin() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(ProjectPlugin::Plugin, "project")
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
|
||||
namespace DDSConnector
|
||||
{
|
||||
class DdsConnector;
|
||||
}
|
||||
|
||||
class NSqlQuery;
|
||||
namespace RecordReplay
|
||||
{
|
||||
class RecordReplayPlugin
|
||||
{
|
||||
public:
|
||||
RecordReplayPlugin() = default;
|
||||
virtual ~RecordReplayPlugin() = default;
|
||||
|
||||
virtual QString pluginName() const = 0;
|
||||
|
||||
|
||||
|
||||
virtual bool initDtc(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
|
||||
int exerciseId) = 0;
|
||||
|
||||
|
||||
virtual bool initDts(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
|
||||
int exerciseId,
|
||||
bool bCanHandleSchemas,
|
||||
NSqlQuery &query) = 0;
|
||||
|
||||
|
||||
|
||||
virtual bool initCopy(int exerciseId, bool bCanHandleSchemasRead, bool bCanHandleSchemasWrite) = 0;
|
||||
|
||||
|
||||
|
||||
virtual bool copyData(NSqlQuery &queryFrom, NSqlQuery &queryTo, qint64 fromTime, qint64 toTime) = 0;
|
||||
|
||||
|
||||
|
||||
virtual QString svcShortName() const = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool ddsTopicsToDatabase(NSqlQuery &query, QHash<QString, qint64> &minRecordSampleTimes) = 0;
|
||||
|
||||
|
||||
|
||||
virtual bool setReplayStartTime(NSqlQuery &query, qint64 startTime) = 0;
|
||||
|
||||
|
||||
virtual bool ddsTopicsFromDatabase(NSqlQuery &query, qint64 fromTime, qint64 toTime) = 0;
|
||||
|
||||
|
||||
virtual bool publishData(qint64 desiredTime) = 0;
|
||||
|
||||
|
||||
virtual bool waitForAsyncOperations(qint64 desiredTime) { Q_UNUSED(desiredTime); return true; }
|
||||
|
||||
|
||||
virtual void clearData() = 0;
|
||||
|
||||
|
||||
struct RecSnapshot
|
||||
{
|
||||
qint64 timeStamp = 0;
|
||||
std::map<int64_t, int64_t> recIdArray;
|
||||
RecSnapshot() = default;
|
||||
RecSnapshot(qint64 timeStamp_, const std::map<int64_t, int64_t> &recIdArray_)
|
||||
: timeStamp(timeStamp_)
|
||||
, recIdArray(recIdArray_)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
virtual std::map<QString, std::vector<RecSnapshot>> getSnapshotTimes(NSqlQuery &query,
|
||||
qint64 toTime,
|
||||
qint64 interval,
|
||||
const QHash<QString, qint64> &minRecordedSampleTimes) = 0;
|
||||
|
||||
|
||||
|
||||
virtual QVector<QString> getRecordTopicNames() const = 0;
|
||||
|
||||
|
||||
|
||||
virtual QVector<QString> getRecordTableNames() const = 0;
|
||||
|
||||
|
||||
|
||||
virtual qint64 getMinimumSampleTime(NSqlQuery &q, const QString &topicName, qint64 defaultValue) const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(RecordReplay::RecordReplayPlugin, "special:3:recordreplay")
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace StylePlugin
|
||||
{
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
Plugin() = default;
|
||||
virtual ~Plugin() = default;
|
||||
|
||||
virtual void loadStyle(bool highDpi) = 0;
|
||||
virtual void unloadStyle() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(StylePlugin::Plugin, "style")
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <TopicEditorBase/topic_editor_utils.h>
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QVector>
|
||||
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace TopicEditorBase { class ExportNotifier; }
|
||||
|
||||
|
||||
namespace TopicReplay
|
||||
{
|
||||
|
||||
|
||||
|
||||
class Interface
|
||||
{
|
||||
|
||||
public:
|
||||
static QJsonObject timeRange(qint64 start, qint64 end)
|
||||
{
|
||||
return { {QStringLiteral("start"), start}, {QStringLiteral("end"), end} };
|
||||
}
|
||||
|
||||
struct SituationReplayTime
|
||||
{
|
||||
int id = 0;
|
||||
|
||||
qint64 topicStart_s = -1;
|
||||
qint64 topicEnd_s = -1;
|
||||
|
||||
qint64 replayStart_ms = -1;
|
||||
qint64 replayEnd_ms = -1;
|
||||
double replaySpeedFactor = 1;
|
||||
|
||||
QJsonObject toReplayInformation() const
|
||||
{
|
||||
return {
|
||||
{QStringLiteral("id"), id},
|
||||
{QStringLiteral("timeInPresentation"), timeRange(topicStart_s * 1000, topicEnd_s * 1000)},
|
||||
};
|
||||
}
|
||||
QJsonObject toPlaybackTime(double max) const
|
||||
{
|
||||
QJsonObject ret = timeRange(replayStart_ms, std::min(replayEnd_ms * replaySpeedFactor, max));
|
||||
ret[QStringLiteral("replaySpeedFactor")] = replaySpeedFactor;
|
||||
return ret;
|
||||
}
|
||||
QJsonObject toJson(double maxReplayEndMs) const
|
||||
{
|
||||
return {
|
||||
{QStringLiteral("playbackTime"), toPlaybackTime(maxReplayEndMs)},
|
||||
{QStringLiteral("replayInformation"), toReplayInformation()},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Interface() = default;
|
||||
virtual ~Interface() = default;
|
||||
|
||||
|
||||
|
||||
virtual QWidget *createWidget() { return nullptr; }
|
||||
|
||||
|
||||
|
||||
|
||||
virtual bool playbackInit(const QJsonObject &attributes) { Q_UNUSED(attributes); return true; }
|
||||
|
||||
|
||||
virtual bool playbackStart(int secondsOffset) { Q_UNUSED(secondsOffset); return true; }
|
||||
virtual bool playbackPause() { return true; }
|
||||
virtual bool playbackStop() { return true; }
|
||||
|
||||
|
||||
|
||||
virtual void setExportPlaybackTimes(
|
||||
qint64 startTimeSec, qint64 durationSec, const QVector<SituationReplayTime> &sitReplayTimes
|
||||
)
|
||||
{
|
||||
Q_UNUSED(startTimeSec);
|
||||
Q_UNUSED(durationSec);
|
||||
Q_UNUSED(sitReplayTimes);
|
||||
}
|
||||
virtual bool exportTopic(
|
||||
const QJsonObject &attributes, const QString &strFolderPath, TopicEditorBase::ExportNotifier *pExportNotifier
|
||||
) = 0;
|
||||
|
||||
|
||||
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject &attributes) const
|
||||
{
|
||||
Q_UNUSED(attributes);
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual QVector<TopicEditorBase::TopicData> additionalTrackEntries(const QJsonObject &attributes, bool &keepOriginalTopic) const
|
||||
{
|
||||
keepOriginalTopic = true;
|
||||
return additionalTrackEntries(attributes);
|
||||
}
|
||||
|
||||
virtual void setBasePath(const QString &basePath) { Q_UNUSED(basePath); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class Factory
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~Factory() = default;
|
||||
virtual Interface *createInterface(TopicEditorBase::TopicType topicType) = 0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user