Skip to content

Commit 3316a4c

Browse files
committed
Updates to doxygen documentation.
1 parent 7c2fb1f commit 3316a4c

File tree

17 files changed

+101
-32
lines changed

17 files changed

+101
-32
lines changed

comms/doc/page_define_prot.dox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@
11901190
/// @li @ref comms::option::app::NoWriteImpl
11911191
/// @li @ref comms::option::app::NoValidImpl
11921192
/// @li @ref comms::option::app::NoLengthImpl
1193+
/// @li @ref comms::option::app::NoDispatchImpl
11931194
///
11941195
/// These options should not be used in the definition of protocol messages, but
11951196
/// it would be wise to allow the client application use them when necessary. It

comms/doc/page_field.dox

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,30 @@
23872387
/// defined field's base classes, which is implementation dependent. Just use
23882388
/// the provided @b value() member function to access the value.
23892389
///
2390+
/// @subsection sec_field_tutorial_common_options_write Custom Write Functionality
2391+
/// On some very rare occasions there may be a need to write custom @b write
2392+
/// functionality. It can be achieved by writing custom @b write() member function
2393+
/// @code
2394+
/// using MyFieldBase = comms::Field<comms::option::def::BigEndian>;
2395+
/// struct MyBundle : public
2396+
/// comms::field::Bundle<
2397+
/// MyFieldBase,
2398+
/// std::tuple<...>,
2399+
/// comms::option::def::HasCustomWrite
2400+
/// >
2401+
/// {
2402+
/// template <typename TIter>
2403+
/// comms::ErrorStatus write(TIter& iter, std::size_t len) const
2404+
/// {
2405+
/// ...
2406+
/// }
2407+
/// };
2408+
/// @endcode
2409+
/// @b NOTE usage of @ref comms::option::def::HasCustomWrite option. It is
2410+
/// required to let prevent field holding @ref comms::MessageBase
2411+
/// class from attempting to optimize write operation due to possible incorrect
2412+
/// behavior.
2413+
///
23902414
/// @subsection sec_field_tutorial_common_options_version Custom Version Update Functionality
23912415
/// Some protocols may include version information either in the transport framing
23922416
/// of every message or in one of the messages used to establish connection. Such

