Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Mezzanine::World Class Reference

This class represents a world for objects to interact within. More...

#include <world.h>

+ Collaboration diagram for Mezzanine::World:

Public Types

typedef ManagerFactoryMap::const_iterator ConstManagerFactoryIterator
 Const Iterator type for manager factories stored by this class.
 
typedef WorldManagerContainer::const_iterator ConstWorldManagerIterator
 Const Iterator type for WorldManager instances stored by this class.
 
typedef ManagerFactoryMap::iterator ManagerFactoryIterator
 Iterator type for manager factories stored by this class.
 
typedef std::map< String, WorldManagerFactory * > ManagerFactoryMap
 Basic container type for factories that construct known manager types.
 
typedef std::vector< WorldManager * > WorldManagerContainer
 Basic container type for WorldManager storage by this class.
 
typedef WorldManagerContainer::iterator WorldManagerIterator
 Iterator type for WorldManager instances stored by this class.
 

Public Member Functions

 World (const String &WorldName)
 Class constructor. More...
 
 World (const String &WorldName, const WorldManagerContainer &Managers)
 Pre-made manager constructor. More...
 
 World (const String &WorldName, const Physics::ManagerConstructionInfo &PhysicsInfo, const String &SceneType)
 Descriptive constructor. More...
 
 World (const String &WorldName, const WorldManagerContainer &Managers, const Physics::ManagerConstructionInfo &PhysicsInfo, const String &SceneType)
 Descriptive pre-made manager constructor. More...
 
 World (const XML::Node &SelfNode)
 XML constructor. More...
 
virtual ~World ()
 class destructor.
 
Boole AddManager (WorldManager *ManagerToAdd)
 This adds a manager, in the correct order, to the list that the world calls on. More...
 
void Clear ()
 Clears the world of all objects. More...
 
WorldManagerCreateManager (const String &ManagerImplName, const NameValuePairList &Params, Boole AddToWorld=true)
 Creates a new manager. More...
 
WorldManagerCreateManager (const String &ManagerImplName, const XML::Node &XMLNode, Boole AddToWorld=true)
 Creates a new manager. More...
 
void Deinitialize ()
 Deinitializes all managers in this world and unhooks all of it's systems, disabling this world.
 
void DestroyAllManagers ()
 Destroys all managers currently in the World. More...
 
void DestroyManager (WorldManager *ToBeDestroyed)
 Destroys a manager. More...
 
virtual String GetDerivedSerializableName () const
 Gets the most derived serializable name of this World. More...
 
WorldManagerGetManager (const Whole ManagerToGet)
 This is will find the manager of a given type. More...
 
const StringGetName () const
 Gets the name of this world. More...
 
WorldManagerContainerGetWorldManagers ()
 This gets the list of managers in the world. More...
 
void Initialize ()
 Initializes all managers in this world and performs all the necessary hooks to enable this world.
 
void PauseWorld (const Boole Pause)
 Pauses all animations, particles, and object movement throughout the world. More...
 
void PreMainLoopInit ()
 Initialize any default managers and any added after construction. This should be called before the Entresol enters it's main loop.
 
