dtGame::LogStream Class Reference

This is an interface class to a stream used by the ServerLoggerComponent to stream data to and from a log file. More...

#include <logstream.h>

Inheritance diagram for dtGame::LogStream:

dtGame::BinaryLogStream

List of all members.

Public Member Functions

 LogStream (MessageFactory &msgFactory)
 Constructs the logging stream.
virtual void Create (const std::string &logsPath, const std::string &logResourceName)=0
 Implementations should create the necessary resources to support log streaming.
virtual void Close ()=0
 Implementations should cleanup any used resources and close the log stream.
virtual void Open (const std::string &logsPath, const std::string &logResourceName)=0
 Opens a log resource for reading.
virtual void Delete (const std::string &logsPath, const std::string &logResourceName)=0
 Deletes the specified log resource.
virtual void WriteMessage (const Message &msg, double timeStamp)=0
 Writes a game message to the stream.
virtual dtCore::RefPtr< MessageReadMessage (double &timeStamp)=0
 Reads a game message from the current stream.
virtual void InsertTag (LogTag &newTag)=0
 Creates and inserts a new tag into the current log stream.
virtual void InsertKeyFrame (LogKeyframe &newKeyFrame)=0
 Creates and inserts a new keyframe into the current log stream.
virtual void JumpToKeyFrame (const LogKeyframe &keyFrame)=0
 Implementations of this method should adjust the current stream such that the next call to ReadMessage() returns the first message corresponding to the requested keyframe.
virtual void GetTagIndex (std::vector< LogTag > &tags)=0
 Gets the list of tags contained within the log stream.
virtual void GetKeyFrameIndex (std::vector< LogKeyframe > &keyFrames)=0
 Gets the list of keyframes contained within the log stream.
virtual void GetAvailableLogs (const std::string &logsPath, std::vector< std::string > &logs)=0
 Gets a list of the current logs available to the log stream by searching the specified directory.
virtual void Flush ()=0
 This method should flush the stream, thereby writing any cached data the stream might contain.
virtual bool IsEndOfStream () const
 
Returns:
True if the end of the log stream has been reached.

virtual double GetRecordDuration () const
 Gets the amount of recorded simulation time contained within this log stream.
virtual void SetRecordDuration (double value)
 Sets the record duration reflected by this log stream.
MessageFactoryGetMessageFactory ()
 Gets a reference to this stream's message factory.

Protected Member Functions

virtual ~LogStream ()
 Empty Destructor...

Protected Attributes

bool mEndOfStream
bool mIsOpen


Detailed Description

This is an interface class to a stream used by the ServerLoggerComponent to stream data to and from a log file.

It can be extended to support any log file format desired. In addition to streaming, this interface supports methods that provide an abstract look at a log thereby allowing any custom log formats to plug in to the existing system.

Note:
There are no return values for errors. Implementations of this interface should throw exceptions when an error occurs.

There may not be a one to one mapping between a LogStream instance and a physical file.

See also:
BinaryLogStream

Constructor & Destructor Documentation

dtGame::LogStream::LogStream ( MessageFactory msgFactory  )  [inline]

Constructs the logging stream.

Parameters:
msgFactory This is the message factory assigned to the log stream. This factory is used to re-create that have been read from the log stream.

virtual dtGame::LogStream::~LogStream (  )  [inline, protected, virtual]

Empty Destructor...


Member Function Documentation

virtual void dtGame::LogStream::Create ( const std::string &  logsPath,
const std::string &  logResourceName 
) [pure virtual]

Implementations should create the necessary resources to support log streaming.

Parameters:
logResourceName The base name of the new log resource. Implementations should use this in some form in their naming conventions for log files.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::Close (  )  [pure virtual]

Implementations should cleanup any used resources and close the log stream.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::Open ( const std::string &  logsPath,
const std::string &  logResourceName 
) [pure virtual]

Opens a log resource for reading.

Parameters:
logResourceName The base name of the new log resource. Implementations should use this in some form in their naming conventions for log files.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::Delete ( const std::string &  logsPath,
const std::string &  logResourceName 
) [pure virtual]

Deletes the specified log resource.

Parameters:
logsPath The absolute path containing the logs.
logResourceName The base name of the log resource to destroy. Implementation should use this in some form in their naming conventions for log files.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::WriteMessage ( const Message msg,
double  timeStamp 
) [pure virtual]

Writes a game message to the stream.

Parameters:
msg The message to write.
timeStamp The time stamp matched to this message.

Implemented in dtGame::BinaryLogStream.

virtual dtCore::RefPtr<Message> dtGame::LogStream::ReadMessage ( double &  timeStamp  )  [pure virtual]

Reads a game message from the current stream.

Parameters:
This parameter will contain the time stamp of the read message.
Returns:
The next game message in the stream.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::InsertTag ( LogTag newTag  )  [pure virtual]

Creates and inserts a new tag into the current log stream.

Parameters:
newTag The new tag to insert.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::InsertKeyFrame ( LogKeyframe newKeyFrame  )  [pure virtual]

Creates and inserts a new keyframe into the current log stream.

Parameters:
newKeyFrame The new keyframe to insert.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::JumpToKeyFrame ( const LogKeyframe keyFrame  )  [pure virtual]

Implementations of this method should adjust the current stream such that the next call to ReadMessage() returns the first message corresponding to the requested keyframe.

Parameters:
keyFrame The keyframe to go to.
Note:
If the requested keyframe is not known to the stream an exception should be thrown.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::GetTagIndex ( std::vector< LogTag > &  tags  )  [pure virtual]

Gets the list of tags contained within the log stream.

Parameters:
tags This vector is filled with the tags currently in the log stream.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::GetKeyFrameIndex ( std::vector< LogKeyframe > &  keyFrames  )  [pure virtual]

Gets the list of keyframes contained within the log stream.

Parameters:
keyFrames This vector is filled with the tags currently in the log stream.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::GetAvailableLogs ( const std::string &  logsPath,
std::vector< std::string > &  logs 
) [pure virtual]

Gets a list of the current logs available to the log stream by searching the specified directory.

Parameters:
logsPath An absolute path to the directory containing the available logs.
logs Filled with the available logs.

Implemented in dtGame::BinaryLogStream.

virtual void dtGame::LogStream::Flush (  )  [pure virtual]

This method should flush the stream, thereby writing any cached data the stream might contain.

Implemented in dtGame::BinaryLogStream.

virtual bool dtGame::LogStream::IsEndOfStream (  )  const [inline, virtual]

Returns:
True if the end of the log stream has been reached.

virtual double dtGame::LogStream::GetRecordDuration (  )  const [inline, virtual]

Gets the amount of recorded simulation time contained within this log stream.

Returns:
The total record time.

virtual void dtGame::LogStream::SetRecordDuration ( double  value  )  [inline, virtual]

Sets the record duration reflected by this log stream.

Parameters:
value The record duration.

MessageFactory& dtGame::LogStream::GetMessageFactory (  )  [inline]

Gets a reference to this stream's message factory.

Returns:
The message factory assigned to this stream.


Member Data Documentation

bool dtGame::LogStream::mEndOfStream [protected]

bool dtGame::LogStream::mIsOpen [protected]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008