comms/doc/page_use_prot.dox

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/// @li @b "comms/" - replace with "comms2/"
2626
///
2727
/// @section page_use_prot_error_handling Error Handling
28-
/// The COMMS library is intended to be used in embedded systems (including
28+
/// The @b COMMS library is intended to be used in embedded systems (including
2929
/// bare metal), which means the library does not use exceptions to report errors.
3030
/// The runtime errors are reported via @ref comms::ErrorStatus return values. All
3131
/// pre- and post-conditions are checked using COMMS_ASSERT() macro.
@@ -220,7 +220,7 @@
220220
/// std::size_t readMessage(MyMessage& msg, const std::uint8_t* buf, std::size_t len)
221221
/// {
222222
/// MyMessage::ReadIterator readIter = buf;
223-
/// auto es = msg->read(readIter, len); // readIter is advanced in the read operation
223+
/// auto es = msg.read(readIter, len); // readIter is advanced in the read operation
224224
/// if (es != comms::ErrorStatus::Success) {
225225
/// ... // Report and handle error
226226
/// return 0U;
@@ -279,9 +279,13 @@
279279
/// iterator for write operation. In the example above the output buffer
280280
/// is chosen to be @b std::vector<std::uint8_t> and the write operation will
281281
/// be performed using @b push_back() calls on this vector (due to @b std::back_insert_iterator
282-
/// being chosen as @b WriteIterator). @n
282+
/// being chosen as @b WriteIterator).
283+
///
283284
/// Also @b note, that iterator is passed by reference, which allows advancing
284-
/// operator when write operation is performed.
285+
/// operator when write operation is performed. In case the iterator is
286+
/// random-access one, the difference between the initial and its value
287+
/// after the write has been performed can be used to determine amount of
288+
/// bytes that have been written to the buffer.
285289
///
286290
/// The @ref comms::Message interface class defines @ref comms::Message::hasWrite()
287291
/// static constexpr member function, which may be used at compile time to
@@ -292,7 +296,7 @@
292296
/// @subsection page_use_prot_interface_length Polymorphic Serialisation Length Retrieval
293297
/// Sometimes it may be needed to polymorphically retrieve the serialisation length of the message
294298
/// in order to be able to reserve or allocate enough space for output buffer.
295-
/// The COMMS library provides @ref comms::option::app::LengthInfoInterface option that
299+
/// The @b COMMS library provides @ref comms::option::app::LengthInfoInterface option that
296300
/// adds @b length() member function to the interface.
297301
/// @code
298302
/// using MyMessage =
@@ -314,7 +318,7 @@
314318
/// }
315319
///
316320
/// protected:
317-
/// virtual std::size_t lengthImpl() const = 0; // Implemented in the derived class
321+
/// virtual std::size_t lengthImpl() const {...}; // Must be overridden in the derived class
318322
/// };
319323
/// @endcode
320324
/// The @ref comms::Message interface class defines @ref comms::Message::hasLength()
@@ -325,7 +329,7 @@
325329
///
326330
/// @subsection page_use_prot_interface_valid Polymorphic Validity Check
327331
/// Sometimes it may be needed to be able to check whether the message contents
328-
/// (fields) have valid values. The COMMS library provides comms::option::app::ValidCheckInterface
332+
/// (fields) have valid values. The @b COMMS library provides comms::option::app::ValidCheckInterface
329333
/// option that adds @b valid() member function to the interface:
330334
/// @code
331335
/// using MyMessage =
@@ -405,7 +409,7 @@
405409
/// }
406410
///
407411
/// protected:
408-
/// virtual DispatchRetType dispatchImpl(Handler& handler) = 0; // Must be implemented in the derived class
412+
/// virtual DispatchRetType dispatchImpl(Handler& handler) {...} // Must be overridden in the derived class
409413
/// };
410414
/// @endcode
411415
/// More details about polymorphic dispatching and handling will be provided
@@ -425,7 +429,7 @@
425429
/// After updating such fields directly, using the interface of the message object,
426430
/// the message contents may end up being in an inconsistent (or invalid) state.
427431
/// There may be a need to polymorphically normalise the state of the message object. The
428-
/// COMMS library provides @ref comms::option::app::RefreshInterface option, that adds
432+
/// @b COMMS library provides @ref comms::option::app::RefreshInterface option, that adds
429433
/// @b refresh() member function to the message interface.
430434
/// @code
431435
/// using MyMessage =
@@ -453,7 +457,7 @@
453457
/// }
454458
/// };
455459
/// @endcode
456-
/// Note, that the @b refresh() member function returns boolean value, which
460+
/// Note, that the @ref comms::Message::refresh() "refresh()" member function returns boolean value, which
457461
/// is expected to be @b true in case at least one of the internal fields has
458462
/// been updated, and @b false if message state remains unchanged. @n
459463
/// Also note, that interface provide default implementation of @b refreshImpl()
@@ -491,7 +495,7 @@
491495
/// }
492496
///
493497
/// protected:
494-
/// virtual const char* nameImpl() const = 0;
498+
/// virtual const char* nameImpl() const = 0; // Must be overridden in the derived class
495499
/// };
496500
/// @endcode
497501
/// The @ref comms::Message interface class defines @ref comms::Message::hasName()
@@ -562,6 +566,11 @@
562566
/// comms::option::app::NameInterface // Add an ability to retrieve message name
563567
/// >;
564568
/// @endcode
569+
/// In case no polymorphic interface extension option has been chosen, every
570+
/// message object becomes a simple "data structure" without any v-table "penalty".
571+
/// @code
572+
/// using MyInterface = my_protocol::Message<>;
573+
/// @endcode
565574
///
566575
/// @section page_use_prot_messages Protocol Messages
567576
/// The protocol messages are expected to be defined as template classes, receiving
@@ -591,7 +600,7 @@
591600
/// The interface class that was defined for the application (@b MyMessage) needs
592601
/// to be passed as @b TBase template parameter. The defined message class
593602
/// extends @ref comms::MessageBase, which in turn extends provided interface
594-
/// class @b TBase, which in turn extends @ref comms::Message. The inheritence
603+
/// class @b TBase, which in turn extends (or typedef-s) @ref comms::Message. The inheritance
595604
/// hierarchy may look like this:
596605
/// @diafile message_class_hierarchy.dia
597606
///
@@ -1233,7 +1242,7 @@
12331242
/// calculating length, checking field's contents validity, and bringing field's
12341243
/// value into a consistent state. It may be required
12351244
/// when a message contains sequence (see @ref page_use_prot_fields_array_list)
1236-
/// of such bundles/structs. The COMMS library provides @ref comms::field::Bundle
1245+
/// of such bundles/structs. The @b COMMS library provides @ref comms::field::Bundle
12371246
/// field for this purpose. It is quite similar to @ref comms::field::Bitfield described
12381247
/// earlier. The difference is that every member field
12391248
/// doesn't specify any length in bits, just bytes. For example:
@@ -1307,7 +1316,7 @@
13071316
/// @subsection page_use_prot_fields_array_list Array List Fields
13081317
/// Some communication protocols may define messages that transmit sequence
13091318
/// of similar fields and/or raw data buffers. To make it easier to handle, the
1310-
/// COMMS library provides comms::field::ArrayList field which provide a required
1319+
/// @b COMMS library provides comms::field::ArrayList field which provide a required
13111320
/// interface to properly handle such sequences of data. It supports a
13121321
/// sequence of raw bytes
13131322
/// @code
@@ -1356,7 +1365,7 @@
13561365
/// >;
13571366
/// @endcode
13581367
/// Usage of this option just ensures right amount of elements "on the wire" after
1359-
/// the field is serialised, but it doesn't automatically resize inner
1368+
/// the field is serialised, but it does @b NOT automatically resize inner
13601369
/// storage vector.
13611370
/// @code
13621371
/// MyList field;
@@ -1384,7 +1393,7 @@
13841393
///
13851394
/// Also similar to @ref page_use_prot_fields_array_list, fixed length strings
13861395
/// are defined using @ref comms::option::def::SequenceFixedSize option, and just
1387-
/// like with lists it doesn't automatically resize inner string, just ensures
1396+
/// like with lists it does @b NOT automatically resize inner string, just ensures
13881397
/// right amount of characters "on the wire" when field is serialised.
13891398
/// @code
13901399
/// using MyFixedString =
@@ -1411,7 +1420,7 @@
14111420
/// based on information recorded in other fields. For example there is a
14121421
/// "flags" bitmask field which specifies whether the following field exists or
14131422
/// missing. The optional field may also be tentative, i.e. if there is enough
1414-
/// data in the input buffer it exists, and missing otherwise. The COMMS
1423+
/// data in the input buffer it exists, and missing otherwise. The @b COMMS
14151424
/// library provides @ref comms::field::Optional which is a mere wrapper around
14161425
/// other fields and provides an ability to set the optional state of the field.
14171426
/// @code
@@ -1420,7 +1429,9 @@
14201429
/// comms::field::IntValue<MyFieldBase, std::int32_t>
14211430
/// >;
14221431
/// @endcode
1423-
/// The default mode of such field is "tentative".
1432+
/// The default mode of such field is "tentative", which means read if there
1433+
/// is data available in the input buffer, and write if there is enough space
1434+
/// in the output buffer.
14241435
/// @code
14251436
/// OptField field;
14261437
/// assert(field.isTentative());
@@ -2757,7 +2768,7 @@
27572768
/// @endcode
27582769
///
27592770
/// @subsection page_use_prot_handling_generic Generic Handler
2760-
/// The COMMS library provides some help in defining custom message handlers.
2771+
/// The @b COMMS library provides some help in defining custom message handlers.
27612772
/// There is @ref comms::GenericHandler class that receives at least two template
27622773
/// parameters. The first one is a common interface class for all the handled messages
27632774
/// (@b MyMessage). The second template parameter is
@@ -3021,8 +3032,8 @@
30213032
/// using VersionType = ...; // Equals to ValueType of the relevant field.
30223033
///
30233034
/// // Accessors for the version info
3024-
/// VersionType version();
3025-
/// const VersionType& version();
3035+
/// VersionType& version();
3036+
/// const VersionType& version() const;
30263037
/// };
30273038
///
30283039
/// } // namespace my_protocol
@@ -3145,6 +3156,7 @@
31453156
/// @li @ref comms::option::app::NoWriteImpl
31463157
/// @li @ref comms::option::app::NoValidImpl
31473158
/// @li @ref comms::option::app::NoLengthImpl
3159+
/// @li @ref comms::option::app::NoDispatchImpl
31483160
///
31493161
/// In order to be able to pass these extra options to message definition classes,
31503162
/// the support from the latter is required. If the protocol definition

