Messaging::Port Class Reference
#include <port.h>
Inheritance diagram for Messaging::Port:
Detailed Description
A message port is a receiving point for messages. Messages processed immediately and the port will be blocked until the message has been processed.Messages are processed by message handlers which are attached to the port. More then one message handler can be attached to a port. When a message should be attached, each message handler is called in their attachment order until one of the handlers returns true, which means that the message has been handled.
For an asynchronous port implementation, which runs the message handlers in a separate thread, please check Message::AsyncPort.
(C) 2006 RadonLabs GmbH
Public Member Functions | |
virtual void | SetupAcceptedMessages () |
override to register accepted messages | |
void | AttachHandler (const Ptr< Handler > &h) |
attach a message handler to the port | |
void | RemoveHandler (const Ptr< Handler > &h) |
remove a message handler from the port | |
void | RemoveAllHandlers () |
remove all message handler from the port | |
SizeT | GetNumHandlers () const |
return number of handlers attached to the port | |
const Ptr< Handler > & | GetHandlerAtIndex (IndexT i) const |
get a message handler by index | |
virtual void | Send (const Ptr< Message > &msg) |
send a message to the port | |
const Util::Array< const Id * > & | GetAcceptedMessages () const |
get the array of accepted messages (sorted) | |
bool | AcceptsMessage (const Id &msgId) const |
return true if port accepts this msg | |
virtual void | HandleMessage (const Ptr< Messaging::Message > &msg) |
handle a single accepted message | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Static Public Member Functions | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!) | |
Protected Member Functions | |
void | RegisterMessage (const Id &msgId) |
register a single accepted message |
Member Function Documentation
attach a message handler to the port
Attach a message handler to the port.
remove a message handler from the port
Remove a message handler from the port.
send a message to the port
Send a message to the port. This will immediately call the HandleMessage() method of all attached handlers. If the message has been handled by at least one of the handlers, the Handled() flag of the message will be set to true.
void Messaging::Port::HandleMessage | ( | const Ptr< Messaging::Message > & | msg | ) | [virtual] |
handle a single accepted message
Handle a specific message. Overwrite this method in a subclass. It is guaranteed that this method will only be called for messages which are accepted by AcceptMessage().
Reimplemented in Messaging::Dispatcher, BaseGameFeature::TransformableProperty, Game::Property, GraphicsFeature::ActorGraphicsProperty, GraphicsFeature::AnimationControlProperty, GraphicsFeature::CameraProperty, GraphicsFeature::ChaseCameraProperty, GraphicsFeature::GraphicsProperty, GraphicsFeature::MayaCameraProperty, PhysicsFeature::ActorPhysicsProperty, PhysicsFeature::PhysicsProperty, PhysicsFeature::TriggerProperty, Script::DialogManager, StateObjectFeature::StateGraphicsProperty, and StateObjectFeature::StateProperty.
int Core::RefCounted::GetRefCount | ( | ) | const [inline, inherited] |
get the current refcount
Return the current refcount of the object.
void Core::RefCounted::AddRef | ( | ) | [inline, inherited] |
increment refcount by one
Increment the refcount of the object.
void Core::RefCounted::Release | ( | ) | [inline, inherited] |
decrement refcount and destroy object if refcount is zero
Decrement the refcount and destroy object if refcount is zero.
const Util::String & Core::RefCounted::GetClassName | ( | ) | const [inline, inherited] |
get the class name
Get the class name of the object.
Util::FourCC Core::RefCounted::GetClassFourCC | ( | ) | const [inline, inherited] |
get the class FourCC code
Get the class FourCC of the object.
void Core::RefCounted::DumpRefCountingLeaks | ( | ) | [static, inherited] |
dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)
This method should be called as the very last before an application exits.