TrueReality  v0.1.1912
trManager::MessageBase Class Referenceabstract

This is the base class for all the messages in TR. More...

#include <MessageBase.h>

Inheritance diagram for trManager::MessageBase:
Collaboration diagram for trManager::MessageBase:

Public Types

using BaseClass = trBase::SmrtClass
 
- Public Types inherited from trBase::SmrtClass
using BaseClass = osg::Referenced
 

Public Member Functions

 MessageBase (const trBase::UniqueId *fromActorID, const trBase::UniqueId *aboutActorID=NULL, const bool isDirect=false, const std::string &messageFilter=trUtil::StringUtils::STR_BLANK)
 Holds the class/message type name for efficient comparisons. More...
 
bool operator== (const MessageBase &msg) const
 
bool operator!= (const MessageBase &msg) const
 
virtual const std::string & GetMessageType () const =0
 Returns the Message type. More...
 
virtual const trBase::UniqueIdGetFromActorID () const
 Returns the ID of the actor the message was sent from. More...
 
virtual const trBase::UniqueIdGetAboutActorID () const
 Returns the ID of the actor this message is about, or sent to. More...
 
virtual const bool & GetIsDirect () const
 Returns True if this message is a direct message and skips all Directors. More...
 
virtual const std::string & GetMessageFilter ()
 Returns the custom Filter string. More...
 
- Public Member Functions inherited from trBase::SmrtClass
 SmrtClass ()
 Adds an easy and swappable access to the base class. More...
 
 SmrtClass (bool threadSafeRefUnref)
 Constructor. More...
 
 SmrtClass (const SmrtClass &inst)
 Copy constructor. More...
 
virtual bool GetThreadSafeRefUnref ()
 Get whether a mutex is used to ensure Ref() and UnRef() are thread safe. More...
 
OpenThreads::Mutex * GetRefMutex () const
 Get the mutex used to ensure thread safety of Ref()/UnRef(). More...
 
int Ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int Unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int UnRefNoDelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int ReferenceCount () const
 Return the number of pointers currently referencing this object. More...
 

Static Public Attributes

static const trUtil::RefStr MESSAGE_TYPE
 Adds an easy and swappable access to the base class. More...
 

Protected Member Functions

 ~MessageBase ()
 dtor. More...
 
virtual const std::string & GetType () const override
 Returns the class type Made protected to hide it. More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Private Attributes

trBase::ObsrvrPtr< const trBase::UniqueIdmFromActorID
 
trBase::ObsrvrPtr< const trBase::UniqueIdmAboutActorID
 
bool mIsDirect
 
const std::string * mMessageFilter
 
trBase::UniqueId mId
 

Additional Inherited Members

- Static Public Member Functions inherited from trBase::SmrtClass
static OpenThreads::Mutex * GetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all trBase::SmrtClass. More...
 

Detailed Description

This is the base class for all the messages in TR.

It is immutable, and all messages derived from it should keep that tradition.

Definition at line 40 of file MessageBase.h.

Member Typedef Documentation

◆ BaseClass

Constructor & Destructor Documentation

◆ MessageBase()

trManager::MessageBase::MessageBase ( const trBase::UniqueId fromActorID,
const trBase::UniqueId aboutActorID = NULL,
const bool  isDirect = false,
const std::string &  messageFilter = trUtil::StringUtils::STR_BLANK 
)

Holds the class/message type name for efficient comparisons.

ctor.

Parameters
fromActorIDId of the actor this message is being sent from.
aboutActorID(Optional) Id of the actor this message is being sent to, or is about.
isDirect(Optional) If TRUE, this message will skip all the Directors.
messageFilter(Optional) A custom filter for developer use.

Definition at line 32 of file MessageBase.cpp.

References LOG_D, mAboutActorID, mFromActorID, mId, mIsDirect, mMessageFilter, and trBase::UniqueId::ToString().

Here is the call graph for this function:

◆ ~MessageBase()

