MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
world.h
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 
41 #ifndef _world_h
42 #define _world_h
43 
44 #include "worldmanager.h"
45 
46 namespace Mezzanine
47 {
48  class ActorManager;
49  class AreaEffectManager;
50  class CameraManager;
51  class TerrainManager;
52  namespace Audio
53  {
54  class SoundScapeManager;
55  }
56  namespace Graphics
57  {
58  class SceneManager;
59  }
60  namespace Physics
61  {
62  class PhysicsManager;
63  class ManagerConstructionInfo;
64  }
65  ///////////////////////////////////////////////////////////////////////////////
66  /// @class World
67  /// @headerfile world.h
68  /// @brief This class represents a world for objects to interact within.
69  /// @details Objects can be inserted and removed from worlds in order to simulate them. Multiple worlds can
70  /// exist but objects can only belong to one world at a time.
71  ///////////////////////////////////////
73  {
74  public:
75  /// @brief Basic container type for @ref WorldManager storage by this class.
76  typedef std::vector< WorldManager* > WorldManagerContainer;
77  /// @brief Iterator type for @ref WorldManager instances stored by this class.
78  typedef WorldManagerContainer::iterator WorldManagerIterator;
79  /// @brief Const Iterator type for @ref WorldManager instances stored by this class.
80  typedef WorldManagerContainer::const_iterator ConstWorldManagerContainer;
81  protected:
82  /// @internal
83  /// @brief A container storing all the managers belonging to this world.
85  public:
86  /// @brief Class constructor.
87  World();
88  /// @brief Pre-made manager constructor.
89  /// @param Managers A container of pre-made managers to be used by this world.
90  World(const WorldManagerContainer& Managers);
91  /// @brief Descriptive constructor.
92  /// @param PhysicsInfo A ManagerConstructionInfo struct with data on how to configure the physics for this world.
93  /// @param SceneType A string containing the name of the underlying scene type for this world.
94  World(const Physics::ManagerConstructionInfo& PhysicsInfo, const String& SceneType);
95  /// @brief Descriptive pre-made manager constructor.
96  /// @param Managers A container of pre-made managers to be used by this world.
97  /// @param PhysicsInfo A ManagerConstructionInfo struct with data on how to configure the physics for this world.
98  /// @param SceneType A string containing the name of the underlying scene type for this world.
99  World(const WorldManagerContainer& Managers, const Physics::ManagerConstructionInfo& PhysicsInfo, const String& SceneType);
100  /// @brief XML constructor.
101  /// @param SelfNode The node that represents the data to populate this world with.
102  World(const XML::Node& SelfNode);
103  /// @brief class destructor.
104  virtual ~World();
105 
106  ///////////////////////////////////////////////////////////////////////////////
107  // Initialization
108 
109  /// @brief Initializes all managers in this world and performs all the necessary hooks to enable this world.
110  void Initialize();
111  /// @brief Deinitializes all managers in this world and unhooks all of it's systems, disabling this world.
112  void Deinitialize();
113 
114  ///////////////////////////////////////////////////////////////////////////////
115  // Upper Management
116 
117  /// @brief This adds a manager, in the correct order, to the list that the world calls on.
118  /// @param ManagerToAdd The pointer to the manager to be added.
119  /// @return Returns true if the manager was successfully added, false if the manager or it's type was non-unique.
120  Boolean AddManager(WorldManager* ManagerToAdd);
121  /// @brief This is will find the manager of a given type.
122  /// @param ManagerToGet The ManagerBase::ManagerTypeName of the manager to get.
123  /// @return This returns a pointer to a WorldManager, or a NULL pointer if no matching manager exists.
124  WorldManager* GetManager(const ManagerBase::ManagerType ManagerToGet);
125  /// @brief This removes a manager by finding the matching pointer.
126  /// @param ToBeRemoved A pointer to the manager to be removed.
127  void RemoveManager(WorldManager* ToBeRemoved);
128  /// @brief This removes a manager of a specific type from the list
129  /// @param ToBeRemoved The ManagerBase::ManagerTypeName of the manager to remove.
130  void RemoveManager(const ManagerBase::ManagerType ToBeRemoved);
131 
132  /// @brief This gets the ActorManager from the manager list.
133  /// @return This returns a pointer to a ActorManager, or a NULL pointer if no matching manager exists.
134  ActorManager* GetActorManager();
135  /// @brief This gets the AreaEffectManager from the manager list.
136  /// @return This returns a pointer to a AreaEffectManager, or a NULL pointer if no matching manager exists.
137  AreaEffectManager* GetAreaEffectManager();
138  /// @brief This gets the CameraManager from the manager list.
139  /// @return This returns a pointer to a CameraManager, or a NULL pointer if no matching manager exists.
140  CameraManager* GetCameraManager();
141  /// @brief This gets the PhysicsManager from the manager list.
142  /// @return This returns a pointer to a PhysicsManager, or a NULL pointer if no matching manager exists.
143  Physics::PhysicsManager* GetPhysicsManager();
144  /// @brief This gets the SceneManager from the manager list.
145  /// @return This returns a pointer to a SceneManager, or a NULL pointer if no matching manager exists.
146  Graphics::SceneManager* GetSceneManager();
147  /// @brief This gets the SoundScapeManager from the manager list.
148  /// @return This returns a pointer to a SoundScapeManager, or a NULL pointer if no matching manager exists.
149  Audio::SoundScapeManager* GetSoundScapeManager();
150  /// @brief This gets the TerrainManager from the manager list.
151  /// @return This returns a pointer to a TerrainManager, or a NULL pointer if no matching manager exists.
152  TerrainManager* GetTerrainManager();
153  };//World
154 }//Mezzanine
155 
156 #endif