HardwareCanSourceCanfile.h
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 //----------------------------------------------------------------------
23 #ifndef ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_CAN_FILE_H_INCLUDED
24 #define ICL_HARDWARE_CAN_SOURCE_HARDWARE_CAN_SOURCE_CAN_FILE_H_INCLUDED
25 
26 #include <string>
27 
28 #include <boost/date_time/posix_time/posix_time.hpp>
29 
30 #include <icl_core/BaseTypes.h>
31 #include <icl_sourcesink/KeyframePositionResolver.h>
32 
36 
37 namespace icl_hardware {
38 namespace can {
39 
57 {
58 public:
60  typedef boost::shared_ptr<HardwareCanSourceCanfile> Ptr;
62  typedef boost::shared_ptr<const HardwareCanSourceCanfile> ConstPtr;
63 
65  static icl_sourcesink::URISchemeMap supportedURISchemes()
66  {
67  using namespace icl_sourcesink;
68  URISchemeMap schemes;
69  schemes.insert(
70  std::make_pair(
71  "can+file",
72  URISchemeInfo(
73  "Reads tCanMessage data from FZI CAN files.",
74  "can+file:<filepath>[#start-end]",
75  "<filepath> File to read.")));
76  return schemes;
77  }
78 
79  virtual CanMessageStamped::Ptr get() const
80  {
81  return m_buffer;
82  }
83 
85  virtual bool isSeekable() const
86  {
87  return true;
88  }
89 
90 protected:
91  HardwareCanSourceCanfile(const std::string& uri,
92  const std::string& name = "HardwareCanSourceCanfile");
93 
94  void prepareFile();
95 
97  friend class icl_sourcesink::SourceSinkManager;
98 
100  friend class icl_sourcesink::DataSourceFactory<HardwareCanSourceCanfile>;
101 
103  virtual bool seekImpl(const icl_sourcesink::InternalIndex internal_index);
104 
106  virtual bool advance();
107 
108 private:
111 
115  icl_sourcesink::KeyframePositionResolver::Ptr m_resolver_x;
116 
119 
121  std::size_t m_sequence_number;
122 };
123 
124 SOURCESINK_DECLARE_GENERIC_SOURCE_FACTORY(HardwareCanSourceCanfile)
125 
126 }
127 }
128 
129 #endif
icl_sourcesink::DataSource< tCanMessage > HardwareCanSource
Base type for all sources providing tCanMessage data.
boost::shared_ptr< const HardwareCanSourceCanfile > ConstPtr
Const shared pointer shorthand.
#define ICL_HARDWARE_CAN_SOURCE_IMPORT_EXPORT
std::size_t m_sequence_number
Ever-increasing sequence number.
boost::shared_ptr< Stamped< DataType > > Ptr
CanMessageStamped::Ptr m_buffer
Buffers the current data element.
static icl_sourcesink::URISchemeMap supportedURISchemes()
URI schemes supported by this source.
virtual bool isSeekable() const
This source works on CAN files and is therefore seekable.
icl_sourcesink::KeyframePositionResolver::Ptr m_resolver_x
boost::shared_ptr< CanFileResolutionHelper > Ptr
Convenience shared pointer shorthand.
CanFileResolutionHelper::Ptr m_resolution_helper
Our own resolution helper.
boost::shared_ptr< HardwareCanSourceCanfile > Ptr
Shared pointer shorthand.


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