TrueReality  v0.1.1912
trManager::SystemManager Class Reference

System Manager class is a singleton that is responsible for all message routing and basic operations between actors and directors throughout TR. More...

#include <SystemManager.h>

Inheritance diagram for trManager::SystemManager:
Collaboration diagram for trManager::SystemManager:

Public Types

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

Public Member Functions

virtual const std::string & GetType () const override
 Returns the class type. More...
 
virtual bool SendMessage (const trManager::MessageBase &message)
 Send a message to an Actor, Actor Module, or a Director. More...
 
virtual bool SendNetworkMessage (const trManager::MessageBase &message)
 Send a Network message to an Actor, Actor Module, or a Director. More...
 
virtual void ProcessMessage (const trManager::MessageBase &message)
 Immediately processes the passed in message. More...
 
virtual void ProcessMessages ()
 Sends out all the messages from the message queue. More...
 
virtual void ProcessNetworkMessages ()
 Sends out all the network messages from the message queue. More...
 
virtual void RegisterForMessage (const std::string &messageType, EntityBase &listeningActor, const std::string &invokableName)
 Registers an actor for messages. More...
 
virtual void UnregisterFromMessage (const std::string &messageType, EntityBase &listeningActor)
 Unregister an actor that is listening for a given message. More...
 
virtual void RegisterForMessagesAboutEntity (EntityBase &listeningEntity, const trBase::UniqueId &aboutEntityId, const std::string &invokableName)
 Registers for messages about a specific actor. More...
 
virtual void UnregisterFromMessagesAboutEntity (EntityBase &listeningEntity, const trBase::UniqueId &aboutEntityId)
 Unregisters from messages about a specific actor. More...
 
virtual bool RegisterActor (trManager::EntityBase &actor)
 Registers an Actor or Actor Module with the System Manager. More...
 
virtual bool UnregisterActor (trManager::EntityBase &actor)
 Disconnects the actor from the System Manager. More...
 
virtual bool UnregisterActor (const trBase::UniqueId &id)
 Disconnects the actor from the System Manager by using the actors ID. More...
 
virtual bool UnregisterAllActors ()
 Unregisters all actors from the System Manager. More...
 
virtual trManager::EntityBaseFindActor (const trBase::UniqueId &id)
 Searches for an actor or actor module with the given ID. More...
 
virtual std::vector< trManager::EntityBase * > FindActorsByType (const std::string &actorType)
 Searches for all actors of a given type. More...
 
virtual std::vector< trManager::EntityBase * > FindActorsByName (const std::string &actorName)
 Searches for all actors by a given name. More...
 
virtual bool RegisterDirector (trManager::EntityBase &director, trManager::DirectorPriority &priority=trManager::DirectorPriority::NORMAL)
 Adds a director to the list of components the system manager will communicate with. More...
 
virtual bool UnregisterDirector (trManager::EntityBase &director)
 Disconnects the director from System Manager. More...
 
virtual bool UnregisterDirector (const trBase::UniqueId &id)
 Disconnects the director from System Manager by using it's ID. More...
 
virtual void UnregisterAllDirectors ()
 Unregisters all the directors from System Manager. More...
 
virtual trManager::EntityBaseFindDirector (const trBase::UniqueId &id) const
 Finds and returns the director with the given ID. More...
 
virtual trManager::EntityBaseFindDirector (const std::string &name) const
 Finds and returns the director with the given Name. More...
 
virtual std::vector< trManager::EntityBase * > FindDirectors (const std::string &type) const
 Finds and returns all the Directors of a given type. More...
 
virtual void RemoveMarkedEntities ()
 Removes all entities that were marked to be unregistered. More...
 
virtual void ShutDown ()
 Shuts down the System Manager and unregisters all entities. More...
 
- Public Member Functions inherited from trBase::Base
 Base (const std::string &name=CLASS_TYPE)
 Holds the class type name for efficient comparisons. More...
 
virtual void SetName (const std::string &name)
 Sets this instances name. More...
 
virtual const std::string & GetName ()
 Returns this instances name. More...
 
virtual const std::string & GetName () const
 Returns this instances name. More...
 
