MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Mezzanine::ActorManager Class Reference

A manager responsible for the storage and management of all actors that exist in a world. More...

#include <actormanager.h>

+ Inheritance diagram for Mezzanine::ActorManager:
+ Collaboration diagram for Mezzanine::ActorManager:

Public Types

typedef std::vector< Actor * > ActorContainer
 Basic container type for Actor storage by this class.
 
typedef ActorContainer::iterator ActorIterator
 Iterator type for Actor instances stored by this class.
 
typedef
ActorContainer::const_iterator 
ConstActorIterator
 Const Iterator type for Actor instances stored by this class.
 
typedef FactoryMap::const_iterator ConstFactoryIterator
 Const Iterator type for ActorFactory instances stored by this class.
 
typedef FactoryMap::iterator FactoryIterator
 Iterator type for ActorFactory instances stored by this class.
 
typedef std::map< String,
ActorFactory * > 
FactoryMap
 Basic container type for ActorFactory storage by this class.
 

Public Member Functions

 ActorManager ()
 Class constructor.
 
 ActorManager (XML::Node &XMLNode)
 XML constructor. More...
 
virtual ~ActorManager ()
 Class destructor.
 
virtual void AddActorFactory (ActorFactory *ToBeAdded)
 Adds/registers a Actor factory with this manager, allowing it to be constructed through this API. More...
 
ActorCreateActor (const String &TypeName, const String &InstanceName, const NameValuePairMap &Params)
 Creates a new Actor. More...
 
ActorCreateActor (const XML::Node &SelfRoot)
 Creates a new Actor class from an XML node. More...
 
virtual void Deinitialize ()
 Removes this manager from any necessary configuration so it can be safely disposed of. More...
 
virtual void DestroyActor (const Whole Index)
 Destroys an Actor at the specified index. More...
 
virtual void DestroyActor (Actor *ToBeDestroyed)
 Destroys an Actor. More...
 
virtual void DestroyActorFactory (ActorFactory *ToBeDestroyed)
 Removes and destroys a Actor factory in this manager. More...
 
virtual void DestroyActorFactory (const String &ImplName)
 Removes and destroys a Actor factory in this manager. More...
 
virtual void DestroyAllActorFactories ()
 Destroys all Actor factories in this manager. More...
 
virtual void DestroyAllActors ()
 Destroys all Actors currently within this manager.
 
virtual ActorGetActor (const Whole Index) const
 Gets an Actor by Index. More...
 
virtual ActorGetActor (const String &Name) const
 Gets an Actor by Name. More...
 
ActorUpdateWorkUnitGetActorUpdateWork ()
 Gets the work unit responsible for updating actors stored by this manager. More...
 
virtual String GetImplementationTypeName () const
 This Allows any manager name to be sent to a stream. Primarily used for logging. More...
 
virtual ManagerType GetInterfaceType () const
 This returns the type of this manager. More...
 
virtual Whole GetNumActors () const
 Gets the number of Actors stored in this manager. More...
 
virtual void Initialize ()
 Configures this manager for use prior to entering the main loop. More...
 
virtual void Pause (const UInt32 PL)
 Sets the pause state of this manager, or has no effect depending on the value passed in. More...
 
virtual void RemoveActorFactory (ActorFactory *ToBeRemoved)
 Removes a Actor factory from this manager. More...
 
virtual void RemoveActorFactory (const String &ImplName)
 Removes a Actor factory from this manager. More...
 
- Public Member Functions inherited from Mezzanine::WorldManager
 WorldManager ()
 Class constructor.
 
virtual ~WorldManager ()
 Class destructor.
 
virtual void _SetWorld (World *Parent)
 Sets the world this manager belongs to.

Exceptions
Ifthis manager is already initialized, this method will throw an "INVALID_STATE_EXCEPTION".
More...
 
virtual WorldGetWorld () const
 Gets the world this manager belongs to. More...
 
virtual bool IsPaused () const
 Gets whether or not this manager is currently paused. More...
 
- Public Member Functions inherited from Mezzanine::ManagerBase
 ManagerBase ()
 Class constructor.
 
virtual ~ManagerBase ()
 Class destructor.
 
