\hypertarget{_ogre_property_8h}{}\section{Ogre\+Property.\+h File Reference}
\label{_ogre_property_8h}\index{Ogre\+Property.\+h@{Ogre\+Property.\+h}}


O\+G\+RE\textquotesingle{}s property system allows you to associate values of arbitrary type with names, and have those values exposed via a self-\/describing interface.  


{\ttfamily \#include \char`\"{}Ogre\+Property\+Prerequisites.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}Ogre\+Any.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}Ogre\+String.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}Ogre\+Exception.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}Ogre\+Quaternion.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}Ogre\+Matrix4.\+h\char`\"{}}\newline
{\ttfamily \#include $<$functional$>$}\newline
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{class_ogre_1_1_property}{Ogre\+::\+Property$<$ T $>$}
\begin{DoxyCompactList}\small\item\em \hyperlink{class_ogre_1_1_property}{Property} instance with passthrough calls to a given object. \end{DoxyCompactList}\item 
class \hyperlink{class_ogre_1_1_property_base}{Ogre\+::\+Property\+Base}
\begin{DoxyCompactList}\small\item\em Base interface for an instance of a property. \end{DoxyCompactList}\item 
class \hyperlink{class_ogre_1_1_property_def}{Ogre\+::\+Property\+Def}
\begin{DoxyCompactList}\small\item\em Definition of a property of an object. \end{DoxyCompactList}\item 
class \hyperlink{class_ogre_1_1_property_set}{Ogre\+::\+Property\+Set}
\begin{DoxyCompactList}\small\item\em Defines a complete set of properties for a single object instance. \end{DoxyCompactList}\item 
struct \hyperlink{struct_ogre_1_1_property_value}{Ogre\+::\+Property\+Value}
\begin{DoxyCompactList}\small\item\em A simple structure designed just as a holder of property values between the instances of objects they might target. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Namespaces}
\begin{DoxyCompactItemize}
\item 
 \hyperlink{namespace_ogre}{Ogre}
\begin{DoxyCompactList}\small\item\em 

 This source file is part of O\+G\+RE (Object-\/oriented Graphics Rendering Engine) For the latest info, see \href{http://www.ogre3d.org/}{\tt http\+://www.\+ogre3d.\+org/} \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef General\+Allocated\+Object \hyperlink{group___property_gabf77d3dd844d261fb692cafe35cc7a07}{Ogre\+::\+Property\+Alloc}
\item 
typedef std\+::map$<$ String, Property\+Def $>$ \hyperlink{group___property_ga70904974d5ef352b14f57a7ecc739e7c}{Ogre\+::\+Property\+Def\+Map}
\begin{DoxyCompactList}\small\item\em Map from property name to shared definition. \end{DoxyCompactList}\item 
typedef std\+::map$<$ String, Property\+Value $>$ \hyperlink{group___property_gab85fed93c3a16a944fd7750b9ad5da38}{Ogre\+::\+Property\+Value\+Map}
\begin{DoxyCompactList}\small\item\em Defines a transferable map of properties using wrapped value types (\hyperlink{class_ogre_1_1_any}{Ogre\+::\+Any}) \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group___property_ga0883a5af9197151407965df0bacc4f3a}{Ogre\+::\+Property\+Type} \{ \newline
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa19d90ad1680589279aafec448c4e75d3}{Ogre\+::\+P\+R\+O\+P\+\_\+\+S\+H\+O\+RT} = 0, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa8807d302197c648340522a66196f46f1}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+S\+H\+O\+RT} = 1, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa93d4b54300df506764ebb8af6bf4d5c8}{Ogre\+::\+P\+R\+O\+P\+\_\+\+I\+NT} = 2, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa9fb3644ad2ce148f77291a0d3eaea6a1}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+I\+NT} = 3, 
\newline
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa3d3a41849ca836ff178c8f2618629794}{Ogre\+::\+P\+R\+O\+P\+\_\+\+L\+O\+NG} = 4, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aabb2c30d9d8af27d83d4aafed018aa84d}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+L\+O\+NG} = 5, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa269350183053663ed0e36a69b72dc4c8}{Ogre\+::\+P\+R\+O\+P\+\_\+\+R\+E\+AL} = 6, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa7964244e71bea1a0b721d42e6fa4ae53}{Ogre\+::\+P\+R\+O\+P\+\_\+\+S\+T\+R\+I\+NG} = 7, 
\newline
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa5f081dc286c25333c43e8467d6c7c8b6}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R2} = 8, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aacd225d4bbfbd47f0473b7d56f834f3b6}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R3} = 9, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aaa5b410ea31e3954eeba233240dfb67ec}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R4} = 10, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa4dbf2ba96cd6b8774fc4cd98b0bfca01}{Ogre\+::\+P\+R\+O\+P\+\_\+\+C\+O\+L\+O\+UR} = 11, 
\newline
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa4811d3c1f6bce61a13fedbcfa19e1b32}{Ogre\+::\+P\+R\+O\+P\+\_\+\+B\+O\+OL} = 12, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa161aabceab220d04e7aa8704ff8e5293}{Ogre\+::\+P\+R\+O\+P\+\_\+\+Q\+U\+A\+T\+E\+R\+N\+I\+ON} = 13, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa1a10d1f71eb0804ab6ec20a598a1ac93}{Ogre\+::\+P\+R\+O\+P\+\_\+\+M\+A\+T\+R\+I\+X3} = 14, 
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aad1ccdd4ffa8de819d5f96bac1a405a32}{Ogre\+::\+P\+R\+O\+P\+\_\+\+M\+A\+T\+R\+I\+X4} = 15, 
\newline
\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa593a0408d46ccf3061cb27c372b25e8d}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+K\+N\+O\+WN} = 999
 \}\begin{DoxyCompactList}\small\item\em The type of a property. \end{DoxyCompactList}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
