\hypertarget{class_ogre_1_1_singleton}{}\doxysection{Ogre\+::Singleton$<$ T $>$ Class Template Reference}
\label{class_ogre_1_1_singleton}\index{Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}}


Template class for creating single-\/instance global classes.  




{\ttfamily \#include $<$Ogre\+Singleton.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_ogre_1_1_singleton_a2b0622a1223ac3a0c6b9c53e787b8d93}{Singleton}} (void)
\item 
\mbox{\hyperlink{class_ogre_1_1_singleton_a9bc0518bb06d12629e287149cdcc4b5d}{$\sim$\+Singleton}} (void)
\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static T \& \mbox{\hyperlink{class_ogre_1_1_singleton_a7757bd7ac3702c144502e53ad6491888}{get\+Singleton}} (void)
\begin{DoxyCompactList}\small\item\em Get the singleton instance. \end{DoxyCompactList}\item 
static T $\ast$ \mbox{\hyperlink{class_ogre_1_1_singleton_a7ab51c46521b89723d6186a52a7e0d7b}{get\+Singleton\+Ptr}} (void)
\begin{DoxyCompactList}\small\item\em Get the singleton instance. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\subsubsection*{template$<$typename T$>$\newline
class Ogre\+::\+Singleton$<$ T $>$}

Template class for creating single-\/instance global classes. 

This implementation {\bfseries [bilas2000automatic]} slightly derives from the textbook pattern, by requiring manual instantiation, instead of implicitly doing it in \mbox{\hyperlink{class_ogre_1_1_singleton_a7757bd7ac3702c144502e53ad6491888}{get\+Singleton}}. This is useful for classes that want to do some involved initialization, which should be done at a well defined time-\/point or need some additional parmeters in their constructor.

It also allows you to manage the singleton lifetime through R\+A\+II.

\begin{DoxyNote}{Note}
Be aware that \mbox{\hyperlink{class_ogre_1_1_singleton_a7757bd7ac3702c144502e53ad6491888}{get\+Singleton}} will fail before the global instance is created. (check via \mbox{\hyperlink{class_ogre_1_1_singleton_a7ab51c46521b89723d6186a52a7e0d7b}{get\+Singleton\+Ptr}}) 
\end{DoxyNote}


\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_ogre_1_1_singleton_a2b0622a1223ac3a0c6b9c53e787b8d93}\label{class_ogre_1_1_singleton_a2b0622a1223ac3a0c6b9c53e787b8d93}} 
\index{Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}!Singleton@{Singleton}}
\index{Singleton@{Singleton}!Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{Singleton()}{Singleton()}}
{\footnotesize\ttfamily template$<$typename T$>$ \\
\mbox{\hyperlink{class_ogre_1_1_singleton}{Ogre\+::\+Singleton}}$<$ T $>$\+::\mbox{\hyperlink{class_ogre_1_1_singleton}{Singleton}} (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

\mbox{\Hypertarget{class_ogre_1_1_singleton_a9bc0518bb06d12629e287149cdcc4b5d}\label{class_ogre_1_1_singleton_a9bc0518bb06d12629e287149cdcc4b5d}} 
\index{Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}!````~Singleton@{$\sim$Singleton}}
\index{````~Singleton@{$\sim$Singleton}!Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{$\sim$Singleton()}{~Singleton()}}
{\footnotesize\ttfamily template$<$typename T$>$ \\
\mbox{\hyperlink{class_ogre_1_1_singleton}{Ogre\+::\+Singleton}}$<$ T $>$\+::$\sim$\mbox{\hyperlink{class_ogre_1_1_singleton}{Singleton}} (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_ogre_1_1_singleton_a7757bd7ac3702c144502e53ad6491888}\label{class_ogre_1_1_singleton_a7757bd7ac3702c144502e53ad6491888}} 
\index{Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}!getSingleton@{getSingleton}}
\index{getSingleton@{getSingleton}!Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{getSingleton()}{getSingleton()}}
{\footnotesize\ttfamily template$<$typename T$>$ \\
static T\& \mbox{\hyperlink{class_ogre_1_1_singleton}{Ogre\+::\+Singleton}}$<$ T $>$\+::get\+Singleton (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the singleton instance. 

\mbox{\Hypertarget{class_ogre_1_1_singleton_a7ab51c46521b89723d6186a52a7e0d7b}\label{class_ogre_1_1_singleton_a7ab51c46521b89723d6186a52a7e0d7b}} 
\index{Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}!getSingletonPtr@{getSingletonPtr}}
\index{getSingletonPtr@{getSingletonPtr}!Ogre::Singleton$<$ T $>$@{Ogre::Singleton$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{getSingletonPtr()}{getSingletonPtr()}}
{\footnotesize\ttfamily template$<$typename T$>$ \\
static T$\ast$ \mbox{\hyperlink{class_ogre_1_1_singleton}{Ogre\+::\+Singleton}}$<$ T $>$\+::get\+Singleton\+Ptr (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the singleton instance. 



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{_ogre_singleton_8h}{Ogre\+Singleton.\+h}}\end{DoxyCompactItemize}
