Control Libraries 6.3.4
All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
decoders.h
1#pragma once
2
3#include <google/protobuf/repeated_field.h>
4
5#include <state_representation/State.hpp>
6#include <state_representation/parameters/Parameter.hpp>
7
8#include "state_representation/state_message.pb.h"
9
10namespace clproto {
11
19template<typename FieldT>
20std::vector<FieldT> decoder(const google::protobuf::RepeatedField<FieldT>& message);
21
29template<typename FieldT>
30std::vector<FieldT> decoder(const google::protobuf::RepeatedPtrField<FieldT>& message);
31
38template<typename ParamT>
39state_representation::Parameter<ParamT> decoder(const state_representation::proto::Parameter& message);
40
41/*
42 * Declarations for decoding helpers
43 */
44std::vector<bool> decoder(const google::protobuf::RepeatedField<bool>& message);
45state_representation::StateType decoder(const state_representation::proto::StateType& message);
46Eigen::Vector3d decoder(const state_representation::proto::Vector3d& message);
47Eigen::Quaterniond decoder(const state_representation::proto::Quaterniond& message);
48
49/*
50 * Definitions for templated RepeatedField methods
51 */
52template<typename FieldT>
53std::vector<FieldT> decoder(const google::protobuf::RepeatedField<FieldT>& message) {
54 return {message.begin(), message.end()};
55}
56
57template<typename FieldT>
58std::vector<FieldT> decoder(const google::protobuf::RepeatedPtrField<FieldT>& message) {
59 return {message.begin(), message.end()};
60}
61
62}
Bindings to encode and decode state objects into serialised binary message.
std::vector< FieldT > decoder(const google::protobuf::RepeatedField< FieldT > &message)
Decoding helper method for a RepeatedField message into vector data.
Definition: decoders.h:53
StateType
The class types inheriting from State.
Definition: StateType.hpp:13