HardwareCanFilterMessageMap.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #include "HardwareCanFilterMessageMap.h"
00024 
00025 namespace icl_hardware {
00026 namespace can {
00027 
00028 HardwareCanFilterMessageMap::HardwareCanFilterMessageMap(const std::string& uri, const std::string& name)
00029   : icl_sourcesink::DataFilter<tCanMessage, CanMessageMap>(uri, name)
00030 { }
00031 
00032 HardwareCanFilterMessageMap::~HardwareCanFilterMessageMap()
00033 { }
00034 
00035 void HardwareCanFilterMessageMap::set(const CanMessageStamped::Ptr& data)
00036 {
00037   if (!data)
00038   {
00039     m_data.reset();
00040     return;
00041   }
00042   if (!m_data)
00043   {
00044     m_data.reset(new icl_core::Stamped<CanMessageMap>);
00045   }
00046   if (!filter(*data, *m_data))
00047   {
00048     m_data.reset();
00049   }
00050 }
00051 
00052 bool HardwareCanFilterMessageMap::filter(const icl_core::Stamped<tCanMessage>& input_data,
00053                                          icl_core::Stamped<CanMessageMap>& output_data)
00054 {
00055   output_data.header() = input_data.header();
00056   (*output_data)[input_data->id] = *input_data;
00057   return true;
00058 }
00059 
00060 }
00061 }


fzi_icl_can
Author(s):
autogenerated on Thu Jun 6 2019 20:26:01