HardwareCanSourceCanfile.h
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 #ifndef ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_CAN_FILE_H_INCLUDED
00024 #define ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_CAN_FILE_H_INCLUDED
00025 
00026 #include <string>
00027 
00028 #include <boost/date_time/posix_time/posix_time.hpp>
00029 
00030 #include <icl_core/BaseTypes.h>
00031 #include <icl_sourcesink/KeyframePositionResolver.h>
00032 
00033 #include <icl_hardware_can/source/ImportExport.h>
00034 #include <icl_hardware_can/source/HardwareCanSource.h>
00035 #include <icl_hardware_can/source/CanFileResolutionHelper.h>
00036 
00037 namespace icl_hardware {
00038 namespace can {
00039 
00056 class ICL_HARDWARE_CAN_SOURCE_IMPORT_EXPORT HardwareCanSourceCanfile : public HardwareCanSource
00057 {
00058 public:
00060   typedef boost::shared_ptr<HardwareCanSourceCanfile> Ptr;
00062   typedef boost::shared_ptr<const HardwareCanSourceCanfile> ConstPtr;
00063 
00065   static icl_sourcesink::URISchemeMap supportedURISchemes()
00066   {
00067     using namespace icl_sourcesink;
00068     URISchemeMap schemes;
00069     schemes.insert(
00070       std::make_pair(
00071         "can+file",
00072         URISchemeInfo(
00073           "Reads tCanMessage data from FZI CAN files.",
00074           "can+file:<filepath>[#start-end]",
00075           "<filepath> File to read.")));
00076     return schemes;
00077   }
00078 
00079   virtual CanMessageStamped::Ptr get() const
00080   {
00081     return m_buffer;
00082   }
00083 
00085   virtual bool isSeekable() const
00086   {
00087     return true;
00088   }
00089 
00090 protected:
00091   HardwareCanSourceCanfile(const std::string& uri,
00092                            const std::string& name = "HardwareCanSourceCanfile");
00093 
00094   void prepareFile();
00095 
00097   friend class icl_sourcesink::SourceSinkManager;
00098 
00100   friend class icl_sourcesink::DataSourceFactory<HardwareCanSourceCanfile>;
00101 
00103   virtual bool seekImpl(const icl_sourcesink::InternalIndex internal_index);
00104 
00106   virtual bool advance();
00107 
00108 private:
00110   CanMessageStamped::Ptr m_buffer;
00111 
00115   icl_sourcesink::KeyframePositionResolver::Ptr m_resolver_x;
00116 
00118   CanFileResolutionHelper::Ptr m_resolution_helper;
00119 
00121   std::size_t m_sequence_number;
00122 };
00123 
00124 SOURCESINK_DECLARE_GENERIC_SOURCE_FACTORY(HardwareCanSourceCanfile)
00125 
00126 }
00127 }
00128 
00129 #endif


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