AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | List of all members
isobus::CANMessageDataView Class Reference

A class that represents data of a CAN message by holding a view of an array of bytes. The view is not owned by this class, it is simply holding a pointer to the array of bytes. More...

#include <can_message_data.hpp>

Inheritance diagram for isobus::CANMessageDataView:
[legend]
Collaboration diagram for isobus::CANMessageDataView:
[legend]

Public Member Functions

 CANMessageDataView (const std::uint8_t *ptr, std::size_t len)
 Construct a new CANMessageDataView object.
 
std::size_t size () const override
 Get the size of the data.
 
std::uint8_t get_byte (std::size_t index) override
 Get the byte at the given index.
 
CANDataSpan data () const
 Get the data span.
 
std::unique_ptr< CANMessageDatacopy_if_not_owned (std::unique_ptr< CANMessageData > self) const override
 If the data isn't owned by this class, make a copy of the data.
 
- Public Member Functions inherited from isobus::CANMessageData
virtual ~CANMessageData ()=default
 Default destructor.
 

Detailed Description

A class that represents data of a CAN message by holding a view of an array of bytes. The view is not owned by this class, it is simply holding a pointer to the array of bytes.

Definition at line 90 of file can_message_data.hpp.

Constructor & Destructor Documentation

◆ CANMessageDataView()

isobus::CANMessageDataView::CANMessageDataView ( const std::uint8_t * ptr,
std::size_t len )

Construct a new CANMessageDataView object.

Parameters
[in]ptrThe pointer to the array of bytes.
[in]lenThe length of the array of bytes.

Definition at line 57 of file can_message_data.cpp.

Member Function Documentation

◆ copy_if_not_owned()

std::unique_ptr< CANMessageData > isobus::CANMessageDataView::copy_if_not_owned ( std::unique_ptr< CANMessageData > self) const
overridevirtual

If the data isn't owned by this class, make a copy of the data.

Parameters
[in]selfA pointer to this object.
Returns
A copy of the data if it isn't owned by this class, otherwise it returns itself.

Implements isobus::CANMessageData.

Definition at line 77 of file can_message_data.cpp.

◆ data()

CANDataSpan isobus::CANMessageDataView::data ( ) const

Get the data span.

Returns
The data span.

Definition at line 72 of file can_message_data.cpp.

◆ get_byte()

std::uint8_t isobus::CANMessageDataView::get_byte ( std::size_t index)
overridevirtual

Get the byte at the given index.

Parameters
[in]indexThe index of the byte to get.
Returns
The byte at the given index.

Implements isobus::CANMessageData.

Definition at line 67 of file can_message_data.cpp.

◆ size()

std::size_t isobus::CANMessageDataView::size ( ) const
overridevirtual

Get the size of the data.

Returns
The size of the data.

Implements isobus::CANMessageData.

Definition at line 62 of file can_message_data.cpp.


The documentation for this class was generated from the following files: