23 vector::assign(
data.begin(),
data.end());
33 return vector::size();
38 return vector::at(index);
43 vector::at(index) = value;
64 return DataSpan::size();
69 return DataSpan::operator[](index);
74 return CANDataSpan(DataSpan::begin(), DataSpan::size());
80 return std::unique_ptr<CANMessageData>(
new CANMessageDataVector(DataSpan::begin(), DataSpan::size()));
86 std::size_t chunkSize) :
89 parentPointer(parentPointer),
An interface class that represents data payload of a CAN message of arbitrary length.
std::size_t dataOffset
The offset of the data in the buffer.
bool initialized
Whether the buffer has been initialized.
std::size_t bufferSize
The size of the buffer.
std::size_t size() const override
Get the size of the data.
CANMessageDataCallback(std::size_t size, DataChunkCallback callback, void *parentPointer=nullptr, std::size_t chunkSize=7)
Constructor for transport data that uses a callback function.
std::uint8_t get_byte(std::size_t index) override
Get the byte at the given index.
std::vector< std::uint8_t > buffer
The buffer to store the data chunks.
DataChunkCallback callback
The callback function to be called for each data chunk.
std::size_t totalSize
The total size of the data.
void * parentPointer
The parent object that gets passed to the callback function.
std::unique_ptr< CANMessageData > copy_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.
A class that represents data of a CAN message by holding a vector of bytes.
CANMessageDataVector(std::size_t size)
Construct a new CANMessageDataVector object.
std::size_t size() const override
Get the size of the data.
std::unique_ptr< CANMessageData > copy_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.
CANDataSpan data() const
Get the data span.
void set_byte(std::size_t index, std::uint8_t value)
Set the byte at the given index.
std::uint8_t get_byte(std::size_t index) override
Get the byte at the given index.
CANMessageDataView(const std::uint8_t *ptr, std::size_t len)
Construct a new CANMessageDataView object.
std::uint8_t get_byte(std::size_t index) override
Get the byte at the given index.
std::unique_ptr< CANMessageData > copy_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.
CANDataSpan data() const
Get the data span.
std::size_t size() const override
Get the size of the data.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
DataSpan< const std::uint8_t > CANDataSpan
A read-only span of data for a CAN message.
bool(*)(std::uint32_t callbackIndex, std::uint32_t bytesOffset, std::uint32_t numberOfBytesNeeded, std::uint8_t *chunkBuffer, void *parentPointer) DataChunkCallback
A callback to get chunks of data for transfer by a protocol.