Skip to content

Commit

Permalink
Saving work of message hierarchy restructuring.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Oct 7, 2024
1 parent 43bdb97 commit 9d42c96
Show file tree
Hide file tree
Showing 28 changed files with 360 additions and 47 deletions.
49 changes: 49 additions & 0 deletions demo/cc_plugin/DemoFrame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Copyright 2015 - 2016 (C). Alex Robenko. All rights reserved.
//

// This file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.


#pragma once

#include "DemoMessage.h"
#include "DemoMsgFactory.h"

#include "demo/Stack.h"

#include "cc_tools_qt/ToolsFrameBase.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"

namespace demo
{

namespace cc_plugin
{

namespace details
{

using DemoProtMsg = cc_tools_qt::ToolsProtMsgInterface<DemoMessage::ProtMsg>;
using DemoProtFrame = demo::Stack<DemoProtMsg>;

} // namespace details


using DemoFrame = cc_tools_qt::ToolsFrameBase<DemoMessage, details::DemoProtFrame, DemoMsgFactory>;

} // namespace cc_plugin

} // namespace demo

4 changes: 3 additions & 1 deletion demo/cc_plugin/DemoProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

// #include "DemoStack.h"
#include "DemoFrame.h"
#include "DemoMessage.h"
#include "DemoMsgFactory.h"
#include "DemoTransportMessage.h"
Expand All @@ -35,7 +36,8 @@ class DemoProtocol : public
cc_tools_qt::ToolsProtocolBase<
DemoMessage,
DemoTransportMessage,
DemoMsgFactory
DemoMsgFactory,
DemoFrame
>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Bitfields.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Bitfields.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Bitfields : public
cc_tools_qt::ToolsMessageBase<
demo::message::Bitfields<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Bitfields<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Bitfields,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/BitmaskValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/BitmaskValues.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class BitmaskValues : public
cc_tools_qt::ToolsMessageBase<
demo::message::BitmaskValues<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::BitmaskValues<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::BitmaskValues,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Bundles.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Bundles.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Bundles : public
cc_tools_qt::ToolsMessageBase<
demo::message::Bundles<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Bundles<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Bundles,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/EnumValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/EnumValues.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class EnumValues : public
cc_tools_qt::ToolsMessageBase<
demo::message::EnumValues<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::EnumValues<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::EnumValues,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/FloatValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/FloatValues.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class FloatValues : public
cc_tools_qt::ToolsMessageBase<
demo::message::FloatValues<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::FloatValues<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::FloatValues,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/IntValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/IntValues.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class IntValues : public
cc_tools_qt::ToolsMessageBase<
demo::message::IntValues<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::IntValues<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::IntValues,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Lists.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Lists : public
cc_tools_qt::ToolsMessageBase<
demo::message::Lists<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Lists<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Lists,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Optionals.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Optionals.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Optionals : public
cc_tools_qt::ToolsMessageBase<
demo::message::Optionals<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Optionals<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Optionals,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Strings.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Strings : public
cc_tools_qt::ToolsMessageBase<
demo::message::Strings<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Strings<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Strings,
demo::cc_plugin::DemoMessage>
{
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Variants.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "demo/message/Variants.h"
#include "demo/DemoMessage.h"
#include "DemoMessage.h"
Expand All @@ -35,7 +35,7 @@ namespace message

class Variants : public
cc_tools_qt::ToolsMessageBase<
demo::message::Variants<cc_tools_qt::ToolsMessageInterface<demo::DemoMessage>>,
demo::message::Variants<cc_tools_qt::ToolsProtMsgInterface<demo::DemoMessage>>,
demo::cc_plugin::message::Variants,
demo::cc_plugin::DemoMessage>
{
Expand Down
54 changes: 54 additions & 0 deletions demo/protocol/include/demo/AllMessages.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// Copyright 2015 - 2016 (C). Alex Robenko. All rights reserved.
//

// This file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.


#pragma once

#include <tuple>
#include "demo/DemoMessage.h"
#include "demo/MsgId.h"

#include "demo/message/IntValues.h"
#include "demo/message/EnumValues.h"
#include "demo/message/BitmaskValues.h"
#include "demo/message/Bitfields.h"
#include "demo/message/Strings.h"
#include "demo/message/Lists.h"
#include "demo/message/Optionals.h"
#include "demo/message/FloatValues.h"
#include "demo/message/Variants.h"
#include "demo/message/Bundles.h"

namespace demo
{

template <typename TMsgBase>
using AllMessages = std::tuple<
demo::message::IntValues<TMsgBase>,
demo::message::EnumValues<TMsgBase>,
demo::message::BitmaskValues<TMsgBase>,
demo::message::Bitfields<TMsgBase>,
demo::message::Strings<TMsgBase>,
demo::message::Lists<TMsgBase>,
demo::message::Optionals<TMsgBase>,
demo::message::FloatValues<TMsgBase>,
demo::message::Variants<TMsgBase>,
demo::message::Bundles<TMsgBase>
>;

} // namespace demo

9 changes: 5 additions & 4 deletions demo/protocol/include/demo/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@

#include "comms/comms.h"

#include "MsgId.h"
#include "DemoMessage.h"
#include "FieldBase.h"
#include "demo/MsgId.h"
#include "demo/DemoMessage.h"
#include "demo/FieldBase.h"
#include "demo/AllMessages.h"

namespace demo
{
Expand Down Expand Up @@ -129,7 +130,7 @@ using StackBase =
/// type of the payload field for "caching" read/write operations.
template <
typename TMsgBase,
typename TMessages,
typename TMessages = demo::AllMessages<TMsgBase>,
typename TMsgAllocOptions = comms::option::EmptyOption,
typename TDataFieldStorageOptions = comms::option::EmptyOption >
class Stack : public StackBase<TMsgBase, TMessages, TMsgAllocOptions, TDataFieldStorageOptions>
Expand Down
4 changes: 2 additions & 2 deletions lib/include/cc_tools_qt/ToolsExtraInfoMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "cc_tools_qt/ToolsMessageBase.h"
#include "cc_tools_qt/ToolsMessageInterface.h"
#include "cc_tools_qt/ToolsProtMsgInterface.h"
#include "cc_tools_qt/property/field.h"

#include "comms/field/String.h"
Expand Down Expand Up @@ -73,7 +73,7 @@ class ToolsExtraInfoMessageImpl : public
template<typename TBase>
class ToolsExtraInfoMessage : public
cc_tools_qt::ToolsMessageBase<
details::ToolsExtraInfoMessageImpl<ToolsMessageInterface<TBase::template ProtMsg>>,
details::ToolsExtraInfoMessageImpl<ToolsProtMsgInterface<TBase::template ProtMsg>>,
ToolsExtraInfoMessage<TBase>,
TBase
>
Expand Down
46 changes: 46 additions & 0 deletions lib/include/cc_tools_qt/ToolsFrame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// Copyright 2024 - 2024 (C). Alex Robenko. All rights reserved.
//

// This file is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.


#pragma once

#include "cc_tools_qt/DataInfo.h"
#include "cc_tools_qt/Message.h"

#include <list>

namespace cc_tools_qt
{

class ToolsFrame
{
public:
using MessageList = std::list<MessagePtr>;

virtual ~ToolsFrame();

MessageList readData(const DataInfo& dataInfo, bool final);

protected:
ToolsFrame() = default;

virtual MessageList readDataImpl(const DataInfo& dataInfo, bool final) = 0;
};

} // namespace cc_tools_qt


Loading

0 comments on commit 9d42c96

Please sign in to comment.