Template Struct ParameterAdapter

Struct Documentation

template<typename M>
struct ParameterAdapter

Generally not for outside use. Adapts a function parameter type into the message type, event type and parameter. Allows you to retrieve a parameter type from an event type.

ParameterAdapter is generally only useful for outside use when implementing things that require message callbacks (such as the message_filters package)and you would like to support all the rclcpp message parameter types

The ParameterAdapter is templated on the callback parameter type (not the bare message type), and provides 3 things:

  • Message typedef, which provides the bare message type, no const or reference qualifiers

  • Event typedef, which provides the message_filters::MessageEvent type

  • Parameter typedef, which provides the actual parameter type (may be slightly different from M)

  • static getParameter(event) function, which returns a parameter type given the event

  • static bool is_const informs you whether or not the parameter type is a const message

ParameterAdapter is specialized to allow callbacks of any of the forms:

void callback(const std::shared_ptr<M const>&);
void callback(const std::shared_ptr<M>&);
void callback(std::shared_ptr<M const>);
void callback(std::shared_ptr<M>);
void callback(const M&);
void callback(M);
void callback(const MessageEvent<M const>&);
void callback(const MessageEvent<M>&);

Public Types

typedef std::remove_reference<typename std::remove_const<M>::type>::type Message
typedef MessageEvent<Message const> Event
typedef M Parameter

Public Static Functions

static inline Parameter getParameter(const Event &event)

Public Static Attributes

static const bool is_const = true