OgreUserObjectBindings.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
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 OR COPYRIGHT HOLDERS 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 _UserObjectsBinding_H__
#define _UserObjectsBinding_H__
#include "OgrePrerequisites.h"
#include "OgreAny.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport UserObjectBindings : public GeneralAllocatedObject
{
public:
UserObjectBindings();
virtual ~UserObjectBindings();
void setUserAny(const Any& anything);
const Any& getUserAny(void) const;
void setUserAny(const String& key, const Any& anything);
const Any& getUserAny(const String& key) const;
void eraseUserAny(const String& key);
void clear() const;
static const Any& getEmptyUserAny() { return msEmptyAny; }
// Types.
protected:
typedef map<String, Any>::type UserObjectsMap;
typedef UserObjectsMap::iterator UserObjectsMapIterator;
typedef UserObjectsMap::const_iterator UserObjectsMapConstIterator;
class Attributes : public GeneralAllocatedObject
{
public:
Attributes() : mUserObjectsMap(NULL) {}
~Attributes()
{
if (mUserObjectsMap != NULL)
{
OGRE_DELETE mUserObjectsMap;
mUserObjectsMap = NULL;
}
}
Any mKeylessAny; // Will hold key less associated user object for fast access.
UserObjectsMap* mUserObjectsMap; // Will hold a map between user keys to user objects.
};
// Attributes.
private:
static Any msEmptyAny; // Shared empty any object.
mutable Attributes* mAttributes; // Class attributes - will be allocated on demand.
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::UserObjectBindings::msEmptyAny
static Any msEmptyAny
Definition: OgreUserObjectBindings.h:132
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::UserObjectBindings::getEmptyUserAny
static const Any & getEmptyUserAny()
Returns empty user any object.
Definition: OgreUserObjectBindings.h:100
Ogre::UserObjectBindings::UserObjectsMapConstIterator
UserObjectsMap::const_iterator UserObjectsMapConstIterator
Definition: OgreUserObjectBindings.h:106
Ogre::Any
Variant type that can hold Any other type.
Definition: OgreAny.h:56
Ogre::UserObjectBindings::Attributes::Attributes
Attributes()
Attribute storage ctor.
Definition: OgreUserObjectBindings.h:114
Ogre::UserObjectBindings::Attributes::mUserObjectsMap
UserObjectsMap * mUserObjectsMap
Definition: OgreUserObjectBindings.h:127
Ogre::UserObjectBindings::UserObjectsMapIterator
UserObjectsMap::iterator UserObjectsMapIterator
Definition: OgreUserObjectBindings.h:105
OgrePrerequisites.h
Ogre::map::type
std::map< K, V, P, A > type
Definition: OgrePrerequisites.h:536
Ogre::UserObjectBindings::Attributes
Internal class that uses as data storage container.
Definition: OgreUserObjectBindings.h:110
Ogre::UserObjectBindings::mAttributes
Attributes * mAttributes
Definition: OgreUserObjectBindings.h:133
Ogre::UserObjectBindings::Attributes::~Attributes
~Attributes()
Attribute storage dtor.
Definition: OgreUserObjectBindings.h:117
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
OgreHeaderSuffix.h
OgreAny.h
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::UserObjectBindings::Attributes::mKeylessAny
Any mKeylessAny
Definition: OgreUserObjectBindings.h:126
OgreHeaderPrefix.h
Ogre::UserObjectBindings
Class that provides convenient interface to establish a linkage between custom user application objec...
Definition: OgreUserObjectBindings.h:49
Ogre::UserObjectBindings::UserObjectsMap
map< String, Any >::type UserObjectsMap
Definition: OgreUserObjectBindings.h:104
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.