aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-23 23:59:27 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-23 23:59:27 +0200
commit7747851ca010a3dfe9ffee808376dd5a7af68b91 (patch)
tree901e33d39e013c992adab34e7f5af82e5811eade /CAN-binder/low-can-binding/can
parentf30dc1a18dbb32880bdc0c9021b756c0f846ad53 (diff)
Static code review fixes.
Several style errors and mistakes mostly on constructor and passing arguments as ref. Change-Id: I2ca921d6aa70b9074392bb7779ade35bebf7bd8d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.hpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-decoder.cpp16
-rw-r--r--CAN-binder/low-can-binding/can/can-decoder.hpp14
-rw-r--r--CAN-binder/low-can-binding/can/can-message-set.cpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-message-set.hpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-message.cpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-message.hpp2
-rw-r--r--CAN-binder/low-can-binding/can/can-signals.hpp2
8 files changed, 21 insertions, 21 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus.hpp b/CAN-binder/low-can-binding/can/can-bus.hpp
index 1efd2049..16d8cf6a 100644
--- a/CAN-binder/low-can-binding/can/can-bus.hpp
+++ b/CAN-binder/low-can-binding/can/can-bus.hpp
@@ -71,7 +71,7 @@ private:
std::vector<std::pair<std::string, std::string> > can_devices_;
public:
- can_bus_t(utils::config_parser_t conf_file);
+ explicit can_bus_t(utils::config_parser_t conf_file);
can_bus_t(can_bus_t&&);
void set_can_devices();
diff --git a/CAN-binder/low-can-binding/can/can-decoder.cpp b/CAN-binder/low-can-binding/can/can-decoder.cpp
index aa1f57ed..3e21397b 100644
--- a/CAN-binder/low-can-binding/can/can-decoder.cpp
+++ b/CAN-binder/low-can-binding/can/can-decoder.cpp
@@ -54,7 +54,7 @@ float decoder_t::parseSignalBitfield(can_signal_t& signal, const can_message_t&
/// always succeeds.
///
openxc_DynamicField decoder_t::noopDecoder(can_signal_t& signal,
- const std::vector<std::shared_ptr<can_signal_t> > signals, float value, bool* send)
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, float value, bool* send)
{
openxc_DynamicField decoded_value = build_DynamicField(value);
@@ -76,7 +76,7 @@ openxc_DynamicField decoder_t::noopDecoder(can_signal_t& signal,
/// decoder always succeeds.
///
openxc_DynamicField decoder_t::booleanDecoder(can_signal_t& signal,
- const std::vector<std::shared_ptr<can_signal_t> > signals, float value, bool* send)
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, float value, bool* send)
{
openxc_DynamicField decoded_value = build_DynamicField(value == 0.0 ? false : true);
@@ -98,7 +98,7 @@ openxc_DynamicField decoder_t::booleanDecoder(can_signal_t& signal,
/// @return Return value is undefined.
///
openxc_DynamicField decoder_t::ignoreDecoder(can_signal_t& signal,
- const std::vector<std::shared_ptr<can_signal_t> > signals, float value, bool* send)
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, float value, bool* send)
{
if(send)
*send = false;
@@ -125,7 +125,7 @@ openxc_DynamicField decoder_t::ignoreDecoder(can_signal_t& signal,
/// return value is undefined.
///
openxc_DynamicField decoder_t::stateDecoder(can_signal_t& signal,
- const std::vector<std::shared_ptr<can_signal_t> > signals, float value, bool* send)
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, float value, bool* send)
{
const std::string signal_state = signal.get_states((uint8_t)value);
openxc_DynamicField decoded_value = build_DynamicField(signal_state);
@@ -154,7 +154,7 @@ openxc_DynamicField decoder_t::stateDecoder(can_signal_t& signal,
/// string or boolean.
///
openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, const can_message_t& message,
- const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send)
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send)
{
float value = decoder_t::parseSignalBitfield(signal, message);
DEBUG(binder_interface, "%s: Decoded message from parseSignalBitfield: %f", __FUNCTION__, value);
@@ -167,7 +167,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, const can_m
signal.set_received(true);
// Don't send if they is no changes
- if ((signal.get_last_value() == value && !signal.get_send_same()) || !send )
+ if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send )
{
*send = false;
}
@@ -193,7 +193,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, const can_m
/// string or boolean. If 'send' is false, the return value is undefined.
///
openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
- float value, const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send)
+ float value, const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send)
{
SignalDecoder decoder = signal.get_decoder() == nullptr ?
noopDecoder : signal.get_decoder();
@@ -216,7 +216,7 @@ openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
/// not be decoded.
///
openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
- const can_message_t& message, const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send)
+ const can_message_t& message, const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send)
{
float value = parseSignalBitfield(signal, message);
return decodeSignal(signal, value, signals, send);
diff --git a/CAN-binder/low-can-binding/can/can-decoder.hpp b/CAN-binder/low-can-binding/can/can-decoder.hpp
index 238bfeae..7eaa4a72 100644
--- a/CAN-binder/low-can-binding/can/can-decoder.hpp
+++ b/CAN-binder/low-can-binding/can/can-decoder.hpp
@@ -26,23 +26,23 @@ class decoder_t
public:
static float parseSignalBitfield(can_signal_t& signal, const can_message_t& message);
- static openxc_DynamicField stateDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> > signals,
+ static openxc_DynamicField stateDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> >& signals,
float value, bool* send);
- static openxc_DynamicField booleanDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> > signals,
+ static openxc_DynamicField booleanDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> >& signals,
float value, bool* send);
- static openxc_DynamicField ignoreDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> > signals,
+ static openxc_DynamicField ignoreDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> >& signals,
float value, bool* send);
- static openxc_DynamicField noopDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> > signals,
+ static openxc_DynamicField noopDecoder(can_signal_t& signal, const std::vector<std::shared_ptr<can_signal_t> >& signals,
float value, bool* send);
static openxc_DynamicField translateSignal(can_signal_t& signal, const can_message_t& message,
- const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send);
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send);
static openxc_DynamicField decodeSignal(can_signal_t& signal, const can_message_t& message,
- const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send);
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send);
static openxc_DynamicField decodeSignal(can_signal_t& signal, float value,
- const std::vector<std::shared_ptr<can_signal_t> > signals, bool* send);
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send);
static float decode_obd2_response(const DiagnosticResponse* response, float parsed_payload);
diff --git a/CAN-binder/low-can-binding/can/can-message-set.cpp b/CAN-binder/low-can-binding/can/can-message-set.cpp
index 5b3a220f..a41f0085 100644
--- a/CAN-binder/low-can-binding/can/can-message-set.cpp
+++ b/CAN-binder/low-can-binding/can/can-message-set.cpp
@@ -22,7 +22,7 @@
can_message_set_t::can_message_set_t(
uint8_t index,
- const std::string name,
+ const std::string& name,
const std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition,
const std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages)
: index_{index}
diff --git a/CAN-binder/low-can-binding/can/can-message-set.hpp b/CAN-binder/low-can-binding/can/can-message-set.hpp
index ca01abc8..c763de6d 100644
--- a/CAN-binder/low-can-binding/can/can-message-set.hpp
+++ b/CAN-binder/low-can-binding/can/can-message-set.hpp
@@ -40,7 +40,7 @@ private:
public:
can_message_set_t(
uint8_t index,
- const std::string name,
+ const std::string& name,
const std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition,
const std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages);
diff --git a/CAN-binder/low-can-binding/can/can-message.cpp b/CAN-binder/low-can-binding/can/can-message.cpp
index 772734d7..abfbfdb0 100644
--- a/CAN-binder/low-can-binding/can/can-message.cpp
+++ b/CAN-binder/low-can-binding/can/can-message.cpp
@@ -36,7 +36,7 @@ can_message_t::can_message_t(uint8_t maxdlen,
can_message_format_t format,
bool rtr_flag,
uint8_t flags,
- std::vector<uint8_t> data,
+ std::vector<uint8_t>& data,
uint64_t timestamp)
: maxdlen_{maxdlen},
id_{id},
diff --git a/CAN-binder/low-can-binding/can/can-message.hpp b/CAN-binder/low-can-binding/can/can-message.hpp
index 910b3e9f..1ce1c7a5 100644
--- a/CAN-binder/low-can-binding/can/can-message.hpp
+++ b/CAN-binder/low-can-binding/can/can-message.hpp
@@ -55,7 +55,7 @@ private:
public:
can_message_t();
- can_message_t(uint8_t maxdlen, uint32_t id, uint8_t length, can_message_format_t format, bool rtr_flag_, uint8_t flags, std::vector<uint8_t> data, uint64_t timestamp);
+ can_message_t(uint8_t maxdlen, uint32_t id, uint8_t length, can_message_format_t format, bool rtr_flag_, uint8_t flags, std::vector<uint8_t>& data, uint64_t timestamp);
uint32_t get_id() const;
bool get_rtr_flag_() const;
diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp
index cc4b6da3..b8fbe4ef 100644
--- a/CAN-binder/low-can-binding/can/can-signals.hpp
+++ b/CAN-binder/low-can-binding/can/can-signals.hpp
@@ -56,7 +56,7 @@ class can_signal_t;
/// @return a decoded value in an openxc_DynamicField struct.
///
typedef openxc_DynamicField (*SignalDecoder)(can_signal_t& signal,
- const std::vector<std::shared_ptr<can_signal_t> > signals, float value, bool* send);
+ const std::vector<std::shared_ptr<can_signal_t> >& signals, float value, bool* send);
///
/// @brief: The type signature for a CAN signal encoder.