virtual void SetUUID (const trBase::UniqueId &id)
 Overwrites the default internal UUID with the passed in one. More...
 
virtual const trBase::UniqueIdGetUUID (void)
 Returns the instances Universally Unique ID. 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 Member Functions

static trManager::SystemManagerGetInstance ()
 Holds the class type name for efficient comparisons. More...
 
- 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...
 

Static Public Attributes

static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trManager::SystemManager")
 Adds an easy and swappable access to the base class. More...
 
- Static Public Attributes inherited from trBase::Base
static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trBase::Base")
 Adds an easy and swappable access to the base class. More...
 

Protected Member Functions

 SystemManager (const std::string name=CLASS_TYPE)
 Ctor. More...
 
 ~SystemManager ()
 Dtor. More...
 
virtual void SendMessageToDirectors (const trManager::MessageBase &message)
 Send the passed in message to all registered Directors. More...
 
virtual void SendMessageToActors (const trManager::MessageBase &message)
 Sends the passed in message to appropriate actors. More...
 
virtual void SendMessageToListeners (const trManager::MessageBase &message)
 Sends a message to entities that are listening for messages about other actors. More...
 
virtual void SendGlobalyRegisteredMessage (const trManager::MessageBase &message)
 Sends out a message to all entities who had a global registration for it. More...
 
virtual void CallInvokable (const trManager::MessageBase &message, const std::string &invokableName, trManager::EntityBase &entity)
 Utility function. More...
 
virtual void UnregisterActorFromGlobalMessages (trManager::EntityBase &actor)
 Unregisters the actor/actor module from all messages that have registrations. More...
 
virtual void UnregisterDirectorFromGlobalMessages (trManager::EntityBase &director)
 Unregisters the director from all messages that have registrations. More...
 
virtual void UnregisterEntityFromAboutMessages (trManager::EntityBase &listeningEntity)
 Unregisters the entity from about messages about another actor. More...
 
- Protected Member Functions inherited from trBase::Base
 ~Base ()
 Base destructor. More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Private Types

using DirectorList = std::list< trBase::SmrtPtr< trManager::EntityBase > >
 
using DirectorNameMap = trUtil::HashMap< std::string, trBase::SmrtPtr< trManager::EntityBase > >
 
using DirectorIDMap = trUtil::HashMap< trBase::UniqueId, trBase::SmrtPtr< trManager::EntityBase > >
 
using EntityInvokablePair = std::pair< trBase::SmrtPtr< trManager::EntityBase >, std::string >
 
using MessageRegistrationVectorMap = trUtil::HashMap< std::string *, std::vector< EntityInvokablePair > >
 
using UUIDRegistrationVectorMap = trUtil::HashMap< trBase::UniqueId, std::vector< EntityInvokablePair > >
 
using EntityInvokableMap = trUtil::HashMap< trBase::SmrtPtr< trManager::EntityBase >, std::string >
 
using MessageRegistrationMap = trUtil::HashMap< std::string *, EntityInvokableMap >
 
using ActorList = std::vector< trBase::SmrtPtr< trManager::EntityBase > >
 
using ActorIDMap = trUtil::HashMap< trBase::UniqueId, trBase::SmrtPtr< trManager::EntityBase > >
 

Private Member Functions

void RegisterMsgWithMsgVectorMap (const std::string &messageType, EntityBase &listeningEntity, const std::string &invokableName, MessageRegistrationVectorMap &messageMap)
 Registers the message with a given message map. More...
 
void UnregisterMsgFromMsgVectorMap (const std::string &messageType, EntityBase &listeningEntity, MessageRegistrationVectorMap &messageMap)
 Un register message from a given message map. More...
 
void RegisterMsgWithMsgMap (const std::string &messageType, EntityBase &listeningEntity, const std::string &invokableName, MessageRegistrationMap &messageMap)
 Registers the message with message map. More...
 
void UnregisterMsgFromMsgMap (const std::string &messageType, EntityBase &listeningEntity, MessageRegistrationMap &messageMap)
 Un register message from message map. More...
 

Private Attributes

