snark
stdin_reader.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_SENSORS_VELODYNE_STDIN_READER_H_
20 #define SNARK_SENSORS_VELODYNE_STDIN_READER_H_
21 
22 #ifndef WIN32
23 #include <stdlib.h>
24 #endif
25 #include <boost/array.hpp>
26 #include <comma/base/types.h>
27 #include <boost/date_time/posix_time/posix_time.hpp>
28 
29 namespace snark {
30 
33 {
34  public:
36  stdin_reader();
37 
39  const char* read();
40 
42  const boost::posix_time::ptime& timestamp() const;
43 
44  private:
45  enum{ payload_size = 1206 };
46  comma::uint64 m_microseconds;
47  boost::array< char, payload_size > m_packet;
48  boost::posix_time::ptime m_timestamp;
49  boost::posix_time::ptime m_epoch;
50 };
51 
52 } // namespace snark {
53 
54 #endif /*SNARK_SENSORS_VELODYNE_STDIN_READER_H_*/
55