Spinning Topp Logo BlackTopp Studios
inc
managerbase.h
1 // © Copyright 2010 - 2016 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  /// @headerfile managerbase.h
54  /// @brief This is the base class from which all the Entresol and World Managers inherit.
55  /// @details This creates a base set of functions that Managers are all
56  /// expected to implement.
57  ///////////////////////////////////////
59  {
60  public:
61  /// @brief A listing of Manager Types.
62  /// @details These will be returned by ManagerBase::GetType(), and will allow
63  /// code using this to determine what type of Manager class they are working with
64  /// and use this information to more safely cast to the correct manager if needed.
66  {
67  // Utility Types
68 
69  MT_Undefined = 0,
70 
71  // Entresol Managers // Namespaces
72 
73  MT_AudioManager = 1, // Audio
74  MT_AnimationManager = 2, // Graphics
75  MT_CollisionShapeManager = 3, // Physics
76  MT_CompositorManager = 4, // Graphics
77  MT_GraphicsManager = 5, // Graphics
78  MT_EventManager = 6, // Mezzanine
79  MT_InputManager = 7, // Input
80  MT_LogManager = 8, // Mezzanine
81  MT_MaterialManager = 9, // Graphics
82  MT_MeshManager = 10, // Graphics
83  MT_NetworkManager = 11, // Network
84  MT_ResourceManager = 12, // Resource
85  MT_ScriptingManager = 13, // Scripting
86  MT_TextureManager = 14, // Graphics
87  MT_UIManager = 15, // UI
88 
89  // World Managers // Namespaces
90 
91  MT_ActorManager = 101, // Mezzanine
92  MT_AreaEffectManager = 102, // Mezzanine
93  MT_DebrisManager = 103, // Mezzanine
94  MT_PagingManager = 104, // Paging
95  MT_PhysicsManager = 105, // Physics
96  MT_SceneManager = 106, // Graphics
97  MT_SoundScapeManager = 107, // Audio
98  MT_TerrainManager = 108, // Mezzanine
99  MT_VehicleManager = 109, // Mezzanine
100 
101  // Other Managers // Namespaces
102 
103  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
104  };
105  protected:
106  /// @internal
107  /// @brief The actual pointer to the Entresol core class.
109  /// @internal
110  /// @brief Simple Boole indicating whether or not this manager has been initialized.
112  public:
113  /// @brief Class constructor.
114  ManagerBase();
115  /// @brief Class destructor.
116  virtual ~ManagerBase();
117 
118  ///////////////////////////////////////////////////////////////////////////////
119  // Utility
120 
121  ///////////////////////////////////////////////////////////////////////////////
122  // Initialization Methods
123 
124  /// @brief Configures this manager for use prior to entering the main loop.
125  virtual void Initialize() = 0;
126  /// @brief Removes this manager from any necessary configuration so it can be safely disposed of.
127  virtual void Deinitialize() = 0;
128  /// @brief Gets whether or not this manager has been initialized.
129  /// @return Returns true if this manager has been initialized, false otherwise.
130  Boole IsInitialized() const;
131 
132  ///////////////////////////////////////////////////////////////////////////////
133  // Type Identifier Methods
134 
135  /// @brief This returns the type of this manager.
136  /// @details This is intended to make using and casting from Manager base easier. With this is is possible to cast from
137  /// ManagerBase to the correct Manager Type.
138  /// @return This returns a ManagerTypeName to identify what this can be safely cast to.
139  virtual ManagerType GetInterfaceType() const = 0;
140  /// @brief This Allows any manager name to be sent to a stream. Primarily used for logging
141  /// @return This returns a String that contains the name.
142  virtual String GetImplementationTypeName() const = 0;
143  /// @brief Gets a string of the interface type of this manager.
144  /// @return Returns a string containing the interface name of this manager.
145  virtual String GetInterfaceTypeAsString() const;
146 
147  /// @brief Gets the string form of the type of manager.
148  /// @return Returns a string containing the name of the requested type of manager.
149  static String GetTypeAsString(const ManagerType& ManagerType);
150  /// @brief Gets the type of manager requested from a string.
151  /// @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.
152  /// 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
153  /// match it will throw an exception. So be careful about what you put into this.
154  /// @return Returns a ManagerTypeName cooresponding to the string provided.
155  static ManagerType GetTypeFromString(const String& ManagerName);
156  };//ManagerBase
157 }//Mezzanine
158 
159 #endif
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This file is used on some platforms to determine what data should be read and written to and from a s...
ManagerType
A listing of Manager Types.
Definition: managerbase.h:65
All the definitions for datatypes as well as some basic conversion functions are defined here...
Entresol * TheEntresol
The actual pointer to the Entresol core class.
Definition: managerbase.h:108
This is the main entry point for the entire library.
Definition: entresol.h:324
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
This is the base class from which all the Entresol and World Managers inherit.
Definition: managerbase.h:58
Boole Initialized
Simple Boole indicating whether or not this manager has been initialized.
Definition: managerbase.h:111