std::queue< trBase::SmrtPtr< const trManager::MessageBase > > mMessageQueue
 
std::queue< trBase::SmrtPtr< const trManager::MessageBase > > mNetworkMessageQueue
 
DirectorList mDirectorList
 
DirectorNameMap mDirectorNameMap
 
DirectorIDMap mDirectorIDMap
 
MessageRegistrationVectorMap mEntityGlobalMsgRegistrationMap
 
MessageRegistrationMap mDirectorGlobalMsgRegistrationMap
 
UUIDRegistrationVectorMap mListenerRegistrationMap
 
ActorList mActorList
 
ActorIDMap mActorIDMap
 
std::vector< trBase::SmrtPtr< trManager::EntityBase > > mEntityDeleteList
 

Static Private Attributes

static trBase::SmrtPtr< trManager::SystemManagermInstance = nullptr
 

Detailed Description

System Manager class is a singleton that is responsible for all message routing and basic operations between actors and directors throughout TR.

Definition at line 46 of file SystemManager.h.

Member Typedef Documentation

◆ ActorIDMap

◆ ActorList

Definition at line 448 of file SystemManager.h.

◆ BaseClass

◆ DirectorIDMap

◆ DirectorList

Definition at line 430 of file SystemManager.h.

◆ DirectorNameMap

◆ EntityInvokableMap

◆ EntityInvokablePair

Definition at line 438 of file SystemManager.h.

◆ MessageRegistrationMap

◆ MessageRegistrationVectorMap

Definition at line 439 of file SystemManager.h.

◆ UUIDRegistrationVectorMap

Constructor & Destructor Documentation

◆ SystemManager()

trManager::SystemManager::SystemManager ( const std::string  name = CLASS_TYPE)
protected

Ctor.

Parameters
name(Optional) The name.

Definition at line 45 of file SystemManager.cpp.

Referenced by GetInstance().

Here is the caller graph for this function:

◆ ~SystemManager()

trManager::SystemManager::~SystemManager ( )
protected

Dtor.

Definition at line 50 of file SystemManager.cpp.

Member Function Documentation

◆ CallInvokable()

void trManager::SystemManager::CallInvokable ( const trManager::MessageBase message,
const std::string &  invokableName,
trManager::EntityBase entity 
)
protectedvirtual

Utility function.

Calls the passed in Invokable on the passed in EntityBase.

Parameters
messageThe message to pass to the Invokable.
invokableNameName of the invokable.
[in,out]entityThe EntityBase on which to call the Invokable.

Definition at line 492 of file SystemManager.cpp.

References trManager::EntityBase::GetInvokable(), trBase::Base::GetName(), trManager::Invokable::GetName(), trManager::Invokable::Invoke(), LOG_D, and LOG_E.

Referenced by SendMessageToActors(), SendMessageToDirectors(), and SendMessageToListeners().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindActor()

trManager::EntityBase * trManager::SystemManager::FindActor ( const trBase::UniqueId id)
virtual

Searches for an actor or actor module with the given ID.

Parameters
idThe unique identifier.
Returns
Null if it fails, else the found actor.

Definition at line 306 of file SystemManager.cpp.

References mActorIDMap.

Referenced by RegisterActor(), and UnregisterActor().

Here is the caller graph for this function:

◆ FindActorsByName()

std::vector< trManager::EntityBase * > trManager::SystemManager::FindActorsByName ( const std::string &  actorName)
virtual

Searches for all actors by a given name.

WARNING: This function is slow.

Parameters
actorNameName of the actor.
Returns
Empty vector if it fails, else a vector of found actors.

Definition at line 340 of file SystemManager.cpp.

References trManager::EntityType::ACTOR, and mActorList.

◆ FindActorsByType()

std::vector< trManager::EntityBase * > trManager::SystemManager::FindActorsByType ( const std::string &  actorType)
virtual

Searches for all actors of a given type.

WARNING: This functions is slow.

Parameters
actorTypeType of the actor.
Returns
Empty vector if it fails, else a vector of found actors.

Definition at line 321 of file SystemManager.cpp.

References trManager::EntityType::ACTOR, and mActorList.