trManager::MessageBase::~MessageBase ( )
protected

dtor.

Definition at line 42 of file MessageBase.cpp.

References LOG_D, mId, and trBase::UniqueId::ToString().

Here is the call graph for this function:

Member Function Documentation

◆ GetAboutActorID()

const trBase::UniqueId * trManager::MessageBase::GetAboutActorID ( ) const
virtual

Returns the ID of the actor this message is about, or sent to.

This ID can be empty if the message is not directed toward a specific Actor.

Returns
Null if it fails, else the about actor identifier.

Definition at line 79 of file MessageBase.cpp.

References mAboutActorID.

Referenced by trManager::SystemManager::SendMessageToListeners().

Here is the caller graph for this function:

◆ GetFromActorID()

const trBase::UniqueId * trManager::MessageBase::GetFromActorID ( ) const
virtual

Returns the ID of the actor the message was sent from.

The ID should never be empty.

Returns
Null if it fails, else the data that was read from the actor identifier.

Definition at line 73 of file MessageBase.cpp.

References mFromActorID.

Referenced by trManager::SystemManager::SendMessageToActors(), trManager::SystemManager::SendMessageToDirectors(), and trManager::SystemManager::SendMessageToListeners().

Here is the caller graph for this function:

◆ GetIsDirect()

const bool & trManager::MessageBase::GetIsDirect ( ) const
virtual

Returns True if this message is a direct message and skips all Directors.

Returns
The is direct.

Definition at line 85 of file MessageBase.cpp.

References mIsDirect.

Referenced by trManager::SystemManager::SendMessageToDirectors().

Here is the caller graph for this function:

◆ GetMessageFilter()

const std::string & trManager::MessageBase::GetMessageFilter ( )
virtual

Returns the custom Filter string.

Returns
The message filter.

Definition at line 91 of file MessageBase.cpp.

References mMessageFilter.

◆ GetMessageType()

◆ GetType()

const std::string & trManager::MessageBase::GetType ( ) const
overrideprotectedvirtual

Returns the class type Made protected to hide it.

Returns
The type.

Implements trBase::SmrtClass.

Definition at line 67 of file MessageBase.cpp.

References MESSAGE_TYPE.

◆ operator!=()

bool trManager::MessageBase::operator!= ( const MessageBase msg) const
inline

Definition at line 61 of file MessageBase.h.

◆ operator==()

bool trManager::MessageBase::operator== ( const MessageBase msg) const

Definition at line 48 of file MessageBase.cpp.

References mAboutActorID, mFromActorID, mIsDirect, and mMessageFilter.

Member Data Documentation

◆ mAboutActorID

trBase::ObsrvrPtr<const trBase::UniqueId> trManager::MessageBase::mAboutActorID
private

Definition at line 129 of file MessageBase.h.

Referenced by GetAboutActorID(), MessageBase(), and operator==().

◆ MESSAGE_TYPE

const trUtil::RefStr trManager::MessageBase::MESSAGE_TYPE
static

Adds an easy and swappable access to the base class.

Definition at line 46 of file MessageBase.h.

Referenced by GetType().

◆ mFromActorID

trBase::ObsrvrPtr<const trBase::UniqueId> trManager::MessageBase::mFromActorID
private

Definition at line 129 of file MessageBase.h.

Referenced by GetFromActorID(), MessageBase(), and operator==().

◆ mId

trBase::UniqueId trManager::MessageBase::mId
private

Definition at line 132 of file MessageBase.h.

Referenced by MessageBase(), and ~MessageBase().

◆ mIsDirect

bool trManager::MessageBase::mIsDirect
private

Definition at line 130 of file MessageBase.h.

Referenced by GetIsDirect(), MessageBase(), and operator==().

◆ mMessageFilter

const std::string* trManager::MessageBase::mMessageFilter
private

Definition at line 131 of file MessageBase.h.

Referenced by GetMessageFilter(), MessageBase(), and operator==().


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