comms/include/comms/Message.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,18 +395,21 @@ class Message : public details::MessageInterfaceBuilderT<TOptions...>
395395
/// @details Called by valid(), must be implemented in the derived class.
396396
/// The function exists only if @ref comms::option::app::ValidCheckInterface option
397397
/// was provided to comms::Message.
398-
/// @return true for valid contents, false otherwise.
398+
/// @return true for valid contents, false otherwise. If not overridden
399+
/// always returns @b true.
399400
/// @see @ref hasValid()
400-
virtual bool validImpl() const = 0;
401+
virtual bool validImpl() const;
401402

402-
/// @brief Pure virtual function used to retrieve number of bytes required
403+
/// @brief Virtual function used to retrieve number of bytes required
403404
/// to serialise this message.
404405
/// @details Called by length(), must be implemented in the derived class.
405406
/// The function exists only if @ref comms::option::app::LengthInfoInterface option
406407
/// was provided to comms::Message.
407-
/// @return Number of bytes required to serialise this message.
408+
/// @return Number of bytes required to serialise this message. If
409+
/// not overriden unconditionally fails on assert in DEBUG build
410+
/// and returns @b 0 in RELEASE.
408411
/// @see @ref hasLength()
409-
virtual std::size_t lengthImpl() const = 0;
412+
virtual std::size_t lengthImpl() const;
410413