◆ FindDirector() [1/2]

trManager::EntityBase * trManager::SystemManager::FindDirector ( const trBase::UniqueId id) const
virtual

Finds and returns the director with the given ID.

Parameters
idThe identifier.
Returns
Null if it fails, else the found director.

Definition at line 842 of file SystemManager.cpp.

References mDirectorIDMap.

Referenced by RegisterDirector(), and UnregisterDirector().

Here is the caller graph for this function:

◆ FindDirector() [2/2]

trManager::EntityBase * trManager::SystemManager::FindDirector ( const std::string &  name) const
virtual

Finds and returns the director with the given Name.

The Directors name is unique, so only one Director with the right name can exist.

Parameters
nameThe name.
Returns
Null if it fails, else the found director.

Definition at line 857 of file SystemManager.cpp.

References mDirectorNameMap.

◆ FindDirectors()

std::vector< trManager::EntityBase * > trManager::SystemManager::FindDirectors ( const std::string &  type) const
virtual

Finds and returns all the Directors of a given type.

WARNING: This function is slow.

Parameters
typeThe type.
Returns
Null if it fails, else the found directors.

Definition at line 872 of file SystemManager.cpp.

References mDirectorList.

◆ GetInstance()

trManager::SystemManager & trManager::SystemManager::GetInstance ( )
static

Holds the class type name for efficient comparisons.

Returns the Instance of the System Manager Singleton.

Returns
The instance.

Definition at line 55 of file SystemManager.cpp.

References mInstance, SystemManager(), and trBase::SmrtPtr< T >::Valid().

Referenced by trApp::AppBase::AppBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetType()

const std::string & trManager::SystemManager::GetType ( ) const
overridevirtual

Returns the class type.

Returns
The type.

Implements trBase::Base.

Definition at line 65 of file SystemManager.cpp.

References CLASS_TYPE.

◆ ProcessMessage()

void trManager::SystemManager::ProcessMessage ( const trManager::MessageBase message)
virtual

Immediately processes the passed in message.

Usually used to manipulate the system flow.

Parameters
messageThe message.

Definition at line 85 of file SystemManager.cpp.

References SendMessageToActors(), SendMessageToDirectors(), and SendMessageToListeners().

Referenced by ProcessMessages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessMessages()

void trManager::SystemManager::ProcessMessages ( )
virtual

Sends out all the messages from the message queue.

This is for system use only.

Definition at line 98 of file SystemManager.cpp.

References mMessageQueue, and ProcessMessage().

Referenced by ShutDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessNetworkMessages()

void trManager::SystemManager::ProcessNetworkMessages ( )
virtual

Sends out all the network messages from the message queue.

This is for system use only.

Definition at line 111 of file SystemManager.cpp.

References mNetworkMessageQueue, and SendMessageToDirectors().

Here is the call graph for this function:

◆ RegisterActor()

bool trManager::SystemManager::RegisterActor ( trManager::EntityBase actor)
virtual

Registers an Actor or Actor Module with the System Manager.

Parameters
[in,out]actorThe actor.
Returns
True if it succeeds, false if it fails.

Definition at line 220 of file SystemManager.cpp.

References FindActor(), trBase::Base::GetName(), trManager::EntityBase::GetType(), trBase::Base::GetUUID(), LOG_D, LOG_E, mActorIDMap, mActorList, trManager::EntityBase::OnAddedToSysMan(), SendMessage(), trManager::EntityBase::SetRegistration(), and trManager::EntityBase::SetSystemManager().

Here is the call graph for this function:

◆ RegisterDirector()

bool trManager::SystemManager::RegisterDirector ( trManager::EntityBase director,
trManager::DirectorPriority priority = trManager::DirectorPriority::NORMAL 
)
virtual

Adds a director to the list of components the system manager will communicate with.

Exceptions
trUtil::InvalidParameterExceptionif the director lacks a unique name.
Parameters
[in,out]directorThe director to add.
[in,out]priority(Optional) The priority of the director. This translates into the order of message delivery.
Returns
True if it succeeds, false if it fails.

Definition at line 733 of file SystemManager.cpp.