virtual String GetInterfaceTypeAsString () const
 Gets a string of the interface type of this manager. More...
 
bool IsInitialized () const
 Gets whether or not this manager has been initialized. More...
 

Protected Attributes

FactoryMap ActorFactories
 A map containing all registered Actor type factories. More...
 
ActorContainer Actors
 Container storing all Actors belonging to this manager. More...
 
ActorUpdateWorkUnitActorUpdateWork
 The work unit that updates all the actors stored by this manager. More...
 
Threading::DefaultThreadSpecificStorage::TypeThreadResources
 Can be used for thread safe logging and other thread specific resources. More...
 
- Protected Attributes inherited from Mezzanine::WorldManager
bool OperationsPaused
 This stores whether or not processing for some or all objects in this manager has been paused. More...
 
WorldParentWorld
 A pointer to the world that created this manager. More...
 
- Protected Attributes inherited from Mezzanine::ManagerBase
bool Initialized
 Simple bool indicating whether or not this manager has been initialized. More...
 
EntresolTheEntresol
 The actual pointer to the Entresol core class. More...
 

Friends

class ActorUpdateWorkUnit
 

Additional Inherited Members

- Static Public Member Functions inherited from Mezzanine::ManagerBase
static String GetTypeAsString (const ManagerType &ManagerType)
 Gets the string form of the type of manager. More...
 
static ManagerType GetTypeFromString (const String &ManagerName)
 Gets the type of manager requested from a string. More...
 

Detailed Description

A manager responsible for the storage and management of all actors that exist in a world.

More or less Management point for a container of actors to help keep them sorted.

Definition at line 92 of file actormanager.h.

Constructor & Destructor Documentation

Mezzanine::ActorManager::ActorManager ( XML::Node XMLNode)

XML constructor.

Parameters
XMLNodeThe node of the xml document to construct from.
Todo:
This class currently doesn't initialize anything from XML, if that changes this constructor needs to be expanded.

Definition at line 89 of file actormanager.cpp.

Member Function Documentation

void Mezzanine::ActorManager::AddActorFactory ( ActorFactory ToBeAdded)
virtual

Adds/registers a Actor factory with this manager, allowing it to be constructed through this API.

Parameters
ToBeAddedThe Actor factory to be added.

Definition at line 205 of file actormanager.cpp.

Actor * Mezzanine::ActorManager::CreateActor ( const String TypeName,
const String InstanceName,
const NameValuePairMap Params 
)

Creates a new Actor.

Parameters
TypeNameA string containing the name of the type of Actor to be constructed.
InstanceNameA string containing the name to be given to the created Actor.
ParamsA container of additional parameters to be used for the construction of the new Actor.
Returns
Returns a pointer to the created Actor.

Definition at line 112 of file actormanager.cpp.

Actor * Mezzanine::ActorManager::CreateActor ( const XML::Node SelfRoot)

Creates a new Actor class from an XML node.

Remarks
This is mostly useful for deserialization.
Returns
Returns a pointer to the created Actor.

Definition at line 124 of file actormanager.cpp.

void Mezzanine::ActorManager::Deinitialize ( )
virtual

Removes this manager from any necessary configuration so it can be safely disposed of.

Implements Mezzanine::ManagerBase.

Definition at line 267 of file actormanager.cpp.

void Mezzanine::ActorManager::DestroyActor ( const Whole  Index)
virtual

Destroys an Actor at the specified index.

Parameters
IndexThe index at which to destroy the Actor.

Definition at line 156 of file actormanager.cpp.

void Mezzanine::ActorManager::DestroyActor ( Actor ToBeDestroyed)
virtual

Destroys an Actor.

Parameters
ToBeDestroyedThe Actor to be destroyed.

Definition at line 172 of file actormanager.cpp.

void Mezzanine::ActorManager::DestroyActorFactory ( ActorFactory ToBeDestroyed)
virtual

Removes and destroys a Actor factory in this manager.

Parameters
ToBeDestroyedA pointer to the Actor factory that is to be removed and destroyed.

Definition at line 222 of file actormanager.cpp.

void Mezzanine::ActorManager::DestroyActorFactory ( const String ImplName)
virtual

