summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can/can-decoder.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-11 01:12:11 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-11 01:12:11 +0200
commit6222973c39ee02ad52a5d0b4b400024157ff2eeb (patch)
tree08fff1571d6089dd7674166aac6e424a9826b4b3 /CAN-binder/low-can-binding/can/can-decoder.cpp
parentd253ada94487232ccd33b68a69fd44ff7840fab7 (diff)
Massive use of shared_ptr about signal and diag message. WIP
Vector of shared_ptr is made to shared ownership about object around project. This is the default returned value by getter methods when lookup and manipulating them. Change-Id: Id37947bb5994b629f4bf3faecc5ffac81c55e1e6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-decoder.cpp')
-rw-r--r--CAN-binder/low-can-binding/can/can-decoder.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/CAN-binder/low-can-binding/can/can-decoder.cpp b/CAN-binder/low-can-binding/can/can-decoder.cpp
index 419eac1b..eae4ef25 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<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<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<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<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);
@@ -172,7 +172,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, const can_m
*send = false;
}
signal.set_last_value(value);
- signal.get_message().set_last_value(message);
+ signal.get_message()->set_last_value(message);
return decoded_value;
}
@@ -192,7 +192,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<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();
@@ -215,7 +215,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<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);