References trManager::DirectorBase::CompareComponentPriority(), trManager::EntityType::DIRECTOR, FindDirector(), trManager::EntityBase::GetEntityType(), trBase::Base::GetName(), trManager::EntityBase::GetType(), trBase::Base::GetUUID(), LOG_D, LOG_E, mDirectorIDMap, mDirectorList, mDirectorNameMap, trManager::EntityBase::OnAddedToSysMan(), SendMessage(), trManager::EntityBase::SetRegistration(), and trManager::EntityBase::SetSystemManager().

Referenced by trApp::AppBase::AppBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterForMessage()

void trManager::SystemManager::RegisterForMessage ( const std::string &  messageType,
EntityBase listeningActor,
const std::string &  invokableName 
)
virtual

Registers an actor for messages.

Parameters
messageTypeType of the message.
[in,out]listeningActorThe Listening actor that will receive the message.
invokableNameName of the invokable that the message will be routed to.

Definition at line 125 of file SystemManager.cpp.

References trManager::EntityType::ACTOR, trManager::EntityType::ACTOR_MODULE, trManager::EntityType::DIRECTOR, trManager::EntityBase::GetEntityType(), mDirectorGlobalMsgRegistrationMap, mEntityGlobalMsgRegistrationMap, RegisterMsgWithMsgMap(), and RegisterMsgWithMsgVectorMap().

Here is the call graph for this function:

◆ RegisterForMessagesAboutEntity()

void trManager::SystemManager::RegisterForMessagesAboutEntity ( EntityBase listeningEntity,
const trBase::UniqueId aboutEntityId,
const std::string &  invokableName 
)
virtual

Registers for messages about a specific actor.

Parameters
[in,out]listeningEntityThe Listening entity that will receive the message.
aboutEntityIdIdentifier for the about entity.
invokableNameName of the invokable.

Definition at line 161 of file SystemManager.cpp.

References trBase::Base::GetName(), LOG_D, LOG_W, and mListenerRegistrationMap.

Here is the call graph for this function:

◆ RegisterMsgWithMsgMap()

void trManager::SystemManager::RegisterMsgWithMsgMap ( const std::string &  messageType,
EntityBase listeningEntity,
const std::string &  invokableName,
MessageRegistrationMap messageMap 
)
private

Registers the message with message map.

Parameters
messageTypeType of the message.
[in,out]listeningEntityThe listening entity.
invokableNameName of the invokable.
[in,out]messageMapThe message map.

Definition at line 676 of file SystemManager.cpp.

References LOG_D, and LOG_W.

Referenced by RegisterForMessage().

Here is the caller graph for this function:

◆ RegisterMsgWithMsgVectorMap()

void trManager::SystemManager::RegisterMsgWithMsgVectorMap ( const std::string &  messageType,
EntityBase listeningEntity,
const std::string &  invokableName,
MessageRegistrationVectorMap messageMap 
)
private

Registers the message with a given message map.

Parameters
messageTypeType of the message.
[in,out]listeningEntityThe listening entity.
invokableNameName of the invokable.
[in,out]messageMapThe message map.

Definition at line 617 of file SystemManager.cpp.

References trBase::Base::GetName(), LOG_D, and LOG_W.

Referenced by RegisterForMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveMarkedEntities()

void trManager::SystemManager::RemoveMarkedEntities ( )
virtual

Removes all entities that were marked to be unregistered.

This is for system use only, and should not be called directly by the user.

Returns
True if it succeeds, false if it fails.

Definition at line 888 of file SystemManager.cpp.

References mEntityDeleteList.

Referenced by ShutDown().

Here is the caller graph for this function:

◆ SendGlobalyRegisteredMessage()

void trManager::SystemManager::SendGlobalyRegisteredMessage ( const trManager::MessageBase message)
protectedvirtual

Sends out a message to all entities who had a global registration for it.

Parameters
messageThe message.

Definition at line 457 of file SystemManager.cpp.

References trManager::EntityBase::GetInvokable(), trManager::MessageBase::GetMessageType(), trManager::Invokable::Invoke(), trManager::EntityBase::IsRegistered(), and mEntityGlobalMsgRegistrationMap.

