Skip to content

Commit 5343d15

Browse files
committed
Standardize line endings to LF only (unix) and fix clang tidy errors about reserved define includes guards
1 parent 806832c commit 5343d15

File tree

12 files changed

+1097
-1096
lines changed

12 files changed

+1097
-1096
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,4 @@ AllowShortLambdasOnASingleLine: Empty
106106
AllowAllArgumentsOnNextLine: false
107107

108108
InsertNewlineAtEOF: true
109+
LineEnding: LF

include/libdbc/dbc.hpp

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
#ifndef __DBC_HPP__
2-
#define __DBC_HPP__
3-
4-
#include <libdbc/exceptions/error.hpp>
5-
#include <libdbc/message.hpp>
6-
#include <libdbc/signal.hpp>
7-
#include <libdbc/utils/utils.hpp>
8-
9-
#include <regex>
10-
11-
namespace libdbc {
12-
13-
class Parser {
14-
public:
15-
virtual ~Parser() = default;
16-
17-
virtual void parse_file(const std::string& file) = 0;
18-
19-
protected:
20-
};
21-
22-
class DbcParser : public Parser {
23-
public:
24-
DbcParser();
25-
26-
virtual ~DbcParser() = default;
27-
28-
virtual void parse_file(const std::string& file) final override;
29-
30-
std::string get_version() const;
31-
std::vector<std::string> get_nodes() const;
32-
std::vector<libdbc::Message> get_messages() const;
33-
34-
Message::ParseSignalsStatus parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values);
35-
36-
private:
37-
std::string version;
38-
std::vector<std::string> nodes;
39-
std::vector<libdbc::Message> messages;
40-
41-
const std::regex version_re;
42-
const std::regex bit_timing_re;
43-
const std::regex name_space_re;
44-
const std::regex node_re;
45-
const std::regex message_re;
46-
const std::regex signal_re;
47-
48-
void parse_dbc_header(std::istream& file_stream);
49-
void parse_dbc_nodes(std::istream& file_stream);
50-
void parse_dbc_messages(const std::vector<std::string>& lines);
51-
};
52-
53-
}
54-
55-
#endif // __DBC_HPP__
1+
#ifndef DBC_HPP
2+
#define DBC_HPP
3+
4+
#include <libdbc/exceptions/error.hpp>
5+
#include <libdbc/message.hpp>
6+
#include <libdbc/signal.hpp>
7+
#include <libdbc/utils/utils.hpp>
8+
9+
#include <regex>
10+
11+
namespace libdbc {
12+
13+
class Parser {
14+
public:
15+
virtual ~Parser() = default;
16+
17+
virtual void parse_file(const std::string& file) = 0;
18+
19+
protected:
20+
};
21+
22+
class DbcParser : public Parser {
23+
public:
24+
DbcParser();
25+
26+
virtual ~DbcParser() = default;
27+
28+
virtual void parse_file(const std::string& file) final override;
29+
30+
std::string get_version() const;
31+
std::vector<std::string> get_nodes() const;
32+
std::vector<libdbc::Message> get_messages() const;
33+
34+
Message::ParseSignalsStatus parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values);
35+
36+
private:
37+
std::string version;
38+
std::vector<std::string> nodes;
39+
std::vector<libdbc::Message> messages;
40+
41+
const std::regex version_re;
42+
const std::regex bit_timing_re;
43+
const std::regex name_space_re;
44+
const std::regex node_re;
45+
const std::regex message_re;
46+
const std::regex signal_re;
47+
48+
void parse_dbc_header(std::istream& file_stream);
49+
void parse_dbc_nodes(std::istream& file_stream);
50+
void parse_dbc_messages(const std::vector<std::string>& lines);
51+
};
52+
53+
}
54+
55+
#endif // DBC_HPP
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
#ifndef __ERROR_HPP__
2-
#define __ERROR_HPP__
3-
4-
#include <sstream>
5-
6-
namespace libdbc {
7-
8-
class exception : public std::exception {
9-
public:
10-
const char* what() const throw() {
11-
return "libdbc exception occurred";
12-
}
13-
};
14-
15-
class validity_error : public exception {
16-
public:
17-
const char* what() const throw() {
18-
return "Invalid DBC file";
19-
}
20-
};
21-
22-
} // libdbc
23-
24-
#endif // __ERROR_HPP__
1+
#ifndef ERROR_HPP
2+
#define ERROR_HPP
3+
4+
#include <sstream>
5+
6+
namespace libdbc {
7+
8+
class exception : public std::exception {
9+
public:
10+
const char* what() const throw() {
11+
return "libdbc exception occurred";
12+
}
13+
};
14+
15+
class validity_error : public exception {
16+
public:
17+
const char* what() const throw() {
18+
return "Invalid DBC file";
19+
}
20+
};
21+
22+
} // libdbc
23+
24+
#endif // ERROR_HPP