Removes and destroys a Actor factory in this manager.

Parameters
ImplNameThe name of the Actor implementation created by the factory to be removed and destroyed.

Definition at line 227 of file actormanager.cpp.

void Mezzanine::ActorManager::DestroyAllActorFactories ( )
virtual

Destroys all Actor factories in this manager.

Warning
The destruction of Actor factories should only be done after all the Actor have been destroyed, otherwise this will cause an exception.

Definition at line 236 of file actormanager.cpp.

Actor * Mezzanine::ActorManager::GetActor ( const Whole  Index) const
virtual

Gets an Actor by Index.

Parameters
IndexThe index of the Actor you wish to retrieve.
Returns
Returns a pointer to the Actor at the specified index.

Definition at line 136 of file actormanager.cpp.

Actor * Mezzanine::ActorManager::GetActor ( const String Name) const
virtual

Gets an Actor by Name.

Parameters
NameThe name of the Actor you wish to retrieve.
Returns
Returns a pointer to the Actor of the specified name.

Definition at line 141 of file actormanager.cpp.

ActorUpdateWorkUnit * Mezzanine::ActorManager::GetActorUpdateWork ( )

Gets the work unit responsible for updating actors stored by this manager.

Returns
Returns a pointer to the ActorUpdateWorkUnit used by this manager.

Definition at line 278 of file actormanager.cpp.

String Mezzanine::ActorManager::GetImplementationTypeName ( ) const
virtual

This Allows any manager name to be sent to a stream. Primarily used for logging.

Returns
This returns a String that contains the name.

Implements Mezzanine::ManagerBase.

Definition at line 287 of file actormanager.cpp.

ManagerBase::ManagerType Mezzanine::ActorManager::GetInterfaceType ( ) const
virtual

This returns the type of this manager.

This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.

Returns
This returns a ManagerTypeName to identify what this can be safely cast to.

Implements Mezzanine::ManagerBase.

Definition at line 284 of file actormanager.cpp.

Whole Mezzanine::ActorManager::GetNumActors ( ) const
virtual

Gets the number of Actors stored in this manager.

Returns
Returns a whole representing the current Actor count.

Definition at line 151 of file actormanager.cpp.

void Mezzanine::ActorManager::Initialize ( )
virtual

Configures this manager for use prior to entering the main loop.

Exceptions
Ifthis is called while no valid world is set, this will throw an "INVALID_STATE_EXCEPTION".

Reimplemented from Mezzanine::WorldManager.

Definition at line 251 of file actormanager.cpp.

void Mezzanine::ActorManager::Pause ( const UInt32  PL)
virtual

Sets the pause state of this manager, or has no effect depending on the value passed in.

Parameters
PLA bitfield describing the pause level being assigned to the parent world of this manager.

Implements Mezzanine::WorldManager.

Definition at line 246 of file actormanager.cpp.

void Mezzanine::ActorManager::RemoveActorFactory ( ActorFactory ToBeRemoved)
virtual

Removes a Actor factory from this manager.

Parameters
ToBeRemovedA pointer to the Actor factory that is to be removed.

Definition at line 210 of file actormanager.cpp.

void Mezzanine::ActorManager::RemoveActorFactory ( const String ImplName)
virtual

Removes a Actor factory from this manager.

Parameters
ImplNameThe name of the Actor implementation created by the factory to be removed.

Definition at line 215 of file actormanager.cpp.

Member Data Documentation

FactoryMap Mezzanine::ActorManager::ActorFactories
protected

A map containing all registered Actor type factories.

Definition at line 112 of file actormanager.h.

ActorContainer Mezzanine::ActorManager::Actors
protected

Container storing all Actors belonging to this manager.

Definition at line 115 of file actormanager.h.

ActorUpdateWorkUnit* Mezzanine::ActorManager::ActorUpdateWork
protected

The work unit that updates all the actors stored by this manager.

Definition at line 119 of file actormanager.h.

Threading::DefaultThreadSpecificStorage::Type* Mezzanine::ActorManager::ThreadResources
protected

Can be used for thread safe logging and other thread specific resources.

Definition at line 122 of file actormanager.h.


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