Here is the call graph for this function:

◆ SendMessage()

bool trManager::SystemManager::SendMessage ( const trManager::MessageBase message)
virtual

Send a message to an Actor, Actor Module, or a Director.

Parameters
messageThe message.
Returns
True if it succeeds, false if it fails.

Definition at line 71 of file SystemManager.cpp.

References mMessageQueue.

Referenced by trApp::AppBase::Quit(), RegisterActor(), RegisterDirector(), UnregisterActor(), and UnregisterDirector().

Here is the caller graph for this function:

◆ SendMessageToActors()

void trManager::SystemManager::SendMessageToActors ( const trManager::MessageBase message)
protectedvirtual

Sends the passed in message to appropriate actors.

Parameters
messageThe message.

Definition at line 410 of file SystemManager.cpp.

References CallInvokable(), trManager::MessageBase::GetFromActorID(), trManager::MessageBase::GetMessageType(), and mEntityGlobalMsgRegistrationMap.

Referenced by ProcessMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendMessageToDirectors()

void trManager::SystemManager::SendMessageToDirectors ( const trManager::MessageBase message)
protectedvirtual

Send the passed in message to all registered Directors.

Parameters
messageThe message.

Definition at line 359 of file SystemManager.cpp.

References CallInvokable(), trManager::MessageBase::GetFromActorID(), trManager::MessageBase::GetIsDirect(), trManager::MessageBase::GetMessageType(), mDirectorGlobalMsgRegistrationMap, mDirectorList, and trManager::EntityBase::ON_MESSAGE_INVOKABLE.

Referenced by ProcessMessage(), and ProcessNetworkMessages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendMessageToListeners()

void trManager::SystemManager::SendMessageToListeners ( const trManager::MessageBase message)
protectedvirtual

Sends a message to entities that are listening for messages about other actors.

Parameters
messageThe message.

Definition at line 432 of file SystemManager.cpp.

References CallInvokable(), trManager::MessageBase::GetAboutActorID(), trManager::MessageBase::GetFromActorID(), and mListenerRegistrationMap.

Referenced by ProcessMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendNetworkMessage()

bool trManager::SystemManager::SendNetworkMessage ( const trManager::MessageBase message)
virtual

Send a Network message to an Actor, Actor Module, or a Director.

Parameters
messageThe message.
Returns
True if it succeeds, false if it fails.

Definition at line 78 of file SystemManager.cpp.

References mNetworkMessageQueue.

◆ ShutDown()

void trManager::SystemManager::ShutDown ( )
virtual

Shuts down the System Manager and unregisters all entities.

Definition at line 901 of file SystemManager.cpp.

References LOG_D, ProcessMessages(), RemoveMarkedEntities(), UnregisterAllActors(), and UnregisterAllDirectors().

Here is the call graph for this function:

◆ UnregisterActor() [1/2]

bool trManager::SystemManager::UnregisterActor ( trManager::EntityBase actor)
virtual

Disconnects the actor from the System Manager.

Parameters
[in,out]actorThe actor.
Returns
True if it succeeds, false if it fails.

Definition at line 252 of file SystemManager.cpp.

References trBase::Base::GetName(), trManager::EntityBase::GetType(), trBase::Base::GetUUID(), LOG_D, LOG_W, mActorIDMap, mActorList, mEntityDeleteList, SendMessage(), UnregisterActorFromGlobalMessages(), and UnregisterEntityFromAboutMessages().

Referenced by UnregisterActor(), and UnregisterAllActors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterActor() [2/2]

bool trManager::SystemManager::UnregisterActor ( const trBase::UniqueId id)
virtual

Disconnects the actor from the System Manager by using the actors ID.

Parameters
idThe identifier.
Returns
True if it succeeds, false if it fails.

Definition at line 290 of file SystemManager.cpp.

References FindActor(), and UnregisterActor().

Here is the call graph for this function:

◆ UnregisterActorFromGlobalMessages()

void trManager::SystemManager::UnregisterActorFromGlobalMessages ( trManager::EntityBase actor)
protectedvirtual

