26 #include <icl_math/MathFunctions.h> 32 : m_filename(filename),
33 m_file(m_filename.c_str())
35 m_file.imbue(std::locale(
"C"));
39 std::ifstream::pos_type current_pos =
m_file.tellg();
40 while (
m_file && (line.empty() || line[0] ==
'#'))
42 current_pos =
m_file.tellg();
43 std::getline(
m_file, line);
55 m_file.seekg(0, std::ios_base::end);
61 unsigned long stamp_usec(icl_math::round((stamp - icl_math::floor(stamp)) * 1e6));
62 return boost::posix_time::ptime(boost::gregorian::date(1970,1,1),
63 boost::posix_time::seconds(static_cast<unsigned long>(stamp))
64 + boost::posix_time::microsec(stamp_usec));
72 std::getline(
m_file, line);
74 std::ifstream::pos_type current_pos =
m_file.tellg();
75 while (
m_file && (line.empty() || line[0] ==
'#'))
77 current_pos =
m_file.tellg();
78 std::getline(
m_file, line);
90 m_file.seekg(0, std::ios_base::end);
98 m_current_position.index = icl_sourcesink::Index(icl_sourcesink::Position::INVALID_INDEX);
100 m_current_position.dsin = icl_sourcesink::DSIN(icl_sourcesink::Position::INVALID_DSIN);
101 std::istringstream ss(line);
102 ss.imbue(std::locale(
"C"));
104 unsigned id, dlc, msg0, msg1, msg2, msg3, msg4, msg5, msg6, msg7;
107 if (ss >> std::dec >> gmtime >>
id >> dlc
108 >> std::hex >> msg0 >> msg1 >> msg2 >> msg3 >> msg4 >> msg5 >> msg6 >> msg7)
110 m_current_position.index = icl_sourcesink::Index(icl_sourcesink::Position::INVALID_INDEX);
118 (*m_current_message)->data[0] = msg0;
119 (*m_current_message)->data[1] = msg1;
120 (*m_current_message)->data[2] = msg2;
121 (*m_current_message)->data[3] = msg3;
122 (*m_current_message)->data[4] = msg4;
123 (*m_current_message)->data[5] = msg5;
124 (*m_current_message)->data[6] = msg6;
125 (*m_current_message)->data[7] = msg7;
138 std::ifstream::pos_type current_pos =
m_file.tellg();
140 std::getline(
m_file, line);
143 m_file.seekg(current_pos);
152 m_file.seekg(0, std::ios_base::end);
static boost::posix_time::ptime timestampToPtime(double stamp)
unsigned __int64 uint64_t
CanFileResolutionHelper(const std::string &filename)
CanMessageStamped::Ptr m_current_message
icl_core::Stamped< tCanMessage > CanMessageStamped
icl_hardware::can::tCanMessage tCanMessage
icl_sourcesink::Position m_current_position
bool tryParse(const std::string &line, uint64_t current_pos)