From 79f917b961b0ae19c3290a09954e302365d68d1d Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 24 Jan 2025 08:42:37 +1000 Subject: [PATCH] Added mention of the ".x_body" code injection fiels in the tutorial14. --- tutorials/tutorial14/README.md | 16 ++ tutorials/tutorial14/dsl/schema.xml | 8 +- .../include/tutorial14/message/Msg3.h.inc | 1 + .../tutorial14/message/Msg3.h.length_body | 2 + .../tutorial14/message/Msg3.h.read_body | 2 + .../tutorial14/message/Msg3.h.refresh_body | 2 + .../tutorial14/message/Msg3.h.valid_body | 2 + .../tutorial14/message/Msg3.h.write_body | 2 + .../tutorial14/include/tutorial14/MsgId.h | 5 +- .../dispatch/DispatchClientInputMessage.h | 5 + .../tutorial14/dispatch/DispatchMessage.h | 5 + .../dispatch/DispatchServerInputMessage.h | 5 + .../factory/AllMessagesDynMemMsgFactory.h | 2 + .../ClientInputMessagesDynMemMsgFactory.h | 2 + .../ServerInputMessagesDynMemMsgFactory.h | 2 + .../include/tutorial14/field/MsgId.h | 4 +- .../include/tutorial14/field/MsgIdCommon.h | 3 +- .../include/tutorial14/input/AllMessages.h | 7 +- .../tutorial14/input/ClientInputMessages.h | 7 +- .../tutorial14/input/ServerInputMessages.h | 7 +- .../include/tutorial14/message/Msg3.h | 163 ++++++++++++++++++ .../include/tutorial14/message/Msg3Common.h | 57 ++++++ 22 files changed, 297 insertions(+), 12 deletions(-) create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.inc create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.length_body create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.read_body create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.refresh_body create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.valid_body create mode 100644 tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.write_body create mode 100644 tutorials/tutorial14/include/tutorial14/message/Msg3.h create mode 100644 tutorials/tutorial14/include/tutorial14/message/Msg3Common.h diff --git a/tutorials/tutorial14/README.md b/tutorials/tutorial14/README.md index e4f10a537..ee3cd6bce 100644 --- a/tutorials/tutorial14/README.md +++ b/tutorials/tutorial14/README.md @@ -256,6 +256,22 @@ The `Msg1` definition of the schema uses these properties: ... ``` + +To avoid an explicit implementation of the function signature the **v7.0** of the [commsdsl2comms](https://github.com/commschamp/commsdsl) +allows usage of the **<class>.h.<op>_body** files (instead of **<class>.h.<op>** ones) contents +of which is expected to be only a body of the function without the signature. + +- **.read_body** - Overwrites default read function body. +- **.write_body** - Overwrites default write function body. +- **.length_body** - Overwrites default serialization length function body. +- **.valid_body** - Overwrites default validity check function body. +- **.refresh_body** - Overwrites default refresh function body. +- **.name_body** - Overwrites default name retrieval function body. + +There are multiple **Msg3.h.X_body** files inside [dsl_src/include/tutorial14/message](dsl_src/include/tutorial14/message) folder that +demonstrate usage of the suffixes above and the injected code finds its way to +[include/tutorial14/message/Msg3.h](include/tutorial14/message/Msg3.h). + ---- ## Summary diff --git a/tutorials/tutorial14/dsl/schema.xml b/tutorials/tutorial14/dsl/schema.xml index 51d4aea50..a68dbe1c7 100644 --- a/tutorials/tutorial14/dsl/schema.xml +++ b/tutorials/tutorial14/dsl/schema.xml @@ -3,10 +3,12 @@ + + @@ -45,6 +47,10 @@ - + + + + + diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.inc b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.inc new file mode 100644 index 000000000..604782e4d --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.inc @@ -0,0 +1 @@ +#include diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.length_body b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.length_body new file mode 100644 index 000000000..db2a158c5 --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.length_body @@ -0,0 +1,2 @@ +std::cout << "Call of custom " << __FUNCTION__ << std::endl; +return Base::doLength(); diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.read_body b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.read_body new file mode 100644 index 000000000..c9e44b50e --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.read_body @@ -0,0 +1,2 @@ +std::cout << "Call of custom " << __FUNCTION__ << std::endl; +return Base::doRead(iter, len); diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.refresh_body b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.refresh_body new file mode 100644 index 000000000..6f6caff27 --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.refresh_body @@ -0,0 +1,2 @@ +std::cout << "Call of custom " << __FUNCTION__ << std::endl; +return Base::doRefresh(); diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.valid_body b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.valid_body new file mode 100644 index 000000000..ba6f69ae7 --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.valid_body @@ -0,0 +1,2 @@ +std::cout << "Call of custom " << __FUNCTION__ << std::endl; +return Base::doValid(); \ No newline at end of file diff --git a/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.write_body b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.write_body new file mode 100644 index 000000000..fd55e5839 --- /dev/null +++ b/tutorials/tutorial14/dsl_src/include/tutorial14/message/Msg3.h.write_body @@ -0,0 +1,2 @@ +std::cout << "Call of custom " << __FUNCTION__ << std::endl; +return Base::doWrite(iter, len); \ No newline at end of file diff --git a/tutorials/tutorial14/include/tutorial14/MsgId.h b/tutorials/tutorial14/include/tutorial14/MsgId.h index 57c4bf4c3..f185f4ecc 100644 --- a/tutorials/tutorial14/include/tutorial14/MsgId.h +++ b/tutorials/tutorial14/include/tutorial14/MsgId.h @@ -15,11 +15,12 @@ enum MsgId : std::uint8_t { MsgId_M1 = 1, ///< message id of Message 1 message. MsgId_M2 = 2, ///< message id of Message 2 message. + MsgId_M3 = 3, ///< message id of Message 3 message. // --- Extra values generated for convenience --- MsgId_FirstValue = 1, ///< First defined value. - MsgId_LastValue = 2, ///< Last defined value. - MsgId_ValuesLimit = 3, ///< Upper limit for defined values. + MsgId_LastValue = 3, ///< Last defined value. + MsgId_ValuesLimit = 4, ///< Upper limit for defined values. }; } // namespace tutorial14 diff --git a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchClientInputMessage.h b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchClientInputMessage.h index 8dfe6cdfa..66afcb8a9 100644 --- a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchClientInputMessage.h +++ b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchClientInputMessage.h @@ -57,6 +57,11 @@ auto dispatchClientInputMessage( using MsgType = tutorial14::message::Msg2; return handler.handle(static_cast(msg)); } + case tutorial14::MsgId_M3: + { + using MsgType = tutorial14::message::Msg3; + return handler.handle(static_cast(msg)); + } default: break; }; diff --git a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchMessage.h b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchMessage.h index 45c5c3eab..88a1a56b3 100644 --- a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchMessage.h +++ b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchMessage.h @@ -57,6 +57,11 @@ auto dispatchMessage( using MsgType = tutorial14::message::Msg2; return handler.handle(static_cast(msg)); } + case tutorial14::MsgId_M3: + { + using MsgType = tutorial14::message::Msg3; + return handler.handle(static_cast(msg)); + } default: break; }; diff --git a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchServerInputMessage.h b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchServerInputMessage.h index 23878d4ec..de2fa36bc 100644 --- a/tutorials/tutorial14/include/tutorial14/dispatch/DispatchServerInputMessage.h +++ b/tutorials/tutorial14/include/tutorial14/dispatch/DispatchServerInputMessage.h @@ -57,6 +57,11 @@ auto dispatchServerInputMessage( using MsgType = tutorial14::message::Msg2; return handler.handle(static_cast(msg)); } + case tutorial14::MsgId_M3: + { + using MsgType = tutorial14::message::Msg3; + return handler.handle(static_cast(msg)); + } default: break; }; diff --git a/tutorials/tutorial14/include/tutorial14/factory/AllMessagesDynMemMsgFactory.h b/tutorials/tutorial14/include/tutorial14/factory/AllMessagesDynMemMsgFactory.h index 2f2b8ab96..a1bafd871 100644 --- a/tutorials/tutorial14/include/tutorial14/factory/AllMessagesDynMemMsgFactory.h +++ b/tutorials/tutorial14/include/tutorial14/factory/AllMessagesDynMemMsgFactory.h @@ -66,6 +66,7 @@ class AllMessagesDynMemMsgFactory switch (id) { case tutorial14::MsgId_M1: return MsgPtr(new tutorial14::message::Msg1); case tutorial14::MsgId_M2: return MsgPtr(new tutorial14::message::Msg2); + case tutorial14::MsgId_M3: return MsgPtr(new tutorial14::message::Msg3); default: break; } @@ -96,6 +97,7 @@ class AllMessagesDynMemMsgFactory { case tutorial14::MsgId_M1: return 1U; case tutorial14::MsgId_M2: return 1U; + case tutorial14::MsgId_M3: return 1U; default: break; } diff --git a/tutorials/tutorial14/include/tutorial14/factory/ClientInputMessagesDynMemMsgFactory.h b/tutorials/tutorial14/include/tutorial14/factory/ClientInputMessagesDynMemMsgFactory.h index 49b7c91a5..9cfcdb4b0 100644 --- a/tutorials/tutorial14/include/tutorial14/factory/ClientInputMessagesDynMemMsgFactory.h +++ b/tutorials/tutorial14/include/tutorial14/factory/ClientInputMessagesDynMemMsgFactory.h @@ -66,6 +66,7 @@ class ClientInputMessagesDynMemMsgFactory switch (id) { case tutorial14::MsgId_M1: return MsgPtr(new tutorial14::message::Msg1); case tutorial14::MsgId_M2: return MsgPtr(new tutorial14::message::Msg2); + case tutorial14::MsgId_M3: return MsgPtr(new tutorial14::message::Msg3); default: break; } @@ -96,6 +97,7 @@ class ClientInputMessagesDynMemMsgFactory { case tutorial14::MsgId_M1: return 1U; case tutorial14::MsgId_M2: return 1U; + case tutorial14::MsgId_M3: return 1U; default: break; } diff --git a/tutorials/tutorial14/include/tutorial14/factory/ServerInputMessagesDynMemMsgFactory.h b/tutorials/tutorial14/include/tutorial14/factory/ServerInputMessagesDynMemMsgFactory.h index 1192f6ed3..23d1ee597 100644 --- a/tutorials/tutorial14/include/tutorial14/factory/ServerInputMessagesDynMemMsgFactory.h +++ b/tutorials/tutorial14/include/tutorial14/factory/ServerInputMessagesDynMemMsgFactory.h @@ -66,6 +66,7 @@ class ServerInputMessagesDynMemMsgFactory switch (id) { case tutorial14::MsgId_M1: return MsgPtr(new tutorial14::message::Msg1); case tutorial14::MsgId_M2: return MsgPtr(new tutorial14::message::Msg2); + case tutorial14::MsgId_M3: return MsgPtr(new tutorial14::message::Msg3); default: break; } @@ -96,6 +97,7 @@ class ServerInputMessagesDynMemMsgFactory { case tutorial14::MsgId_M1: return 1U; case tutorial14::MsgId_M2: return 1U; + case tutorial14::MsgId_M3: return 1U; default: break; } diff --git a/tutorials/tutorial14/include/tutorial14/field/MsgId.h b/tutorials/tutorial14/include/tutorial14/field/MsgId.h index af48baca5..564a78ea6 100644 --- a/tutorials/tutorial14/include/tutorial14/field/MsgId.h +++ b/tutorials/tutorial14/include/tutorial14/field/MsgId.h @@ -28,7 +28,7 @@ class MsgId : public tutorial14::field::MsgIdCommon::ValueType, TExtraOpts..., comms::option::def::HasName, - comms::option::def::ValidNumValueRange<1, 2> + comms::option::def::ValidNumValueRange<1, 3> > { using Base = @@ -37,7 +37,7 @@ class MsgId : public tutorial14::field::MsgIdCommon::ValueType, TExtraOpts..., comms::option::def::HasName, - comms::option::def::ValidNumValueRange<1, 2> + comms::option::def::ValidNumValueRange<1, 3> >; public: /// @brief Re-definition of the value type. diff --git a/tutorials/tutorial14/include/tutorial14/field/MsgIdCommon.h b/tutorials/tutorial14/include/tutorial14/field/MsgIdCommon.h index ce96e65bc..0ce94ba6c 100644 --- a/tutorials/tutorial14/include/tutorial14/field/MsgIdCommon.h +++ b/tutorials/tutorial14/include/tutorial14/field/MsgIdCommon.h @@ -56,7 +56,8 @@ struct MsgIdCommon static const char* Map[] = { nullptr, "Message 1", - "Message 2" + "Message 2", + "Message 3" }; static const std::size_t MapSize = std::extent::value; diff --git a/tutorials/tutorial14/include/tutorial14/input/AllMessages.h b/tutorials/tutorial14/include/tutorial14/input/AllMessages.h index 57cc0bb5f..7945e1b98 100644 --- a/tutorials/tutorial14/include/tutorial14/input/AllMessages.h +++ b/tutorials/tutorial14/include/tutorial14/input/AllMessages.h @@ -8,6 +8,7 @@ #include #include "tutorial14/message/Msg1.h" #include "tutorial14/message/Msg2.h" +#include "tutorial14/message/Msg3.h" #include "tutorial14/options/DefaultOptions.h" namespace tutorial14 @@ -23,7 +24,8 @@ template using AllMessages = std::tuple< tutorial14::message::Msg1, - tutorial14::message::Msg2 + tutorial14::message::Msg2, + tutorial14::message::Msg3 >; } // namespace input @@ -37,7 +39,8 @@ using AllMessages = /// @param opts_ Type of the used protocol definition options. #define TUTORIAL14_ALIASES_FOR_ALL_MESSAGES(prefix_, suffix_, interface_, opts_) \ using prefix_ ## Msg1 ## suffix_ = tutorial14::message::Msg1; \ - using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; + using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; \ + using prefix_ ## Msg3 ## suffix_ = tutorial14::message::Msg3; /// @brief Create type aliases for the all messages of the protocol using default options. /// @param prefix_ Prefix of the alias message type. diff --git a/tutorials/tutorial14/include/tutorial14/input/ClientInputMessages.h b/tutorials/tutorial14/include/tutorial14/input/ClientInputMessages.h index 79ed2fcbf..a17a53d70 100644 --- a/tutorials/tutorial14/include/tutorial14/input/ClientInputMessages.h +++ b/tutorials/tutorial14/include/tutorial14/input/ClientInputMessages.h @@ -8,6 +8,7 @@ #include #include "tutorial14/message/Msg1.h" #include "tutorial14/message/Msg2.h" +#include "tutorial14/message/Msg3.h" #include "tutorial14/options/DefaultOptions.h" namespace tutorial14 @@ -23,7 +24,8 @@ template using ClientInputMessages = std::tuple< tutorial14::message::Msg1, - tutorial14::message::Msg2 + tutorial14::message::Msg2, + tutorial14::message::Msg3 >; } // namespace input @@ -37,7 +39,8 @@ using ClientInputMessages = /// @param opts_ Type of the used protocol definition options. #define TUTORIAL14_ALIASES_FOR_CLIENT_INPUT_MESSAGES(prefix_, suffix_, interface_, opts_) \ using prefix_ ## Msg1 ## suffix_ = tutorial14::message::Msg1; \ - using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; + using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; \ + using prefix_ ## Msg3 ## suffix_ = tutorial14::message::Msg3; /// @brief Create type aliases for the client input messages of the protocol using default options. /// @param prefix_ Prefix of the alias message type. diff --git a/tutorials/tutorial14/include/tutorial14/input/ServerInputMessages.h b/tutorials/tutorial14/include/tutorial14/input/ServerInputMessages.h index 2c978e81b..024fe291d 100644 --- a/tutorials/tutorial14/include/tutorial14/input/ServerInputMessages.h +++ b/tutorials/tutorial14/include/tutorial14/input/ServerInputMessages.h @@ -8,6 +8,7 @@ #include #include "tutorial14/message/Msg1.h" #include "tutorial14/message/Msg2.h" +#include "tutorial14/message/Msg3.h" #include "tutorial14/options/DefaultOptions.h" namespace tutorial14 @@ -23,7 +24,8 @@ template using ServerInputMessages = std::tuple< tutorial14::message::Msg1, - tutorial14::message::Msg2 + tutorial14::message::Msg2, + tutorial14::message::Msg3 >; } // namespace input @@ -37,7 +39,8 @@ using ServerInputMessages = /// @param opts_ Type of the used protocol definition options. #define TUTORIAL14_ALIASES_FOR_SERVER_INPUT_MESSAGES(prefix_, suffix_, interface_, opts_) \ using prefix_ ## Msg1 ## suffix_ = tutorial14::message::Msg1; \ - using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; + using prefix_ ## Msg2 ## suffix_ = tutorial14::message::Msg2; \ + using prefix_ ## Msg3 ## suffix_ = tutorial14::message::Msg3; /// @brief Create type aliases for the server input messages of the protocol using default options. /// @param prefix_ Prefix of the alias message type. diff --git a/tutorials/tutorial14/include/tutorial14/message/Msg3.h b/tutorials/tutorial14/include/tutorial14/message/Msg3.h new file mode 100644 index 000000000..c607639c1 --- /dev/null +++ b/tutorials/tutorial14/include/tutorial14/message/Msg3.h @@ -0,0 +1,163 @@ +// Generated by commsdsl2comms v7.0.2 + +/// @file +/// @brief Contains definition of "Message 3" message and its fields. + +#pragma once + +#include +#include +#include "comms/MessageBase.h" +#include "comms/field/IntValue.h" +#include "comms/options.h" +#include "tutorial14/MsgId.h" +#include "tutorial14/field/FieldBase.h" +#include "tutorial14/message/Msg3Common.h" +#include "tutorial14/options/DefaultOptions.h" + +#include + +namespace tutorial14 +{ + +namespace message +{ + +/// @brief Fields of @ref Msg3. +/// @tparam TOpt Extra options +/// @see @ref Msg3 +/// @headerfile tutorial14/message/Msg3.h +template +struct Msg3Fields +{ + /// @brief Definition of "F1" field. + class F1 : public + comms::field::IntValue< + tutorial14::field::FieldBase<>, + std::uint32_t, + comms::option::def::HasName + > + { + using Base = + comms::field::IntValue< + tutorial14::field::FieldBase<>, + std::uint32_t, + comms::option::def::HasName + >; + public: + /// @brief Re-definition of the value type. + using ValueType = typename Base::ValueType; + + /// @brief Compile time detection of special values presence. + static constexpr bool hasSpecials() + { + return tutorial14::message::Msg3FieldsCommon::F1Common::hasSpecials(); + } + + /// @brief Name of the field. + static const char* name() + { + return tutorial14::message::Msg3FieldsCommon::F1Common::name(); + } + }; + + /// @brief All the fields bundled in std::tuple. + using All = std::tuple< + F1 + >; +}; + +/// @brief Definition of "Message 3" message class. +/// @details +/// See @ref Msg3Fields for definition of the fields this message contains. +/// @tparam TMsgBase Base (interface) class. +/// @tparam TOpt Extra options +/// @headerfile tutorial14/message/Msg3.h +template +class Msg3 : public + comms::MessageBase< + TMsgBase, + comms::option::def::StaticNumIdImpl, + comms::option::def::FieldsImpl::All>, + comms::option::def::MsgType >, + comms::option::def::HasName, + comms::option::def::HasCustomRefresh + > +{ + // Redefinition of the base class type + using Base = + comms::MessageBase< + TMsgBase, + comms::option::def::StaticNumIdImpl, + comms::option::def::FieldsImpl::All>, + comms::option::def::MsgType >, + comms::option::def::HasName, + comms::option::def::HasCustomRefresh + >; + +public: + /// @brief Provide names and allow access to internal fields. + /// @details See definition of @b COMMS_MSG_FIELDS_NAMES macro + /// related to @b comms::MessageBase class from COMMS library + /// for details. + /// + /// The generated values, types and functions are: + /// @li @b FieldIdx_f1 index, @b Field_f1 type and @b field_f1() access fuction + /// for @ref Msg3Fields::F1 field. + COMMS_MSG_FIELDS_NAMES( + f1 + ); + + // Compile time check for serialisation length. + static const std::size_t MsgMinLen = Base::doMinLength(); + static const std::size_t MsgMaxLen = Base::doMaxLength(); + static_assert(MsgMinLen == 4U, "Unexpected min serialisation length"); + static_assert(MsgMaxLen == 4U, "Unexpected max serialisation length"); + + /// @brief Name of the message. + static const char* doName() + { + return tutorial14::message::Msg3Common::name(); + } + + /// @brief Custom read functionality + template + comms::ErrorStatus doRead(TIter& iter, std::size_t len) + { + std::cout << "Call of custom " << __FUNCTION__ << std::endl; + return Base::doRead(iter, len); + } + + /// @brief Custom write functionality + template + comms::ErrorStatus doWrite(TIter& iter, std::size_t len) const + { + std::cout << "Call of custom " << __FUNCTION__ << std::endl; + return Base::doWrite(iter, len); + } + + /// @brief Custom length calculation functionality + std::size_t doLength() const + { + std::cout << "Call of custom " << __FUNCTION__ << std::endl; + return Base::doLength(); + } + + /// @brief Custom validity check functionality + bool doValid() const + { + std::cout << "Call of custom " << __FUNCTION__ << std::endl; + return Base::doValid(); + } + + /// @brief Custom refresh functionality + bool doRefresh() + { + std::cout << "Call of custom " << __FUNCTION__ << std::endl; + return Base::doRefresh(); + } +}; + +} // namespace message + +} // namespace tutorial14 diff --git a/tutorials/tutorial14/include/tutorial14/message/Msg3Common.h b/tutorials/tutorial14/include/tutorial14/message/Msg3Common.h new file mode 100644 index 000000000..44d7fe249 --- /dev/null +++ b/tutorials/tutorial14/include/tutorial14/message/Msg3Common.h @@ -0,0 +1,57 @@ +// Generated by commsdsl2comms v7.0.2 + +/// @file +/// @brief Contains common template parameters independent functionality of +/// @ref tutorial14::message::Msg3 message and its fields. + +#pragma once + +#include + +namespace tutorial14 +{ + +namespace message +{ + +/// @brief Common types and functions for fields of +/// @ref tutorial14::message::Msg3 message. +/// @see tutorial14::message::Msg3Fields +struct Msg3FieldsCommon +{ + /// @brief Common types and functions for + /// @ref tutorial14::message::Msg3Fields::F1 field. + struct F1Common + { + /// @brief Re-definition of the value type used by + /// tutorial14::message::Msg3Fields::F1 field. + using ValueType = std::uint32_t; + + /// @brief Name of the @ref tutorial14::message::Msg3Fields::F1 field. + static const char* name() + { + return "F1"; + } + + /// @brief Compile time detection of special values presence. + static constexpr bool hasSpecials() + { + return false; + } + }; +}; + +/// @brief Common types and functions of +/// @ref tutorial14::message::Msg3 message. +struct Msg3Common +{ + /// @brief Name of the @ref tutorial14::message::Msg3 message. + static const char* name() + { + return "Message 3"; + } +}; + +} // namespace message + +} // namespace tutorial14