/usr/include/cegui-0.8.7/CEGUI/RenderEffectManager.h is in libcegui-mk2-dev 0.8.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | /***********************************************************************
created: Wed Dec 23 2009
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIRenderEffectManager_h_
#define _CEGUIRenderEffectManager_h_
#include "CEGUI/Singleton.h"
#include "CEGUI/IteratorBase.h"
#include "CEGUI/Logger.h"
#include "CEGUI/Exceptions.h"
#include "CEGUI/RenderEffectFactory.h"
#include <map>
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Singleton class that manages creation and destruction of RenderEffect based
objects.
*/
class CEGUIEXPORT RenderEffectManager :
public Singleton<RenderEffectManager>,
public AllocatedObject<RenderEffectManager>
{
private:
//! Collection type used for the render effect registry
typedef std::map<String, RenderEffectFactory*, StringFastLessCompare
CEGUI_MAP_ALLOC(String, RenderEffectFactory*)> RenderEffectRegistry;
//! Collection type to track which effects we created with which factories
typedef std::map<RenderEffect*, RenderEffectFactory*, std::less<RenderEffect*>
CEGUI_MAP_ALLOC(RenderEffect*, RenderEffectFactory*)> EffectCreatorMap;
//! Collection of registered render effects
RenderEffectRegistry d_effectRegistry;
//! Collection of effect instances we created (and the factory used)
EffectCreatorMap d_effects;
public:
//! Iterator type that iterates over entries in the RenderEffectRegistry
typedef ConstMapIterator<RenderEffectRegistry> RenderEffectIterator;
//! Constructor for RenderEffectManager objects.
RenderEffectManager();
//! Destructor for RenderEffectManager objects.
~RenderEffectManager();
/*!
\brief
Register a RenderEffect type with the system and associate it with the
identifier \a name.
This registers a RenderEffect based class, such that instances of that
class can subsequently be created by requesting an effect using the
specified identifier.
\tparam T
The RenderEffect based class to be instantiated when an effect is
requested using the identifier \a name.
\param name
String object describing the identifier that the RenderEffect based
class will be registered under.
\exception AlreadyExistsException
thrown if a RenderEffect is already registered using \a name.
*/
template <typename T>
void addEffect(const String& name);
/*!
\brief
Remove / unregister any RenderEffect using the specified identifier.
\param name
String object describing the identifier of the RenderEffect that is to
be removed / unregistered. If no such RenderEffect is present, no
action is taken.
\note
You should avoid removing RenderEffect types that are still in use.
Internally a factory system is employed for the creation and deletion
of RenderEffect objects; if an effect - and therefore it's factory - is
removed while instances are still active, it will not be possible to
safely delete those RenderEffect object instances.
*/
void removeEffect(const String& name);
/*!
\brief
Return whether a RenderEffect has been registered under the specified
name.
\param name
String object describing the identifier of a RenderEffect to test for.
\return
- true if a RenderEffect with the specified name is registered.
- false if no RenderEffect with the specified name is registered.
*/
bool isEffectAvailable(const String& name) const;
/*!
\brief
Create an instance of the RenderEffect based class identified by the
specified name.
\param name
String object describing the identifier of the RenderEffect based
class that is to be created.
\param window
Pointer to a Window object. Exactly how or if this is used will
depend upon the specific effect being created.
\return
Reference to the newly created RenderEffect.
\exception UnknownObjectException
thrown if no RenderEffect class has been registered using the
identifier \a name.
*/
RenderEffect& create(const String& name, Window* window);
/*!
\brief
Destroy the given RenderEffect object.
\note
This function will only destroy objects that were created via the
RenderEffectManager. Attempts to destroy objects created by other
means will result in an InvalidRequestException. This option was
chosen over silently ignoring the request in order to aid application
developers in thier debugging.
\param effect
Reference to the RenderEffect object that is to be destroyed.
\exception InvalidRequestException
thrown if \a effect was not created by the RenderEffectManager.
*/
void destroy(RenderEffect& effect);
};
//---------------------------------------------------------------------------//
template <typename T>
void RenderEffectManager::addEffect(const String& name)
{
if (isEffectAvailable(name))
CEGUI_THROW(AlreadyExistsException(
"A RenderEffect is already registered under the name '" +
name + "'"));
// create an instance of a factory to create effects of type T
d_effectRegistry[name] = CEGUI_NEW_AO TplRenderEffectFactory<T>;
Logger::getSingleton().logEvent(
"Registered RenderEffect named '" + name + "'");
}
//---------------------------------------------------------------------------//
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIRenderEffectManager_h_
|