O\+G\+RE\textquotesingle{}s property system allows you to associate values of arbitrary type with names, and have those values exposed via a self-\/describing interface. 

Unlike \hyperlink{class_ogre_1_1_string_interface}{Ogre\+::\+String\+Interface}, the values are passed as their native types without needing conversion to or from strings; they are simply wrapped in an \hyperlink{class_ogre_1_1_any}{Ogre\+::\+Any} and casts are performed to access them. \begin{DoxyParagraph}{}
Property values are actually not stored in this system; instead the property definitions reference getter \& setter methods which provide the \textquotesingle{}backing\textquotesingle{} for the property. This means you can directly expose features of your classes as properties without any duplication. 
\end{DoxyParagraph}
\begin{DoxyParagraph}{}
There are two aspects to exposing a property on your class. One is exposing the definition of the property (Property\+Def), which should be shared between all instances and probably stored in a static Property\+Def\+Map somewhere. The second is the instance \textquotesingle{}wiring\textquotesingle{} which ensures that a call to set a property calls a method on this particular instance of the class; this is formed by a number of Property instances, contained in a Property\+Set. Each Property has an explicit binding to getter and setter instance methods. 
\end{DoxyParagraph}
\begin{DoxyParagraph}{}
So, here\textquotesingle{}s an example of setting up properties on an instance\+:
\end{DoxyParagraph}

\begin{DoxyCode}
\textcolor{comment}{// Make sure the property definition is created }
\textcolor{comment}{// propertyDefs is a variable of type PropertyDefMap, shared between instances}
PropertyDefMap::iterator defi = propertyDefs.find(\textcolor{stringliteral}{"name"});
\textcolor{keywordflow}{if} (defi == propertyDefs.end())
\{
    defi = propertyDefs.insert(PropertyDefMap::value\_type(\textcolor{stringliteral}{"name"}, 
        PropertyDef(\textcolor{stringliteral}{"name"}, 
            \textcolor{stringliteral}{"The name of the object."}, \hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa7964244e71bea1a0b721d42e6fa4ae53}{PROP\_STRING}))).first;
\}
\textcolor{comment}{// This has established the property definition, and its description.}
\textcolor{comment}{// Now, we need to 'wire' a property instance for this object instance}
\textcolor{comment}{// We assume the class is called 'Foo' and the instance is pointed to by a variable called 'inst'}
\textcolor{comment}{// 'props' is a PropertySet, specific to the instance}
props.addProperty(
    \hyperlink{group___general_gab5fc1358fd5a889de0a06d07e45df1ff}{OGRE\_NEW} Property<String>(&(defi->second),
        std::bind(&Foo::getName, inst),
        std::bind(&Foo::setName, inst, \_1)));
\end{DoxyCode}
 