Crazy Eddies GUI System: CEGUIRenderEffectManager.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIRenderEffectManager.h

    00001 /***********************************************************************
    00002     filename:   CEGUIRenderEffectManager.h
    00003     created:    Wed Dec 23 2009
    00004     author:     Paul D Turner <paul@cegui.org.uk>
    00005 *************************************************************************/
    00006 /***************************************************************************
    00007  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
    00008  *
    00009  *   Permission is hereby granted, free of charge, to any person obtaining
    00010  *   a copy of this software and associated documentation files (the
    00011  *   "Software"), to deal in the Software without restriction, including
    00012  *   without limitation the rights to use, copy, modify, merge, publish,
    00013  *   distribute, sublicense, and/or sell copies of the Software, and to
    00014  *   permit persons to whom the Software is furnished to do so, subject to
    00015  *   the following conditions:
    00016  *
    00017  *   The above copyright notice and this permission notice shall be
    00018  *   included in all copies or substantial portions of the Software.
    00019  *
    00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00026  *   OTHER DEALINGS IN THE SOFTWARE.
    00027  ***************************************************************************/
    00028 #ifndef _CEGUIRenderEffectManager_h_
    00029 #define _CEGUIRenderEffectManager_h_
    00030
    00031 #include "CEGUISingleton.h"
    00032 #include "CEGUIIteratorBase.h"
    00033 #include "CEGUILogger.h"
    00034 #include "CEGUIExceptions.h"
    00035 #include "CEGUIRenderEffectFactory.h"
    00036 #include <map>
    00037
    00038 #if defined(_MSC_VER)
    00039 #       pragma warning(push)
    00040 #       pragma warning(disable : 4251)
    00041 #endif
    00042
    00043 // Start of CEGUI namespace section
    00044 namespace CEGUI
    00045 {
    00051 class CEGUIEXPORT RenderEffectManager : public Singleton<RenderEffectManager>
    00052 {
    00053 private:
    00055     typedef std::map<String,
    00056                      RenderEffectFactory*,
    00057                      String::FastLessCompare> RenderEffectRegistry;
    00058
    00060     typedef std::map<RenderEffect*, RenderEffectFactory*> EffectCreatorMap;
    00061
    00063     RenderEffectRegistry d_effectRegistry;
    00065     EffectCreatorMap d_effects;
    00066
    00067 public:
    00069     typedef ConstBaseIterator<RenderEffectRegistry> RenderEffectIterator;
    00070
    00072     RenderEffectManager();
    00073
    00075     ~RenderEffectManager();
    00076
    00097     template <typename T>
    00098     void addEffect(const String& name);
    00099
    00116     void removeEffect(const String& name);
    00117
    00130     bool isEffectAvailable(const String& name) const;
    00131
    00148     RenderEffect& create(const String& name);
    00149
    00167     void destroy(RenderEffect& effect);
    00168 };
    00169
    00170 //---------------------------------------------------------------------------//
    00171 template <typename T>
    00172 void RenderEffectManager::addEffect(const String& name)
    00173 {
    00174     if (isEffectAvailable(name))
    00175         CEGUI_THROW(AlreadyExistsException("RenderEffectManager::addEffect: "
    00176             "A RenderEffect is already registered under the name '" +
    00177             name + "'"));
    00178
    00179     // create an instance of a factory to create effects of type T
    00180     d_effectRegistry[name] = new TplRenderEffectFactory<T>;
    00181
    00182     Logger::getSingleton().logEvent(
    00183         "Registered RenderEffect named '" + name + "'");
    00184 }
    00185
    00186 //---------------------------------------------------------------------------//
    00187
    00188
    00189 } // End of  CEGUI namespace section
    00190
    00191 #if defined(_MSC_VER)
    00192 #       pragma warning(pop)
    00193 #endif
    00194
    00195 #endif  // end of guard _CEGUIRenderEffectManager_h_
    00196