Unregisters the actor/actor module from all messages that have registrations.

Parameters
[in,out]actorThe actor.

Definition at line 509 of file SystemManager.cpp.

References mEntityGlobalMsgRegistrationMap.

Referenced by UnregisterActor().

Here is the caller graph for this function:

◆ UnregisterAllActors()

bool trManager::SystemManager::UnregisterAllActors ( )
virtual

Unregisters all actors from the System Manager.

Returns
True if it succeeds, false if it fails.

Definition at line 296 of file SystemManager.cpp.

References mActorList, and UnregisterActor().

Referenced by ShutDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterAllDirectors()

void trManager::SystemManager::UnregisterAllDirectors ( )
virtual

Unregisters all the directors from System Manager.

Definition at line 833 of file SystemManager.cpp.

References mDirectorList, and UnregisterDirector().

Referenced by ShutDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterDirector() [1/2]

bool trManager::SystemManager::UnregisterDirector ( trManager::EntityBase director)
virtual

Disconnects the director from System Manager.

Parameters
[in,out]directorThe director.
Returns
True if it succeeds, false if it fails.

Definition at line 779 of file SystemManager.cpp.

References trManager::EntityType::DIRECTOR, trManager::EntityBase::GetEntityType(), trBase::Base::GetName(), trManager::EntityBase::GetType(), trBase::Base::GetUUID(), LOG_D, LOG_E, LOG_W, mDirectorIDMap, mDirectorList, mDirectorNameMap, mEntityDeleteList, SendMessage(), UnregisterDirectorFromGlobalMessages(), and UnregisterEntityFromAboutMessages().

Referenced by UnregisterAllDirectors(), and UnregisterDirector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterDirector() [2/2]

bool trManager::SystemManager::UnregisterDirector ( const trBase::UniqueId id)
virtual

Disconnects the director from System Manager by using it's ID.

Parameters
idThe identifier.
Returns
True if it succeeds, false if it fails.

Definition at line 827 of file SystemManager.cpp.

References FindDirector(), and UnregisterDirector().

Here is the call graph for this function:

◆ UnregisterDirectorFromGlobalMessages()

void trManager::SystemManager::UnregisterDirectorFromGlobalMessages ( trManager::EntityBase director)
protectedvirtual

Unregisters the director from all messages that have registrations.

Parameters
[in,out]directorThe director.

Definition at line 542 of file SystemManager.cpp.

References trManager::EntityType::DIRECTOR, trManager::EntityBase::GetEntityType(), trBase::Base::GetName(), trBase::Base::GetUUID(), LOG_E, and mDirectorGlobalMsgRegistrationMap.

Referenced by UnregisterDirector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterEntityFromAboutMessages()

void trManager::SystemManager::UnregisterEntityFromAboutMessages ( trManager::EntityBase listeningEntity)
protectedvirtual

Unregisters the entity from about messages about another actor.

Parameters
[in,out]listeningEntityThe entity.

Definition at line 585 of file SystemManager.cpp.

References mListenerRegistrationMap.

Referenced by UnregisterActor(), and UnregisterDirector().

Here is the caller graph for this function:

◆ UnregisterFromMessage()

void trManager::SystemManager::UnregisterFromMessage ( const std::string &  messageType,
EntityBase listeningActor 
)
virtual

Unregister an actor that is listening for a given message.

Parameters
messageTypeType of the message.
[in,out]listeningActorThe listening actor.

Definition at line 143 of file SystemManager.cpp.

References trManager::EntityType::ACTOR, trManager::EntityType::ACTOR_MODULE, trManager::EntityType::DIRECTOR, trManager::EntityBase::GetEntityType(), mDirectorGlobalMsgRegistrationMap, mEntityGlobalMsgRegistrationMap, UnregisterMsgFromMsgMap(), and UnregisterMsgFromMsgVectorMap().

Here is the call graph for this function:

◆ UnregisterFromMessagesAboutEntity()

void trManager::SystemManager::UnregisterFromMessagesAboutEntity ( EntityBase listeningEntity,
const trBase::UniqueId aboutEntityId 
)
virtual

