include
cras_topic_tools
impl
shape_shifter.hpp
Go to the documentation of this file.
1
#pragma once
2
3
// SPDX-License-Identifier: BSD-3-Clause
4
// SPDX-FileCopyrightText: Czech Technical University in Prague
5
12
#include <
ros/message_traits.h
>
13
#include <
ros/serialization.h
>
14
#include <topic_tools/shape_shifter.h>
15
16
#include <
cras_topic_tools/shape_shifter.h
>
17
18
namespace
cras
19
{
20
21
template
<
typename
T,
typename
EnableT>
22
void
msgToShapeShifter
(
const
T& msg, ::
topic_tools::ShapeShifter
& shifter)
23
{
24
// Serialize the message into a byte buffer
25
const
auto
length
= ::ros::serialization::serializationLength(
msg
);
26
::cras::resizeBuffer
(shifter,
length
);
27
::ros::serialization::OStream
ostream(::
cras::getBuffer
(shifter),
length
);
28
::ros::serialization::serialize(ostream,
msg
);
29
shifter.
morph
(::
ros::message_traits::MD5Sum<T>::value
(), ::
ros::message_traits::DataType<T>::value
(),
30
::
ros::message_traits::Definition<T>::value
(),
"0"
);
31
}
32
33
}
ros::serialization::OStream
msg
msg
cras
shape_shifter.h
Tools for more convenient working with ShapeShifter objects.
ros::message_traits::DataType
message_traits.h
serialization.h
ros::message_traits::MD5Sum
topic_tools::ShapeShifter::morph
void morph(const std::string &md5sum, const std::string &datatype, const std::string &msg_def, const std::string &latching)
cras::msgToShapeShifter
void msgToShapeShifter(const T &msg, ::topic_tools::ShapeShifter &shifter)
Copy the message instance into the given ShapeShifter.
Definition:
shape_shifter.hpp:22
length
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
cras::getBuffer
uint8_t * getBuffer(::topic_tools::ShapeShifter &msg)
Get the internal buffer with serialized message data.
ros::message_traits::Definition
topic_tools::ShapeShifter
cras::resizeBuffer
void resizeBuffer(::topic_tools::ShapeShifter &msg, size_t newLength)
Resize the internal buffer of the message.
cras_topic_tools
Author(s): Martin Pecka
autogenerated on Tue Nov 26 2024 03:49:18