\hypertarget{_ogre_property_8h}{}\doxysection{Ogre\+Property.\+h File Reference}
\label{_ogre_property_8h}\index{OgreProperty.h@{OgreProperty.h}}
{\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
\doxysubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \mbox{\hyperlink{class_ogre_1_1_property}{Ogre\+::\+Property$<$ T $>$}}
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{class_ogre_1_1_property}{Property}} instance with passthrough calls to a given object. \end{DoxyCompactList}\item 
class \mbox{\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 \mbox{\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 \mbox{\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 \mbox{\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}
\doxysubsection*{Namespaces}
\begin{DoxyCompactItemize}
\item 
 \mbox{\hyperlink{namespace_ogre}{Ogre}}
\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef General\+Allocated\+Object \mbox{\hyperlink{group___property_gabf77d3dd844d261fb692cafe35cc7a07}{Ogre\+::\+Property\+Alloc}}
\item 
typedef std\+::map$<$ String, Property\+Def $>$ \mbox{\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 $>$ \mbox{\hyperlink{group___property_gab85fed93c3a16a944fd7750b9ad5da38}{Ogre\+::\+Property\+Value\+Map}}
\begin{DoxyCompactList}\small\item\em Defines a transferable map of properties using wrapped value types (\mbox{\hyperlink{class_ogre_1_1_any}{Ogre\+::\+Any}}) \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{group___property_ga0883a5af9197151407965df0bacc4f3a}{Ogre\+::\+Property\+Type}} \{ \newline
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa19d90ad1680589279aafec448c4e75d3}{Ogre\+::\+P\+R\+O\+P\+\_\+\+S\+H\+O\+RT}} = 0, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa8807d302197c648340522a66196f46f1}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+S\+H\+O\+RT}} = 1, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa93d4b54300df506764ebb8af6bf4d5c8}{Ogre\+::\+P\+R\+O\+P\+\_\+\+I\+NT}} = 2, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa9fb3644ad2ce148f77291a0d3eaea6a1}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+I\+NT}} = 3, 
\newline
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa3d3a41849ca836ff178c8f2618629794}{Ogre\+::\+P\+R\+O\+P\+\_\+\+L\+O\+NG}} = 4, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aabb2c30d9d8af27d83d4aafed018aa84d}{Ogre\+::\+P\+R\+O\+P\+\_\+\+U\+N\+S\+I\+G\+N\+E\+D\+\_\+\+L\+O\+NG}} = 5, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa269350183053663ed0e36a69b72dc4c8}{Ogre\+::\+P\+R\+O\+P\+\_\+\+R\+E\+AL}} = 6, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa7964244e71bea1a0b721d42e6fa4ae53}{Ogre\+::\+P\+R\+O\+P\+\_\+\+S\+T\+R\+I\+NG}} = 7, 
\newline
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa5f081dc286c25333c43e8467d6c7c8b6}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R2}} = 8, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aacd225d4bbfbd47f0473b7d56f834f3b6}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R3}} = 9, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aaa5b410ea31e3954eeba233240dfb67ec}{Ogre\+::\+P\+R\+O\+P\+\_\+\+V\+E\+C\+T\+O\+R4}} = 10, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa4dbf2ba96cd6b8774fc4cd98b0bfca01}{Ogre\+::\+P\+R\+O\+P\+\_\+\+C\+O\+L\+O\+UR}} = 11, 
\newline
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa4811d3c1f6bce61a13fedbcfa19e1b32}{Ogre\+::\+P\+R\+O\+P\+\_\+\+B\+O\+OL}} = 12, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa161aabceab220d04e7aa8704ff8e5293}{Ogre\+::\+P\+R\+O\+P\+\_\+\+Q\+U\+A\+T\+E\+R\+N\+I\+ON}} = 13, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aa1a10d1f71eb0804ab6ec20a598a1ac93}{Ogre\+::\+P\+R\+O\+P\+\_\+\+M\+A\+T\+R\+I\+X3}} = 14, 
\mbox{\hyperlink{group___property_gga0883a5af9197151407965df0bacc4f3aad1ccdd4ffa8de819d5f96bac1a405a32}{Ogre\+::\+P\+R\+O\+P\+\_\+\+M\+A\+T\+R\+I\+X4}} = 15, 
\newline
\mbox{\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}


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