Unregisters from messages about a specific actor.

Parameters
[in,out]listeningEntityThe listening entity.
aboutEntityIdIdentifier for the about entity.

Definition at line 188 of file SystemManager.cpp.

References trBase::Base::GetName(), LOG_D, LOG_W, and mListenerRegistrationMap.

Here is the call graph for this function:

◆ UnregisterMsgFromMsgMap()

void trManager::SystemManager::UnregisterMsgFromMsgMap ( const std::string &  messageType,
EntityBase listeningEntity,
MessageRegistrationMap messageMap 
)
private

Un register message from message map.

Parameters
messageTypeType of the message.
[in,out]listeningEntityThe listening entity.
[in,out]messageMapThe message map.

Definition at line 697 of file SystemManager.cpp.

References trBase::Base::GetName(), LOG_D, and LOG_W.

Referenced by UnregisterFromMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnregisterMsgFromMsgVectorMap()

void trManager::SystemManager::UnregisterMsgFromMsgVectorMap ( const std::string &  messageType,
EntityBase listeningEntity,
MessageRegistrationVectorMap messageMap 
)
private

Un register message from a given message map.

Parameters
messageTypeType of the message.
[in,out]listeningEntityThe listening entity.
[in,out]messageMapThe message map.

Definition at line 644 of file SystemManager.cpp.

References trBase::Base::GetName(), LOG_D, and LOG_W.

Referenced by UnregisterFromMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ CLASS_TYPE

const trUtil::RefStr trManager::SystemManager::CLASS_TYPE = trUtil::RefStr("trManager::SystemManager")
static

Adds an easy and swappable access to the base class.

Definition at line 52 of file SystemManager.h.

Referenced by GetType().

◆ mActorIDMap

ActorIDMap trManager::SystemManager::mActorIDMap
private

Definition at line 451 of file SystemManager.h.

Referenced by FindActor(), RegisterActor(), and UnregisterActor().

◆ mActorList

ActorList trManager::SystemManager::mActorList
private

◆ mDirectorGlobalMsgRegistrationMap

MessageRegistrationMap trManager::SystemManager::mDirectorGlobalMsgRegistrationMap
private

◆ mDirectorIDMap

DirectorIDMap trManager::SystemManager::mDirectorIDMap
private

Definition at line 435 of file SystemManager.h.

Referenced by FindDirector(), RegisterDirector(), and UnregisterDirector().

◆ mDirectorList

DirectorList trManager::SystemManager::mDirectorList
private

◆ mDirectorNameMap

DirectorNameMap trManager::SystemManager::mDirectorNameMap
private

Definition at line 434 of file SystemManager.h.

Referenced by FindDirector(), RegisterDirector(), and UnregisterDirector().

◆ mEntityDeleteList

std::vector<trBase::SmrtPtr<trManager::EntityBase> > trManager::SystemManager::mEntityDeleteList
private

Definition at line 453 of file SystemManager.h.

Referenced by RemoveMarkedEntities(), UnregisterActor(), and UnregisterDirector().

◆ mEntityGlobalMsgRegistrationMap

MessageRegistrationVectorMap trManager::SystemManager::mEntityGlobalMsgRegistrationMap
private

◆ mInstance

trBase::SmrtPtr< trManager::SystemManager > trManager::SystemManager::mInstance = nullptr
staticprivate

Definition at line 425 of file SystemManager.h.

Referenced by GetInstance().

◆ mListenerRegistrationMap

UUIDRegistrationVectorMap trManager::SystemManager::mListenerRegistrationMap
private

◆ mMessageQueue

std::queue<trBase::SmrtPtr<const trManager::MessageBase> > trManager::SystemManager::mMessageQueue
private

Definition at line 426 of file SystemManager.h.

Referenced by ProcessMessages(), and SendMessage().

◆ mNetworkMessageQueue

std::queue<trBase::SmrtPtr<const trManager::MessageBase> > trManager::SystemManager::mNetworkMessageQueue
private

Definition at line 427 of file SystemManager.h.

Referenced by ProcessNetworkMessages(), and SendNetworkMessage().


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