Class Message

Inheritance Relationships

Derived Type

Class Documentation

class Message

Base class for any message exchanged between the driver and the actuator.

Subclassed by myactuator_rmd::SingleMotorMessage< C >

Public Functions

constexpr std::array<std::uint8_t, 8> const &getData() const noexcept

Getter for data to e transmitted to CAN node.

Parameters:

data[in] The data to be transmitted to the CAN node

Protected Functions

constexpr Message(std::array<std::uint8_t, 8> const &data = {}) noexcept
Message(Message const&) = default
Message &operator=(Message const&) = default
Message(Message&&) = default
Message &operator=(Message&&) = default
template<typename T, typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
void setAt(T const val, std::size_t const i)

Sets the given value to the data values located at [i, i + sizeof(T)[ by reinterpret-casting.

Template Parameters:

T – Signed or unsigned integer type

Parameters:
  • val[in] The value that the data array at position i should be set to

  • i[in] The first index of the underlying data array that the value should be set to

template<typename T, typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
T getAs(std::size_t const i) const

Convert elements of the array to a larger integer value by reinterpret-casting the underlying data.

Template Parameters:

T – Signed or unsigned integer type

Parameters:

i[in] The first index of the underlying data array that the value should be extracted from

Returns:

The data values located at [i, i + sizeof(T)[ as an integer of type T

Protected Attributes

std::array<std::uint8_t, 8> data_