virtual void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
virtual void ProtoDeSerializeProperties (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite the properties of this object with it. More...
 
virtual void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 
virtual void ProtoSerializeProperties (XML::Node &SelfRoot) const
 Convert the properties of this class to an XML::Node ready for serialization. More...
 
void RemoveAllManagers ()
 This removes all managers from the manager list.
 
void RemoveManager (WorldManager *ToBeRemoved)
 This removes a manager by finding the matching pointer. More...
 
void RemoveManager (const Whole ToBeRemoved)
 This removes a manager of a specific type from the list. More...
 

Static Public Member Functions

static void AddAllEngineDefaultManagerFactories ()
 Adds all the default manager factories provided by the engine.
 
static void AddManagerFactory (WorldManagerFactory *ToBeAdded)
 Adds/registers a manager factory for use with World instances. More...
 
static void DestroyAllManagerFactories ()
 Destroys all registered manager factories. More...
 
static void DestroyManagerFactory (WorldManagerFactory *ToBeRemoved)
 Removes and destroys a manager factory in the container of registered factories. More...
 
static void DestroyManagerFactory (const String &ImplName)
 Removes and destroys a manager factory in the container of registered factories. More...
 
static String GetSerializableName ()
 Get the name of the the XML tag the World class will leave behind as its instances are serialized. More...
 
static void RemoveManagerFactory (WorldManagerFactory *ToBeRemoved)
 Removes a manager factory from the container of registered factories. More...
 
static void RemoveManagerFactory (const String &ImplName)
 Removes a manager factory from the container of registered factories. More...
 

Protected Member Functions

void Construct (const Physics::ManagerConstructionInfo &PhysicsInfo, const String &SceneType, const WorldManagerContainer &ManagerToBeAdded)
 Helper function used to assist construction. More...
 
Boole VerifyManagerInitializations ()
 Checks if all managers currently stored in this World have been initialized. More...
 

Protected Attributes

String Name
 Unique string identifier for world. More...
 
WorldManagerContainer WorldManagers
 A container storing all the managers belonging to this world. More...
 

Static Protected Attributes

static ManagerFactoryMap ManagerFactories
 A global container for registered factories for WorldManagers. More...
 

Detailed Description

This class represents a world for objects to interact within.

Objects can be inserted and removed from worlds in order to simulate them. Multiple worlds can exist but objects can only belong to one world at a time.

Definition at line 74 of file world.h.

Constructor & Destructor Documentation

Mezzanine::World::World ( const String WorldName)

Class constructor.

Parameters
WorldNameString name of the world.

Definition at line 69 of file world.cpp.

Mezzanine::World::World ( const String WorldName,
const WorldManagerContainer Managers 
)

Pre-made manager constructor.

Parameters
WorldNameString name of the world.
ManagersA container of pre-made managers to be used by this world.

Definition at line 78 of file world.cpp.

Mezzanine::World::World ( const String WorldName,
const Physics::ManagerConstructionInfo PhysicsInfo,
const String SceneType 
)

Descriptive constructor.

Parameters
WorldNameString name of the world.
PhysicsInfoA ManagerConstructionInfo struct with data on how to configure the physics for this world.
SceneTypeA string containing the name of the underlying scene type for this world.

Definition at line 86 of file world.cpp.

Mezzanine::World::World ( const String WorldName,
const WorldManagerContainer Managers,
const Physics::ManagerConstructionInfo PhysicsInfo,
const String SceneType 
)

Descriptive pre-made manager constructor.

Parameters
WorldNameString name of the world.
ManagersA container of pre-made managers to be used by this world.
PhysicsInfoA ManagerConstructionInfo struct with data on how to configure the physics for this world.
SceneTypeA string containing the name of the underlying scene type for this world.

Definition at line 94 of file world.cpp.

Mezzanine::World::World ( const XML::Node SelfNode)

XML constructor.

Parameters
SelfNodeThe node that represents the data to populate this world with.

Definition at line 100 of file world.cpp.

Member Function Documentation

Boole Mezzanine::World::AddManager ( WorldManager ManagerToAdd)

This adds a manager, in the correct order, to the list that the world calls on.

Parameters
ManagerToAddThe pointer to the manager to be added.
Returns
Returns true if the manager was successfully added, false if the manager or it's type was non-unique.

Definition at line 312 of file world.cpp.

void Mezzanine::World::AddManagerFactory ( WorldManagerFactory ToBeAdded)
static

Adds/registers a manager factory for use with World instances.

Parameters
ToBeAddedThe manager factory to be added.

Definition at line 369 of file world.cpp.

void Mezzanine::World::Clear ( )

Clears the world of all objects.

Remarks
This will delete all world objects and supporting objects (such as constraints) and any metadata related to them. This method is designed to clear the slate for the world back to zero and be ready for re-use without having to destroy and recreate the world and setting custom configurations in the world.

Definition at line 167 of file world.cpp.

void Mezzanine::World::Construct ( const Physics::ManagerConstructionInfo PhysicsInfo,
const String SceneType,
const WorldManagerContainer ManagerToBeAdded 
)
protected

Helper function used to assist construction.

Definition at line 110 of file world.cpp.

WorldManager * Mezzanine::World::CreateManager ( const String ManagerImplName,
const NameValuePairList Params,
Boole  AddToWorld = true 
)

Creates a new manager.

Parameters
ManagerImplNameThe name of the manager implementation to create.
ParamsA list of name-value pairs for the params that are to be used when creating the manager.
AddToWorldWhether or not to add the created manager to the World after creation.
Returns
Returns a pointer to the created manager.

Definition at line 246 of file world.cpp.

WorldManager * Mezzanine::World::CreateManager ( const String ManagerImplName,
const XML::Node XMLNode,
Boole  AddToWorld = true 
)

Creates a new manager.

Parameters
ManagerImplNameThe name of the manager implementation to create.
XMLNodeAn XML node containing all construction and initialization info for the manager to be created.
AddToWorldWhether or not to add the created manager to the World after creation.
Returns
Returns a pointer to the created manager.

Definition at line 259 of file world.cpp.

void Mezzanine::World::DestroyAllManagerFactories ( )
static

Destroys all registered manager factories.

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

Definition at line 400 of file world.cpp.

void Mezzanine::World::DestroyAllManagers ( )

Destroys all managers currently in the World.

Warning
Do not call this in anything that is run during the main loop. If you do you will have a bad time.

Definition at line 283 of file world.cpp.

void Mezzanine::World::DestroyManager ( WorldManager ToBeDestroyed)

Destroys a manager.

Warning
Some managers may depend on other managers for a part of their functionality. Use individual destruction of managers carefully.
Parameters
ToBeDestroyedThe manager to be destroyed.

Definition at line 272 of file world.cpp.

void Mezzanine::World::DestroyManagerFactory ( WorldManagerFactory ToBeRemoved)
static

Removes and destroys a manager factory in the container of registered factories.

Parameters
ToBeRemovedA pointer to the manager factory that is to be removed and destroyed.

Definition at line 386 of file world.cpp.

void Mezzanine::World::DestroyManagerFactory ( const String ImplName)
static

Removes and destroys a manager factory in the container of registered factories.

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

Definition at line 391 of file world.cpp.

String Mezzanine::World::GetDerivedSerializableName ( ) const
virtual

Gets the most derived serializable name of this World.

Note
When creating a new World class verify this method has a valid return for it in order for serialization to work properly.
Returns
Returns the name of the XML tag from the most derived class of "this".

Definition at line 459 of file world.cpp.

WorldManager * Mezzanine::World::GetManager ( const Whole  ManagerToGet)

This is will find the manager of a given type.

Parameters
ManagerToGetThe type ID of the manager to get. Use ManagerBase::ManagerType enum values for this.
Returns
This returns a pointer to a WorldManager, or a NULL pointer if no matching manager exists.

Definition at line 324 of file world.cpp.

const String & Mezzanine::World::GetName ( ) const

Gets the name of this world.

Returns
Returns a string containing the name used to identify this world.

Definition at line 159 of file world.cpp.

String Mezzanine::World::GetSerializableName ( )
static

Get the name of the the XML tag the World class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 462 of file world.cpp.

World::WorldManagerContainer & Mezzanine::World::GetWorldManagers ( )

This gets the list of managers in the world.

Returns
This returns a pointer to a vector containing the managers in this world.

Definition at line 361 of file world.cpp.

void Mezzanine::World::PauseWorld ( const Boole  Pause)

Pauses all animations, particles, and object movement throughout the world.

Parameters
PausePauses the world if true, unpauses if false.

Definition at line 162 of file world.cpp.

void Mezzanine::World::ProtoDeSerialize ( const XML::Node SelfRoot)
virtual

Take the data stored in an XML Node and overwrite this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 449 of file world.cpp.

void Mezzanine::World::ProtoDeSerializeProperties ( const XML::Node SelfRoot)
virtual

Take the data stored in an XML Node and overwrite the properties of this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 454 of file world.cpp.

void Mezzanine::World::ProtoSerialize ( XML::Node ParentNode) const
virtual

Convert this class to an XML::Node ready for serialization.

Parameters
ParentNodeThe point in the XML hierarchy that this World should be appended to.

Definition at line 439 of file world.cpp.

void Mezzanine::World::ProtoSerializeProperties ( XML::Node SelfRoot) const
virtual

Convert the properties of this class to an XML::Node ready for serialization.

Parameters
SelfRootThe root node containing all the serialized data for this instance.

Definition at line 444 of file world.cpp.

void Mezzanine::World::RemoveManager ( WorldManager ToBeRemoved)

This removes a manager by finding the matching pointer.

Parameters
ToBeRemovedA pointer to the manager to be removed.

Definition at line 334 of file world.cpp.

void Mezzanine::World::RemoveManager ( const Whole  ToBeRemoved)

This removes a manager of a specific type from the list.

Parameters
ToBeRemovedThe type ID of the manager to get. Use ManagerBase::ManagerType enum values for this.

Definition at line 345 of file world.cpp.

void Mezzanine::World::RemoveManagerFactory ( WorldManagerFactory ToBeRemoved)
static

Removes a manager factory from the container of registered factories.

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

Definition at line 374 of file world.cpp.

void Mezzanine::World::RemoveManagerFactory ( const String ImplName)
static

Removes a manager factory from the container of registered factories.

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

Definition at line 379 of file world.cpp.

Boole Mezzanine::World::VerifyManagerInitializations ( )
protected

Checks if all managers currently stored in this World have been initialized.

Returns
Returns true if all stored managers have been initialized, false otherwise.

Definition at line 151 of file world.cpp.

Member Data Documentation

World::ManagerFactoryMap Mezzanine::World::ManagerFactories
staticprotected

A global container for registered factories for WorldManagers.

Definition at line 92 of file world.h.

String Mezzanine::World::Name
protected

Unique string identifier for world.

Definition at line 98 of file world.h.

WorldManagerContainer Mezzanine::World::WorldManagers
protected

A container storing all the managers belonging to this world.

Definition at line 95 of file world.h.


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