-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmessage.hpp
More file actions
68 lines (57 loc) · 1.94 KB
/
message.hpp
File metadata and controls
68 lines (57 loc) · 1.94 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* message.hpp
*
* Created on: 04.10.2013
* Author: downtimes
* Modified : 05.21.2020
* Author: Yunjin
*/
#ifndef MESSAGE_HPP_
#define MESSAGE_HPP_
#include <string>
#include <vector>
#include <iosfwd>
#include <cstdint>
#include <set>
#include <unordered_map>
#include "signal.hpp"
/**
* Class representing a Message in the DBC-File. It allows its user to query
* Data and to iterate over the Signals contained in the Message
*/class Message {
typedef std::vector<Signal> signals_t;
//Name of the Message
std::string name;
//The CAN-ID assigned to this specific Message
std::uint32_t id;
//The length of this message in Bytes. Allowed values are between 0 and 8
std::size_t dlc;
//String containing the name of the Sender of this Message if one exists in the DB
std::string from;
//List containing all Signals which are present in this Message
signals_t signals;
std::unordered_map<std::string, double> sigvalue;
public:
typedef signals_t::const_iterator const_iterator;
//Overload of operator>> to enable parsing of Messages from streams of DBC-Files
friend std::istream& operator>>(std::istream& in, Message& msg);
//Getter functions for all the possible Data one can request from a Message
std::string getName() const { return name; }
std::uint32_t getId() const { return id; }
std::size_t getDlc() const { return dlc; }
std::string getFrom() const { return from; }
std::set<std::string> getTo() const;
/*
* Functionality to access the Signals contained in this Message
* either via the iterators provided by begin() and end() or by
* random access operator[]
*/
const_iterator begin() const { return signals.begin(); }
const_iterator end() const { return signals.end(); }
signals_t::const_reference operator[](std::size_t elem) {
return signals[elem];
}
std::unordered_map<std::string, double> decode(uint64_t payload);
// 디코딩딩시 변환 하므로, 밸류로 받을것
};
#endif /* MESSAGE_HPP_ */