Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
MessageStream Class Reference

#include <MessageStream.h>

Inherits GameMessageList.

Classes

struct  TranslatorData
 

Public Member Functions

 MessageStream (void)
 
virtual ~MessageStream ()
 
virtual void init (void)
 
virtual void reset (void)
 
virtual void update (void)
 
virtual GameMessageappendMessage (GameMessage::Type type)
 Append a message to the end of the stream.
 
virtual GameMessageinsertMessage (GameMessage::Type type, GameMessage *messageToInsertAfter)
 
void propagateMessages (void)
 Propagate messages through attached translators.
 
TranslatorID attachTranslator (GameMessageTranslator *translator, UnsignedInt priority)
 
GameMessageTranslatorfindTranslator (TranslatorID id)
 
void removeTranslator (TranslatorID)
 Remove a previously attached translator.
 
- Public Member Functions inherited from GameMessageList
 GameMessageList (void)
 
virtual ~GameMessageList ()
 
GameMessagegetFirstMessage (void)
 Update system.
 
virtual void appendMessage (GameMessage *msg)
 Add message to end of the list.
 
virtual void insertMessage (GameMessage *msg, GameMessage *messageToInsertAfter)
 
virtual void removeMessage (GameMessage *msg)
 Remove message from the list.
 
virtual Bool containsMessageOfType (GameMessage::Type type)
 Return true if a message of type is in the message stream.
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 

Protected Attributes

TranslatorDatam_firstTranslator
 List of registered translators, in order of priority.
 
TranslatorDatam_lastTranslator
 
TranslatorID m_nextTranslatorID
 For issuing unique translator ID's.
 
- Protected Attributes inherited from GameMessageList
GameMessagem_firstMessage
 The first message on the list.
 
GameMessagem_lastMessage
 The last message on the list.
 
- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

A MessageStream contains an ordered list of messages which can have one or more prioritized message handler functions ("translators") attached to it.

Definition at line 736 of file MessageStream.h.

Constructor & Destructor Documentation

◆ MessageStream()

MessageStream::MessageStream ( void )

Constructor

Definition at line 807 of file MessageStream.cpp.

◆ ~MessageStream()

MessageStream::~MessageStream ( )
virtual

Destructor

Definition at line 816 of file MessageStream.cpp.

Member Function Documentation

◆ appendMessage()

GameMessage * MessageStream::appendMessage ( GameMessage::Type type)
virtual

Append a message to the end of the stream.

Create a new message of the given message type and append it to this message stream. Return the message such that any data associated with this message can be attached to it.

Definition at line 864 of file MessageStream.cpp.

◆ attachTranslator()

TranslatorID MessageStream::attachTranslator ( GameMessageTranslator * translator,
UnsignedInt priority )

Attach a translator function to the stream at a priority value. Lower priorities are executed first. Note that MessageStream assumes ownership of the translator, and is responsible for freeing it!

Attach the given Translator to the message stream, and return a unique TranslatorID identifying it. Translators are placed on a list, sorted by priority order. If two Translators share a priority, they are kept in the same order they were attached.

Definition at line 894 of file MessageStream.cpp.

◆ findTranslator()

GameMessageTranslator * MessageStream::findTranslator ( TranslatorID id)

Find a translator attached to this message stream given the ID

Definition at line 954 of file MessageStream.cpp.

◆ init()

void MessageStream::init ( void )
virtual

Init

Reimplemented from GameMessageList.

Definition at line 830 of file MessageStream.cpp.

◆ insertMessage()

GameMessage * MessageStream::insertMessage ( GameMessage::Type type,
GameMessage * messageToInsertAfter )
virtual

Create a new message of the given message type and insert it in the stream after messageToInsertAfter, which must not be NULL.

Definition at line 878 of file MessageStream.cpp.

◆ propagateMessages()

void MessageStream::propagateMessages ( void )

Propagate messages through attached translators.

Propagate messages thru attached Translators, invoking each Translator's callback for each message in the stream. Once all Translators have evaluated the message stream, all messages in the stream are destroyed.

Definition at line 1078 of file MessageStream.cpp.

◆ removeTranslator()

void MessageStream::removeTranslator ( TranslatorID id)

Remove a previously attached translator.

Remove a previously attached translator.

Definition at line 973 of file MessageStream.cpp.

◆ reset()

void MessageStream::reset ( void )
virtual

Reset

Todo
Reset the MessageStream

Reimplemented from GameMessageList.

Definition at line 839 of file MessageStream.cpp.

◆ update()

void MessageStream::update ( void )
virtual

Update

Reimplemented from GameMessageList.

Definition at line 852 of file MessageStream.cpp.

Member Data Documentation

◆ m_firstTranslator

TranslatorData* MessageStream::m_firstTranslator
protected

List of registered translators, in order of priority.

Definition at line 782 of file MessageStream.h.

◆ m_lastTranslator

TranslatorData* MessageStream::m_lastTranslator
protected

Definition at line 783 of file MessageStream.h.

◆ m_nextTranslatorID

TranslatorID MessageStream::m_nextTranslatorID
protected

For issuing unique translator ID's.

Definition at line 784 of file MessageStream.h.


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