include/libdbc/message.hpp

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
#ifndef __MESSAGE_HPP__
2-
#define __MESSAGE_HPP__
3-
4-
#include <array>
5-
#include <iostream>
6-
#include <libdbc/signal.hpp>
7-
#include <string>
8-
#include <vector>
9-
10-
namespace libdbc {
11-
struct Message {
12-
Message() = delete;
13-
virtual ~Message() = default;
14-
explicit Message(uint32_t id, const std::string& name, uint8_t size, const std::string& node);
15-
16-
enum class ParseSignalsStatus {
17-
Success,
18-
ErrorMessageToLong,
19-
ErrorBigEndian,
20-
ErrorUnknownID,
21-
ErrorInvalidConversion,
22-
};
23-
24-
ParseSignalsStatus parseSignals(const std::vector<uint8_t>& data, std::vector<double>& values) const;
25-
26-
void appendSignal(const Signal& signal);
27-
const std::vector<Signal> getSignals() const;
28-
uint32_t id() const;
29-
uint8_t size() const;
30-
const std::string& name() const;
31-
void addValueDescription(const std::string& signal_name, const std::vector<Signal::SignalValueDescriptions>&);
32-
33-
virtual bool operator==(const Message& rhs) const;
34-
35-
private:
36-
uint32_t m_id;
37-
std::string m_name;
38-
uint8_t m_size;
39-
std::string m_node;
40-
std::vector<Signal> m_signals;
41-
42-
friend std::ostream& operator<<(std::ostream& os, const Message& dt);
43-
};
44-
45-
std::ostream& operator<<(std::ostream& out, const Message& msg);
46-
47-
}
48-
49-
#endif // __MESSAGE_HPP__
1+
#ifndef MESSAGE_HPP
2+
#define MESSAGE_HPP
3+
4+
#include <array>
5+
#include <iostream>
6+
#include <libdbc/signal.hpp>
7+
#include <string>
8+
#include <vector>
9+
10+
namespace libdbc {
11+
struct Message {
12+
Message() = delete;
13+
virtual ~Message() = default;
14+
explicit Message(uint32_t id, const std::string& name, uint8_t size, const std::string& node);
15+
16+
enum class ParseSignalsStatus {
17+
Success,
18+
ErrorMessageToLong,
19+
ErrorBigEndian,
20+
ErrorUnknownID,
21+
ErrorInvalidConversion,
22+
};
23+
24+
ParseSignalsStatus parseSignals(const std::vector<uint8_t>& data, std::vector<double>& values) const;
25+
26+
void appendSignal(const Signal& signal);
27+
const std::vector<Signal> getSignals() const;
28+
uint32_t id() const;
29+
uint8_t size() const;
30+
const std::string& name() const;
31+
void addValueDescription(const std::string& signal_name, const std::vector<Signal::SignalValueDescriptions>&);
32+
33+
virtual bool operator==(const Message& rhs) const;
34+
35+
private:
36+
uint32_t m_id;
37+
std::string m_name;
38+
uint8_t m_size;
39+
std::string m_node;
40+
std::vector<Signal> m_signals;
41+
42+
friend std::ostream& operator<<(std::ostream& os, const Message& dt);
43+
};
44+
45+
std::ostream& operator<<(std::ostream& out, const Message& msg);
46+
47+
}
48+
49+
#endif // MESSAGE_HPP

include/libdbc/signal.hpp

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
2-
#ifndef __SIGNAL_HPP__
3-
#define __SIGNAL_HPP__
4-
5-
#include <cstdint>
6-
#include <iostream>
7-
#include <string>
8-
#include <vector>
9-
10-
namespace libdbc {
11-
struct Signal {
12-
struct SignalValueDescriptions {
13-
uint32_t value;
14-
std::string description;
15-
};
16-
17-
std::string name;
18-
bool is_multiplexed;
19-
uint32_t start_bit;
20-
uint32_t size;
21-
bool is_bigendian;
22-
bool is_signed;
23-
double factor;
24-
double offset;
25-
double min;
26-
double max;
27-
std::string unit;
28-
std::vector<std::string> receivers;
29-
std::vector<SignalValueDescriptions> svDescriptions;
30-
31-
Signal() = delete;
32-
virtual ~Signal() = default;
33-
explicit Signal(std::string name,
34-
bool is_multiplexed,
35-
uint32_t start_bit,
36-
uint32_t size,
37-
bool is_bigendian,
38-
bool is_signed,
39-
double factor,
40-
double offset,
41-
double min,
42-
double max,
43-
std::string unit,
44-
std::vector<std::string> recievers);
45-
46-
virtual bool operator==(const Signal& rhs) const;
47-
bool operator<(const Signal& rhs) const;
48-
};
49-
50-
std::ostream& operator<<(std::ostream& out, const Signal& sig);
51-
52-
}
53-
54-
#endif // __SIGNAL_HPP__
1+
2+
#ifndef SIGNAL_HPP
3+
#define SIGNAL_HPP
4+
5+
#include <cstdint>
6+
#include <iostream>
7+
#include <string>
8+
#include <vector>
9+
10+
namespace libdbc {
11+
struct Signal {
12+
struct SignalValueDescriptions {
13+
uint32_t value;
14+
std::string description;
15+
};
16+
17+
std::string name;
18+
bool is_multiplexed;
19+
uint32_t start_bit;
20+
uint32_t size;
21+
bool is_bigendian;
22+
bool is_signed;
23+
double factor;
24+
double offset;
25+
double min;
26+
double max;
27+
std::string unit;
28+
std::vector<std::string> receivers;
29+
std::vector<SignalValueDescriptions> svDescriptions;
30+
31+
Signal() = delete;
32+
virtual ~Signal() = default;
33+
explicit Signal(std::string name,
34+
bool is_multiplexed,
35+
uint32_t start_bit,
36+
uint32_t size,
37+
bool is_bigendian,
38+
bool is_signed,
39+
double factor,
40+
double offset,
41+
double min,
42+
double max,
43+
std::string unit,
44+
std::vector<std::string> recievers);
45+
46+
virtual bool operator==(const Signal& rhs) const;
47+
bool operator<(const Signal& rhs) const;
48+
};
49+
50+
std::ostream& operator<<(std::ostream& out, const Signal& sig);
51+
52+
}
53+
54+
#endif // SIGNAL_HPP

0 commit comments

Comments
 (0)