HardwareCanFilterMessageMap.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
24 
25 namespace icl_hardware {
26 namespace can {
27 
28 HardwareCanFilterMessageMap::HardwareCanFilterMessageMap(const std::string& uri, const std::string& name)
29  : icl_sourcesink::DataFilter<tCanMessage, CanMessageMap>(uri, name)
30 { }
31 
33 { }
34 
36 {
37  if (!data)
38  {
39  m_data.reset();
40  return;
41  }
42  if (!m_data)
43  {
44  m_data.reset(new icl_core::Stamped<CanMessageMap>);
45  }
46  if (!filter(*data, *m_data))
47  {
48  m_data.reset();
49  }
50 }
51 
54 {
55  output_data.header() = input_data.header();
56  (*output_data)[input_data->id] = *input_data;
57  return true;
58 }
59 
60 }
61 }
Implements a struct representing a can message.
Definition: tCanMessage.h:43
virtual DataHeader & header()
virtual void set(const CanMessageStamped::Ptr &data)
virtual bool filter(const CanMessageStamped &input_data, icl_core::Stamped< CanMessageMap > &output_data)
std::map< unsigned, CanMessageStamped > CanMessageMap
Maps CAN IDs to the latest received message for each ID.
Definition: tCanMessage.h:81
boost::shared_ptr< Stamped< DataType > > Ptr
HardwareCanFilterMessageMap(const std::string &uri="HardwareCanFilterMessageMap", const std::string &name="UnnamedHardwareCanFilterMessageMap")
Constructor.


fzi_icl_can
Author(s):
autogenerated on Mon Jun 10 2019 13:17:02