MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
managerbase.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 #ifndef _managerbase_h
41 #define _managerbase_h
42 
43 #include "datatypes.h"
44 #include "crossplatformexport.h"
45 #ifndef SWIG
46  #include "XML/xml.h"
47 #endif
48 
49 namespace Mezzanine
50 {
51  class Entresol;
52  ///////////////////////////////////////////////////////////////////////////////
53  /// @class ManagerBase
54  /// @headerfile managerbase.h
55  /// @brief This is the base class from which all the Entresol and World Managers inherit.
56  /// @details This creates a base set of functions that Managers are all
57  /// expected to implement.
58  ///////////////////////////////////////
60  {
61  public:
62  /// @enum ManagerTypeName
63  /// @brief A listing of Manager TypeNames
64  /// @details These will be returned by ManagerBase::GetType(), and will allow
65  /// code using this to determine what type of Manager class they are working with
66  /// and use this information to more safely cast to the correct manager if needed.
68  {
69  // Entresol Managers // Namespaces
70 
71  MT_AudioManager = 1, // Audio
72  MT_AnimationManager, // Graphics
73  MT_CollisionShapeManager, // Physics
74  MT_CompositorManager, // Gtaphics
75  MT_GraphicsManager, // Graphics
76  MT_EventManager, // Mezzanine
77  MT_InputManager, // Input
78  MT_LogManager, // Mezzanine
79  MT_MaterialManager, // Graphics
80  MT_MeshManager, // Graphics
81  MT_NetworkManager, // Network
82  MT_ResourceManager, // Resource
83  MT_ScriptingManager, // Scripting
84  MT_UIManager, // UI
85 
86  // World Managers // Namespaces
87 
88  MT_ActorManager = 100, // Mezzanine
89  MT_AreaEffectManager, // Mezzanine
90  MT_CameraManager, // Graphics
91  MT_DebrisManager, // Mezzanine
92  MT_PagingManager, // Paging
93  MT_PhysicsManager, // Physics
94  MT_SceneManager, // Graphics
95  MT_SoundScapeManager, // Audio
96  MT_TerrainManager, // Mezzanine
97  MT_VehicleManager, // Mezzanine
98 
99  // Other Managers
100 
101  MT_UserCreated = 512 ///< This, and values above it, is what User created managers that do not derive from any other managers are expected to use to prevent confusion with game internals
102  };
103  protected:
104  /// @internal
105  /// @brief The actual pointer to the Entresol core class.
107  /// @internal
108  /// @brief Simple bool indicating whether or not this manager has been initialized.
110  public:
111  /// @brief Class constructor.
112  ManagerBase();
113  /// @brief Class destructor.
114  virtual ~ManagerBase();
115 
116  ///////////////////////////////////////////////////////////////////////////////
117  // Utility
118 
119  ///////////////////////////////////////////////////////////////////////////////
120  // Initialization Methods
121 
122  /// @brief Configures this manager for use prior to entering the main loop.
123  virtual void Initialize() = 0;
124  /// @brief Removes this manager from any necessary configuration so it can be safely disposed of.
125  virtual void Deinitialize() = 0;
126  /// @brief Gets whether or not this manager has been initialized.
127  /// @return Returns true if this manager has been initialized, false otherwise.
128  bool IsInitialized() const;
129 
130  ///////////////////////////////////////////////////////////////////////////////
131  // Type Identifier Methods
132 
133  /// @brief This returns the type of this manager.
134  /// @details This is intended to make using and casting from Manager base easier. With this is is possible to cast from
135  /// ManagerBase to the correct Manager Type.
136  /// @return This returns a ManagerTypeName to identify what this can be safely cast to.
137  virtual ManagerType GetInterfaceType() const = 0;
138  /// @brief This Allows any manager name to be sent to a stream. Primarily used for logging
139  /// @return This returns a String that contains the name.
140  virtual String GetImplementationTypeName() const = 0;
141  /// @brief Gets a string of the interface type of this manager.
142  /// @return Returns a string containing the interface name of this manager.
143  virtual String GetInterfaceTypeAsString() const;
144 
145  /// @brief Gets the string form of the type of manager.
146  /// @return Returns a string containing the name of the requested type of manager.
147  static String GetTypeAsString(const ManagerType& ManagerType);
148  /// @brief Gets the type of manager requested from a string.
149  /// @remarks This function does not try to compare the full string for the sake of speed. Instead it'll check the first couple letters for a potential match.
150  /// This function is also not case sensative. Providing the string "ac" will return an ActorManager value, for example. Additionally if it does not find a
151  /// match it will throw an exception. So be careful about what you put into this.
152  /// @return Returns a ManagerTypeName cooresponding to the string provided.
153  static ManagerType GetTypeFromString(const String& ManagerName);
154  };//ManagerBase
155 }//Mezzanine
156 
157 #endif