MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
TapeVisitor Class Reference

Visitor class to inspect tapes by channels and/or time interval. More...

#include <fw/TapeVisitor.h>

Classes

class  iterator
 Iterator to iterate over all messages in all tapes visited by the visitor. More...
 
struct  MessageInfo
 Info about a message entry in a tape. More...
 
struct  MessageInstance
 Instance of a message from a tape. More...
 

Public Types

typedef std::vector< MessageInfoMessageMap
 Vector of message informations. More...
 
typedef std::map< std::string,
const Tape::ChannelInfo * > 
ChannelMap
 Maps channel info to channel names. More...
 

Public Member Functions

void visit (Tape *iTape, Duration first=Duration::negativeInfinity(), Duration last=Duration::infinity(), bool ignoreStartTime=false)
 Visit a tape by specifying an interval of the relative time of the first and the last message. More...
 
void visit (Tape *iTape, const std::vector< std::string > &channels, Duration first=Duration::negativeInfinity(), Duration last=Duration::infinity(), bool ignoreStartTime=false)
 Same as above, but additionally select which channels to visit. More...
 
Time getStartTime () const
 Get the common start time of the visit for all tapes. More...
 
void setStartTime (const Time &start)
 Set the common start time of the visit for all tapes. More...
 
Duration getFirstMessageTimeOffset () const
 Get the time offset of the first visited message. More...
 
Duration getLastMessageTimeOffset () const
 Get the time offset of the last visited message. More...
 
uint32 getMessageCount () const
 Get the number of messages to visit. More...
 
iterator begin ()
 Iterator to the first visited message in a tape. More...
 
iterator at (Duration timeOffset)
 Iterator to the message at the given offset since start of tape. More...
 
iterator end ()
 Iterator to the end of visited messages. More...
 
iterator findNextOf (Duration startOffset, const std::string &channel)
 Returns the iterator to the next message from given channel with a time offset of at least startOffset, or end iterator if no more messages of that channel exist in the tape. More...
 
iterator findNextOf (const iterator &start, const std::string &channel)
 Returns the iterator to the next message from given channel, starting at the given start iterator, or end iterator if no more messages of that channel exist in the tape. More...
 
iterator findNextOfAnyOf (Duration startOffset, const std::vector< std::string > &channels)
 Returns the iterator to the next message from any of the given channels with a time offset of at least startOffset, or end iterator if no more messages of those channels exist in the tape. More...
 
iterator findNextOfAnyOf (const iterator &start, const std::vector< std::string > &channels)
 Returns the iterator to the next message from any of the given channels, starting at the given start iterator, or end iterator if no more messages of those channels exist in the tape. More...
 
const ChannelMapgetChannels () const
 Get a list of the visited channels. More...
 

Protected Member Functions

void addChannel (Tape *tape, const Tape::ChannelInfo *channel, Duration first=Duration::nanoseconds(0), Duration last=Duration::infinity())
 
void reIndex (Tape *tape, bool ignoreStartTime=false)
 

Protected Attributes

boost::optional< TimemStart
 
MessageMap mMessages
 
ChannelMap mChannels
 

Friends

class iterator
 

Detailed Description

Visitor class to inspect tapes by channels and/or time interval.

All times of messages are relative times to the start time of the visitor. The start time will be the smallest time of all visited tapes. Multiple tapes can be inspected at once. Their times will be merged relative to the smallest time in all tapes. This means if two tapes are recorded with a ten minute delay this delay is also represented in the visitor.

Member Typedef Documentation

typedef std::vector<MessageInfo> MessageMap

Vector of message informations.

typedef std::map<std::string, const Tape::ChannelInfo*> ChannelMap

Maps channel info to channel names.

Member Function Documentation

void visit ( Tape iTape,
Duration  first = Duration::negativeInfinity(),
Duration  last = Duration::infinity(),
bool  ignoreStartTime = false 
)

Visit a tape by specifying an interval of the relative time of the first and the last message.

If a start time has been set (either by previous calls to visit(), or by setStartTime()), the default is to adapt the start time to the minimum of the previous start time and this tape's start time. All added messages are then reindexed to adapt their relative time.

Parameters
[in]iTapeThe tape to visit
[in]firstThe first offset relative to the start of recording (Where to start our visit)
[in]lastThe last offset relative to the start of recording (Where to end our visit)
[in]ignoreStartTimeIgnore the start time of this tape when re-indexing. Ignoring ALL visited tapes' start times and never setting any common start time will result in invalid start time and messages from different tapes not being ordered properly.
void visit ( Tape iTape,
const std::vector< std::string > &  channels,
Duration  first = Duration::negativeInfinity(),
Duration  last = Duration::infinity(),
bool  ignoreStartTime = false 
)

Same as above, but additionally select which channels to visit.

Parameters
[in]iTapeThe tape to visit
[in]channelsThe list of channels to visit
[in]firstThe first offset relative to the start of recording (Where to start our visit)
[in]lastThe last offset relative to the start of recording (Where to end our visit)
[in]ignoreStartTimeIgnore the start time of this tape when re-indexing. See above.
Time getStartTime ( ) const
inline

Get the common start time of the visit for all tapes.

Returns
Start time or invalid time if no tapes visited
void setStartTime ( const Time start)
inline

Set the common start time of the visit for all tapes.

Duration getFirstMessageTimeOffset ( ) const
inline

Get the time offset of the first visited message.

Returns
first message time or 0 if no tapes visited
Duration getLastMessageTimeOffset ( ) const
inline

Get the time offset of the last visited message.

Returns
last message time or 0 if no tapes visited
uint32 getMessageCount ( ) const
inline

Get the number of messages to visit.

Returns
Number of messages
iterator begin ( )
inline

Iterator to the first visited message in a tape.

Returns
Iterator to the first message to visit
iterator at ( Duration  timeOffset)
inline

Iterator to the message at the given offset since start of tape.

Parameters
[in]timeOffsetThe offset of the message
Returns
Iterator to the message closest to the given time offset
iterator end ( )
inline

Iterator to the end of visited messages.

Returns
Iterator to the end of the messages
iterator findNextOf ( Duration  startOffset,
const std::string &  channel 
)
inline

Returns the iterator to the next message from given channel with a time offset of at least startOffset, or end iterator if no more messages of that channel exist in the tape.

iterator findNextOf ( const iterator start,
const std::string &  channel 
)
inline

Returns the iterator to the next message from given channel, starting at the given start iterator, or end iterator if no more messages of that channel exist in the tape.

iterator findNextOfAnyOf ( Duration  startOffset,
const std::vector< std::string > &  channels 
)
inline

Returns the iterator to the next message from any of the given channels with a time offset of at least startOffset, or end iterator if no more messages of those channels exist in the tape.

iterator findNextOfAnyOf ( const iterator start,
const std::vector< std::string > &  channels 
)
inline

Returns the iterator to the next message from any of the given channels, starting at the given start iterator, or end iterator if no more messages of those channels exist in the tape.

const ChannelMap& getChannels ( ) const
inline

Get a list of the visited channels.

Returns
The visited channels
void addChannel ( Tape tape,
const Tape::ChannelInfo channel,
Duration  first = Duration::nanoseconds(0),
Duration  last = Duration::infinity() 
)
protected
void reIndex ( Tape tape,
bool  ignoreStartTime = false 
)
protected

Friends And Related Function Documentation

friend class iterator
friend

Member Data Documentation

boost::optional<Time> mStart
protected
MessageMap mMessages
protected
ChannelMap mChannels
protected

The documentation for this class was generated from the following file: