Skip to content

Commit

Permalink
Saving work on message hierarchy update, expected to compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Oct 13, 2024
1 parent c4c1523 commit 6db1be3
Show file tree
Hide file tree
Showing 30 changed files with 200 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Github Actions Build
on: [push]

env:
COMMS_TAG: v5.2.7
COMMS_TAG: develop

jobs:

Expand Down
3 changes: 2 additions & 1 deletion app/cc_view/src/GuiAppMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "cc_tools_qt/Message.h"
#include "cc_tools_qt/PluginMgr.h"
#include "cc_tools_qt/MsgSendMgr.h"
#include "cc_tools_qt/ToolsProtocol.h"

#include "ActionWrap.h"
#include "MsgMgrG.h"
Expand Down Expand Up @@ -64,7 +65,7 @@ class GuiAppMgr : public QObject
using MsgType = MsgMgr::MsgType ;
using ActionPtr = std::shared_ptr<QAction>;
using ListOfPluginInfos = PluginMgr::ListOfPluginInfos;
using MessagesList = Protocol::MessagesList;
using MessagesList = ToolsProtocol::MessagesList;
using FilteredMessages = std::vector<QString>;

enum class ActivityState
Expand Down
1 change: 0 additions & 1 deletion app/cc_view/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <QtCore/QCommandLineParser>
#include <QtCore/QStringList>

#include "cc_tools_qt/cc_tools_qt.h"
#include "PluginMgrG.h"
#include "GuiAppMgr.h"

Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/MessageUpdateDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void MessageUpdateDialog::msgUpdated()
assert(m_protocol);
assert(msg);
auto status = m_protocol->updateMessage(*msg);
bool forceUpdate = (status == Protocol::UpdateStatus::Changed);
bool forceUpdate = (status == ToolsProtocol::UpdateStatus::Changed);
assert(m_msgDisplayWidget);

// Direct invocation of m_msgDisplayWidget->displayMessage(std::move(msg))
Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/MessageUpdateDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private slots:

MessagePtr& m_msg;
ToolsProtocolPtr m_protocol;
Protocol::MessagesList m_allMsgs;
ToolsProtocol::MessagesList m_allMsgs;
MessageDisplayWidget* m_msgDisplayWidget = nullptr;
Ui::MessageUpdateDialog m_ui;
int m_prevDelay = DisabledDelayValue + 1;
Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/MsgListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ QString MsgListWidget::getTitleImpl() const
return QString();
}

void MsgListWidget::loadMessagesImpl([[maybe_unused]] const QString& filename, [[maybe_unused]] Protocol& protocol)
void MsgListWidget::loadMessagesImpl([[maybe_unused]] const QString& filename, [[maybe_unused]] ToolsProtocol& protocol)
{
}

Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/MsgListWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected slots:
virtual Qt::GlobalColor getItemColourImpl(MsgType type, bool valid) const;
virtual void msgMovedImpl(int idx);
virtual QString getTitleImpl() const;
virtual void loadMessagesImpl(const QString& filename, Protocol& protocol);
virtual void loadMessagesImpl(const QString& filename, ToolsProtocol& protocol);
virtual void saveMessagesImpl(const QString& filename);

MessagePtr currentMsg() const;
Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/RawHexDataDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RawHexDataDialog : public QDialog
Q_OBJECT
using Base = QDialog;
public:
typedef Protocol::MessagesList MessagesList;
typedef ToolsProtocol::MessagesList MessagesList;
RawHexDataDialog(
MessagesList& msgs,
ToolsProtocolPtr protocol,
Expand Down
6 changes: 4 additions & 2 deletions app/cc_view/src/widget/RightPaneWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "RightPaneWidget.h"

#include "cc_tools_qt/property/message.h"

#include <QtWidgets/QVBoxLayout>

#include "DefaultMessageDisplayWidget.h"
Expand Down Expand Up @@ -51,7 +53,7 @@ void RightPaneWidget::displayMessage(MessagePtr msg)
// Enable edit of the messages that haven't been sent or received yet,
// i.e. reside in the send area.
m_displayedMsg = msg;
auto type = property::message::Type().getFrom(*msg);
auto type = cc_tools_qt::property::message::Type().getFrom(*msg);
m_displayWidget->setEditEnabled(type == Message::Type::Invalid);
}

