-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmessage.hpp
More file actions
50 lines (39 loc) · 1.2 KB
/
message.hpp
File metadata and controls
50 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef MESSAGE_HPP
#define MESSAGE_HPP
#include <cstdint>
#include <iostream>
#include <libdbc/signal.hpp>
#include <string>
#include <vector>
namespace Libdbc {
struct Message {
Message() = delete;
virtual ~Message() = default;
explicit Message(uint32_t message_id, const std::string& name, uint8_t size, const std::string& node);
enum class ParseSignalsStatus {
Success,
ErrorMessageToLong,
ErrorBigEndian,
ErrorUnknownID,
ErrorInvalidConversion,
ErrorInvalidSignalSize,
};
ParseSignalsStatus parse_signals(const std::vector<uint8_t>& data, std::vector<double>& values) const;
void append_signal(const Signal& signal);
const std::vector<Signal>& get_signals() const;
uint32_t id() const;
uint8_t size() const;
const std::string& name() const;
void add_value_description(const std::string& signal_name, const std::vector<Signal::ValueDescription>&);
virtual bool operator==(const Message& rhs) const;
private:
uint32_t m_id{};
std::string m_name{};
uint8_t m_size{};
std::string m_node{};
std::vector<Signal> m_signals{};
friend std::ostream& operator<<(std::ostream& out, const Message& msg);
};
std::ostream& operator<<(std::ostream& out, const Message& msg);
}
#endif // MESSAGE_HPP