411414
/// @brief Virtual function used to bring contents of the message
412415
/// into a consistent state.
@@ -419,13 +422,15 @@ class Message : public details::MessageInterfaceBuilderT<TOptions...>
419422
/// all the fields of the message remained unchanged.
420423
virtual bool refreshImpl();
421424

422-
/// @brief Pure virtual function used to dispatch message to the handler
425+
/// @brief Virtual function used to dispatch message to the handler
423426
/// object for processing.
424427
/// @details Called by dispatch(), must be implemented in the derived class.
425428
/// The function exists only if @ref comms::option::app::Handler option was
426-
/// provided to comms::Message to specify type of the handler.
429+
/// provided to comms::Message to specify type of the handler. If not
430+
/// overridden unconditionally fails on assert in DEBUG build and
431+
/// does nothing in RELEASE.
427432
/// @param handler Handler object to dispatch message to.
428-
virtual DispatchRetType dispatchImpl(Handler& handler) = 0;
433+
virtual DispatchRetType dispatchImpl(Handler& handler);
429434

430435
/// @brief Pure virtual function used to retrieve actual message name.
431436
/// @details Called by @ref name(), must be implemented in the derived class.

comms/include/comms/field/ArrayList.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
/// @file
19+
/// @brief Contains definition of @ref comms::field::ArrayList
1820

1921
#pragma once
2022

comms/include/comms/field/Bitfield.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
/// @file
19+
/// @brief Contains definition of @ref comms::field::Bitfield
1820

1921
#pragma once
2022

comms/include/comms/field/BitmaskValue.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
/// @file
19+
/// @brief Contains definition of @ref comms::field::BitmaskValue
20+
1821
#pragma once
1922

2023
#include <limits>
@@ -522,6 +525,7 @@ toFieldBase(const BitmaskValue<TFieldBase, TOptions...>& field)
522525
/// }
523526
/// @endcode
524527
/// @related comms::field::BitmaskValue
528+
/// @note Defined in "comms/field/BitmaskValue.h"
525529
#define COMMS_BITMASK_BITS(...) COMMS_DEFINE_ENUM(BitIdx, __VA_ARGS__)
526530

527531
/// @brief Generate access functions for bits in comms::field::BitmaskValue field.
@@ -615,6 +619,7 @@ toFieldBase(const BitmaskValue<TFieldBase, TOptions...>& field)
615619
/// COMMS_BITMASK_BITS_ACCESS(first, third, fourth);
616620
/// }
617621
/// @endcode
622+
/// @note Defined in "comms/field/BitmaskValue.h"
618623
#define COMMS_BITMASK_BITS_ACCESS(...) \
619624
COMMS_AS_BITMASK_FUNC { \
620625
return comms::field::toFieldBase(*this); \
@@ -706,6 +711,7 @@ toFieldBase(const BitmaskValue<TFieldBase, TOptions...>& field)
706711
/// COMMS_BITMASK_BITS_SEQ(first, second, third, fourth);
707712
/// }
708713
/// @endcode
714+
/// @note Defined in "comms/field/BitmaskValue.h"
709715
#define COMMS_BITMASK_BITS_SEQ(...) \
710716
COMMS_BITMASK_BITS(__VA_ARGS__) \
711717
COMMS_BITMASK_BITS_ACCESS(__VA_ARGS__)
@@ -720,6 +726,7 @@ toFieldBase(const BitmaskValue<TFieldBase, TOptions...>& field)
720726
/// template one, please use @ref COMMS_BITMASK_BITS_SEQ_NOTEMPLATE()
721727
/// instead.
722728
/// @related comms::field::BitmaskValue
729+
/// @note Defined in "comms/field/BitmaskValue.h"
723730
#define COMMS_BITMASK_BITS_SEQ_NOTEMPLATE(...) \
724731
COMMS_BITMASK_BITS(__VA_ARGS__) \
725732
COMMS_BITMASK_BITS_ACCESS_NOTEMPLATE(__VA_ARGS__)

comms/include/comms/field/Bundle.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
/// @file
19+
/// @brief Contains definition of @ref comms::field::Bundle
1820

1921
#pragma once
2022

comms/include/comms/field/EnumValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
/// @file
19-
/// Contains definition of comms::field::EnumValue
19+
/// @brief Contains definition of comms::field::EnumValue
2020

2121
#pragma once
2222

comms/include/comms/field/FloatValue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
/// @file
19+
/// @brief Contains definition of @ref comms::field::FloatValue
1820

1921
#pragma once
2022

0 commit comments

Comments
 (0)