Expand All @@ -65,7 +67,7 @@ void RightPaneWidget::msgUpdated()
auto& msgMgr = MsgMgrG::instanceRef();
auto protocol = msgMgr.getProtocol();
auto status = protocol->updateMessage(*m_displayedMsg);
bool forceUpdate = (status == Protocol::UpdateStatus::Changed);
bool forceUpdate = (status == ToolsProtocol::UpdateStatus::Changed);

// Direct invocation of displayMessage(std::move(msg))
// in place here causes SIGSEGV. No idea why.
Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/SendMsgListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void SendMsgListWidget::msgMovedImpl(int idx)
GuiAppMgr::instanceRef().sendSelectedMsgMoved(idx);
}

void SendMsgListWidget::loadMessagesImpl(const QString& filename, Protocol& protocol)
void SendMsgListWidget::loadMessagesImpl(const QString& filename, ToolsProtocol& protocol)
{
auto msgs = MsgFileMgrG::instanceRef().load(MsgFileMgr::Type::Send, filename, protocol);
for (auto& m : msgs) {
Expand Down
2 changes: 1 addition & 1 deletion app/cc_view/src/widget/SendMsgListWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SendMsgListWidget: public MsgListWidget
virtual const QString& msgTooltipImpl() const override;
virtual void stateChangedImpl(int state) override;
virtual void msgMovedImpl(int idx) override;
virtual void loadMessagesImpl(const QString& filename, Protocol& protocol) override;
virtual void loadMessagesImpl(const QString& filename, ToolsProtocol& protocol) override;
virtual void saveMessagesImpl(const QString& filename) override;

private:
Expand Down
4 changes: 2 additions & 2 deletions doxygen/page_inter_plugin_config.dox
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/// @endcode
///
/// In case the plugin configuration is handled inside the class extending the
/// @ref cc_tools_qt::Socket "socket", @ref cc_tools_qt::Filter "filter", or @ref cc_tools_qt::Protocol "protocol",
/// @ref cc_tools_qt::Socket "socket", @ref cc_tools_qt::Filter "filter", or @ref cc_tools_qt::ToolsProtocol "protocol",
/// then such class can override its @ref cc_tools_qt::Socket::applyInterPluginConfigImpl() "applyInterPluginConfigImpl()"
/// member function while the plugin's @ref cc_tools_qt::Plugin::applyInterPluginConfigImpl() "applyInterPluginConfigImpl()"
/// one can redirect the request.
Expand Down Expand Up @@ -88,7 +88,7 @@
/// @endcode
///
/// In case the inter-plugin configuration event is initiated inside the class extending the
/// @ref cc_tools_qt::Socket "socket", @ref cc_tools_qt::Filter "filter", or @ref cc_tools_qt::Protocol "protocol",
/// @ref cc_tools_qt::Socket "socket", @ref cc_tools_qt::Filter "filter", or @ref cc_tools_qt::ToolsProtocol "protocol",
/// then such class can use inherited @ref cc_tools_qt::Socket::reportInterPluginConfig() member function
/// while the plugin class can set appropriate callback and use the inherited
/// @ref cc_tools_qt::Plugin::reportInterPluginConfig() "reportInterPluginConfig()" to propagate
Expand Down
4 changes: 2 additions & 2 deletions doxygen/page_plugin.dox
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@
///
/// @subsection page_plugin_properties_protocol Protocol Allocation Callback
/// The @b Protocol plugin (see @ref page_protocol_plugin) is expected to be able
/// to create and return cc_tools_qt::Protocol object when requested. However, it is up to
/// to create and return cc_tools_qt::ToolsProtocol object when requested. However, it is up to
/// the application to decide when. As the result, the actual plugin class
/// needs to provide a callback to be called when new cc_tools_qt::Protocol
/// needs to provide a callback to be called when new cc_tools_qt::ToolsProtocol
/// object is required. It is done using call to
/// cc_tools_qt::PluginProperties::setProtocolCreateFunc().
/// @code
Expand Down
12 changes: 6 additions & 6 deletions doxygen/page_protocol_plugin.dox
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@
/// the @b TransportMessage class.
///
/// @section page_protocol_plugin_protocol Protocol Class
/// The <b>CommsChampion Tools</b> use cc_tools_qt::Protocol polymorphic
/// The <b>CommsChampion Tools</b> use cc_tools_qt::ToolsProtocol polymorphic
/// interface class to create and update messages. It means that our @b protocol
/// definition class needs to be a descendent of cc_tools_qt::Protocol. The
/// definition class needs to be a descendent of cc_tools_qt::ToolsProtocol. The
/// latter defines multiple pure virtual functions, which the derived class
/// must implement. The @b cc_tools_qt library also provides
/// cc_tools_qt::ProtocolBase template class, which inherits from
/// cc_tools_qt::Protocol and implements most of the
/// cc_tools_qt::ToolsProtocol and implements most of the
/// required virtual functions using info from provided template parameters.
/// Hence, the custom protocol definition class
/// needs to inherit from cc_tools_qt::ProtocolBase and provide necessary
Expand Down Expand Up @@ -562,11 +562,11 @@
/// @li The first template parameter to cc_tools_qt::ProtocolBase class is a definition
/// of the "protocol stack" (see @ref page_protocol_plugin_stack), which handles
/// all the transport data.
/// @li The second template parameter to cc_tools_qt::Protocol class is a definition
/// @li The second template parameter to cc_tools_qt::ToolsProtocol class is a definition
/// of the "transport message", i.e the one difined in @ref page_protocol_plugin_transport_message
/// section.
/// @li The only pure virtual function defined by cc_tools_qt::Protocol and
/// not implemented in cc_tools_qt::ProtocolBase is cc_tools_qt::Protocol::nameImpl(),
/// @li The only pure virtual function defined by cc_tools_qt::ToolsProtocol and
/// not implemented in cc_tools_qt::ProtocolBase is cc_tools_qt::ToolsProtocol::nameImpl(),
/// i.e. the one that provides name of the protocol. The defined protocol class must override
/// and implement it.
///
Expand Down
2 changes: 0 additions & 2 deletions lib/include/cc_tools_qt/StaticSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#pragma once

#include "cc_tools_qt.h"

namespace cc_tools_qt
{

Expand Down
2 changes: 1 addition & 1 deletion lib/include/cc_tools_qt/ToolsProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace cc_tools_qt
/// @brief Main polymorphic interface class for protocols.
/// @details It is used by @b CommsChampion @b Tools to create and manipulate
/// protocol messages.
/// @headerfile cc_tools_qt/Protocol.h
/// @headerfile cc_tools_qt/ToolsProtocol.h

class CC_API ToolsProtocol
{
Expand Down
4 changes: 2 additions & 2 deletions lib/include/cc_tools_qt/ToolsTransportProtMessageBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
namespace cc_tools_qt
{

template <typename TMsgBase, typename TFields, typename TActualMsg, typename... TOptions>
template <typename TProtMsgBase, typename TFields, typename TActualMsg, typename... TOptions>
class ToolsTransportProtMessageBase : public
comms::MessageBase<
TMsgBase,
TProtMsgBase,
comms::option::NoIdImpl,
comms::option::FieldsImpl<TFields>,
comms::option::MsgType<TActualMsg>,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/ToolsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ ToolsFrame::MessagesList ToolsFrame::readData(const DataInfo& dataInfo, bool fin
return readDataImpl(dataInfo, final);
}

void ToolsFrame::updateMessage(Message& msg)
{
updateMessageImpl(msg);
}

MessagePtr ToolsFrame::createInvalidMessage()
{
return createInvalidMessageImpl();
Expand Down
9 changes: 5 additions & 4 deletions plugin/raw_data_protocol/cc_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ function (cc_plugin_raw_data_protocol)


set (src
# RawDataProtocolPlugin.cpp
# RawDataProtocol.cpp
# RawDataProtocolTransportMessage.cpp
RawDataProtocolPlugin.h
RawDataProtocolPlugin.cpp
RawDataProtocol.cpp
RawDataProtocolTransportMessage.cpp
RawDataProtocolDataMessage.cpp
# RawDataProtocolPlugin.h

)

add_library (${name} MODULE ${src})
Expand Down
4 changes: 3 additions & 1 deletion plugin/raw_data_protocol/cc_plugin/RawDataProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "RawDataProtocol.h"

#include "comms/comms.h"
#include "RawDataProtocolFrame.h"

namespace cc = cc_tools_qt;

Expand All @@ -33,6 +33,8 @@ namespace raw_data_protocol
namespace cc_plugin
{

RawDataProtocol::RawDataProtocol() : Base(std::make_unique<RawDataProtocolFrame>()) {}

RawDataProtocol::~RawDataProtocol() noexcept = default;

const QString& RawDataProtocol::nameImpl() const
Expand Down
18 changes: 4 additions & 14 deletions plugin/raw_data_protocol/cc_plugin/RawDataProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

#pragma once

#include "RawDataProtocolStack.h"
#include "RawDataProtocolTransportMessage.h"

#include "cc_tools_qt/ProtocolBase.h"
#include "cc_tools_qt/ToolsProtocol.h"

namespace cc_tools_qt
{
Expand All @@ -35,18 +32,11 @@ namespace raw_data_protocol
namespace cc_plugin
{

class RawDataProtocol : public
cc_tools_qt::ProtocolBase<
cc_plugin::RawDataProtocolStack,
cc_plugin::RawDataProtocolTransportMessage
>
class RawDataProtocol : public cc_tools_qt::ToolsProtocol
{
typedef cc_tools_qt::ProtocolBase<
cc_plugin::RawDataProtocolStack,
cc_plugin::RawDataProtocolTransportMessage
> Base;
using Base = cc_tools_qt::ToolsProtocol;
public:
RawDataProtocol() = default;
RawDataProtocol();
virtual ~RawDataProtocol() noexcept;

protected:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved.
// Copyright 2024 - 2024 (C). Alex Robenko. All rights reserved.
//

// This file is free software: you can redistribute it and/or modify
Expand All @@ -18,10 +18,10 @@

#pragma once

#include "raw_data_protocol/Stack.h"
#include "RawDataProtocolMessage.h"
#include "RawDataProtocolDataMessage.h"

#include <tuple>

namespace cc_tools_qt
{

Expand All @@ -34,10 +34,9 @@ namespace raw_data_protocol
namespace cc_plugin
{

using RawDataProtocolStack =
raw_data_protocol::Stack<
cc_plugin::RawDataProtocolMessage,
cc_plugin::RawDataProtocolDataMessage
using RawDataProtocolAllMessages =
std::tuple<
RawDataProtocolDataMessage
>;

} // namespace cc_plugin
Expand All @@ -47,4 +46,3 @@ using RawDataProtocolStack =
} // namespace plugin

} // namespace cc_tools_qt

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace cc_plugin
class RawDataProtocolDataMessage : public
cc_tools_qt::ToolsMessageBase<
RawDataProtocolMessage,
raw_data_protocol::DataMessage<cc_tools_qt::ToolsProtMsgInterface<raw_data_protocol::Message>>,
raw_data_protocol::DataMessage,
RawDataProtocolDataMessage>
{
protected:
Expand Down
Loading

0 comments on commit 6db1be3

Please sign in to comment.