#include <LogSensorStream.h>
Public Member Functions | |
virtual const AbstractReading * | current () const |
virtual bool | end () const |
const std::vector < AbstractReading * > & | getLog () const |
const LogReader * | getReader () const |
const LogWriter * | getWriter () const |
virtual bool | isSeekable () const |
void | load (std::istream &_stream) |
void | load (const std::string &_filename) |
LogSensorStream (const LogSensorStream &_stream) | |
LogSensorStream (const LogReader *_reader, const LogWriter *_writer) | |
virtual const AbstractReading * | next () const |
LogSensorStream & | operator= (const LogSensorStream &_stream) |
void | save (std::ostream &_stream) |
void | save (const std::string &_filename) |
virtual bool | seek (const unsigned int _position=0, SensorStreamOffset _offset=BEGIN) |
virtual unsigned int | tell () const |
virtual | ~LogSensorStream () |
Protected Attributes | |
unsigned int | m_index |
std::vector< AbstractReading * > | m_log |
const LogReader * | m_logReader |
const LogWriter * | m_logWriter |
Representation of log file as a stream of sensor readings. It implements the SensorStream class to stream from log files.
See CarmenLogTest.cpp for an example of its use.
Definition at line 49 of file LogSensorStream.h.
Constructor. It creates the stream by giving the _reader and the _writer.
_reader | The LogReader object for a particular log format. | |
_writer | The LogWriter object for a particular log format. |
Definition at line 3 of file LogSensorStream.cpp.
LogSensorStream::LogSensorStream | ( | const LogSensorStream & | _stream | ) |
Copy Constructor. It copies the object of the class by cloning the readings.
Definition at line 11 of file LogSensorStream.cpp.
LogSensorStream::~LogSensorStream | ( | ) | [virtual] |
Destructor
Definition at line 40 of file LogSensorStream.cpp.
const AbstractReading * LogSensorStream::current | ( | ) | const [virtual] |
Get the current reading without advancing the stream (const reading).
Implements SensorStream.
Definition at line 51 of file LogSensorStream.cpp.
bool LogSensorStream::end | ( | ) | const [virtual] |
Check if the stream is finished.
Implements SensorStream.
Definition at line 62 of file LogSensorStream.cpp.
const std::vector<AbstractReading*>& LogSensorStream::getLog | ( | ) | const [inline] |
Get the full log vector.
Definition at line 81 of file LogSensorStream.h.
const LogReader* LogSensorStream::getReader | ( | ) | const [inline] |
Get the log reader.
Definition at line 84 of file LogSensorStream.h.
const LogWriter* LogSensorStream::getWriter | ( | ) | const [inline] |
Get the log writer.
Definition at line 87 of file LogSensorStream.h.
virtual bool LogSensorStream::isSeekable | ( | ) | const [inline, virtual] |
Check if the stream is seekable
Reimplemented from SensorStream.
Definition at line 76 of file LogSensorStream.h.
void LogSensorStream::load | ( | std::istream & | _stream | ) |
Load a log from a stream.
Definition at line 81 of file LogSensorStream.cpp.
void LogSensorStream::load | ( | const std::string & | _filename | ) |
Load a log from a file.
Definition at line 67 of file LogSensorStream.cpp.
const AbstractReading * LogSensorStream::next | ( | ) | const [virtual] |
Get the next reading and advance the stream (const reading).
Implements SensorStream.
Definition at line 46 of file LogSensorStream.cpp.
LogSensorStream & LogSensorStream::operator= | ( | const LogSensorStream & | _stream | ) |
Assignament operator. It assigns _stream to this object. The previous reading are deleted and the _stream one cloned.
Definition at line 23 of file LogSensorStream.cpp.
void LogSensorStream::save | ( | std::ostream & | _stream | ) |
Save a log to a stream.
Definition at line 85 of file LogSensorStream.cpp.
void LogSensorStream::save | ( | const std::string & | _filename | ) |
Save a log to a file.
Definition at line 74 of file LogSensorStream.cpp.
bool LogSensorStream::seek | ( | const unsigned int | _position = 0 , |
|
SensorStreamOffset | _offset = BEGIN | |||
) | [virtual] |
Seek the stream to a given sensor position. Return false if is not possible.
Implements SensorStream.
Definition at line 55 of file LogSensorStream.cpp.
virtual unsigned int LogSensorStream::tell | ( | ) | const [inline, virtual] |
Get the current sensor position of the stream. Return 0 if it is not seekable
Implements SensorStream.
Definition at line 74 of file LogSensorStream.h.
unsigned int LogSensorStream::m_index [mutable, protected] |
The index of the current reading.
Definition at line 102 of file LogSensorStream.h.
std::vector<AbstractReading*> LogSensorStream::m_log [protected] |
The log, represented as a vector of reading.
Definition at line 101 of file LogSensorStream.h.
const LogReader* LogSensorStream::m_logReader [protected] |
The log reader.
Definition at line 103 of file LogSensorStream.h.
const LogWriter* LogSensorStream::m_logWriter [protected] |
The log writer.
Definition at line 104 of file LogSensorStream.h.