\section{Ptr$<$ T $>$ Class Template Reference}
\label{class_ptr}\index{Ptr@{Ptr}}
Smart pointer template.  


{\tt \#include $<$ptr.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Ptr} ()\label{class_ptr_6ee8960ac4395fc031bbccf00eea5725}

\begin{CompactList}\small\item\em Construct empty object. Analogy to \char`\"{}null\char`\"{}. \item\end{CompactList}\item 
{\bf Ptr} ({\bf TObject} $\ast$data)
\begin{CompactList}\small\item\em Start managing reference counting to {\bf TObject}{\rm (p.\,\pageref{class_t_object})} data. \item\end{CompactList}\item 
{\bf Ptr} (const {\bf Ptr} \&ptr)
\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
{\bf $\sim$Ptr} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
{\bf operator T $\ast$} (void)
\begin{CompactList}\small\item\em Retype instance to template class. \item\end{CompactList}\item 
{\bf TObject} $\ast$ {\bf as\-Object} ()
\begin{CompactList}\small\item\em Return managed object. \item\end{CompactList}\item 
bool {\bf is\-Null} () const 
\begin{CompactList}\small\item\em Test if managed object is NULL. \item\end{CompactList}\item 
T $\ast$ {\bf operator $\rightarrow$ } (void)
\begin{CompactList}\small\item\em Use for smart acces to methods of managed object. \item\end{CompactList}\item 
const T $\ast$ {\bf operator $\rightarrow$ } (void) const 
\begin{CompactList}\small\item\em Use for smart acces to methods of managed object. \item\end{CompactList}\item 
bool {\bf operator$<$} (const {\bf Ptr} \&ptr) const 
\begin{CompactList}\small\item\em Comparator. \item\end{CompactList}\item 
{\bf Ptr} \& {\bf operator=} (const {\bf Ptr} \&ptr)
\begin{CompactList}\small\item\em Assign operator. \item\end{CompactList}\item 
{\bf Ptr} \& {\bf operator=} ({\bf TObject} $\ast$ptr)
\begin{CompactList}\small\item\em Assign operator. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class T$>$ class Ptr$<$ T $>$}

Smart pointer template. 

Manages reference couting for {\bf TObject}{\rm (p.\,\pageref{class_t_object})} and its subclasses. Example of usage: 

\footnotesize\begin{verbatim} {
    Ptr<MyClass> myClass=new MyClass();
 }
\end{verbatim}
\normalsize


my\-Class will be disposed when reference is lost, in our example at the end of the block.

\begin{Desc}
\item[Note:]Avoid circular references, reference circle will not be disposed until end of the program.\end{Desc}
\begin{Desc}
\item[See also:]{\bf TObject}{\rm (p.\,\pageref{class_t_object})}\end{Desc}
\begin{Desc}
\item[Date:]01-13-2006\end{Desc}
\begin{Desc}
\item[Author:]Ondrej Svejdar\end{Desc}
\begin{Desc}
\item[{\bf Todo}]\end{Desc}
\begin{Desc}
\item[{\bf Bug}]\end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{Ptr@{Ptr}!Ptr@{Ptr}}
\index{Ptr@{Ptr}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}$<$ T $>$::{\bf Ptr} ({\bf TObject} $\ast$ {\em data})\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_88dba6f2a1850b9c5522fa800e1e99e7}


Start managing reference counting to {\bf TObject}{\rm (p.\,\pageref{class_t_object})} data. 

If data is not NULL, increase data reference's counter by one. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]pointer to {\bf TObject}{\rm (p.\,\pageref{class_t_object})} \end{description}
\end{Desc}
\index{Ptr@{Ptr}!Ptr@{Ptr}}
\index{Ptr@{Ptr}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}$<$ T $>$::{\bf Ptr} (const {\bf Ptr}$<$ T $>$ \& {\em ptr})\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_ee84cb79ba0b2142b9fd2d51c759d3e8}


Copy constructor. 

Set inner pointer to point to the same {\bf TObject}{\rm (p.\,\pageref{class_t_object})} as in ptr and increase reference's counter by one. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]reference to Ptr class \end{description}
\end{Desc}
\index{Ptr@{Ptr}!~Ptr@{$\sim$Ptr}}
\index{~Ptr@{$\sim$Ptr}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}$<$ T $>$::$\sim${\bf Ptr} ()\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_bca1997a878ebd9b07fd248319d4ff45}


Destructor. 

Decrease reference counter of managed {\bf TObject}{\rm (p.\,\pageref{class_t_object})} by one. \begin{Desc}
\item[Returns:]\end{Desc}


\subsection{Member Function Documentation}
\index{Ptr@{Ptr}!asObject@{asObject}}
\index{asObject@{asObject}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf TObject}$\ast$ {\bf Ptr}$<$ T $>$::as\-Object ()\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_6b8d8e8edf3a26986550c516623ea925}


Return managed object. 

\begin{Desc}
\item[Returns:]managed object \end{Desc}
\index{Ptr@{Ptr}!isNull@{isNull}}
\index{isNull@{isNull}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ bool {\bf Ptr}$<$ T $>$::is\-Null () const\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_82e7528a7e17e50160e5fb205e6d88a4}


Test if managed object is NULL. 

\begin{Desc}
\item[Returns:]true if instance is NULL \end{Desc}
\index{Ptr@{Ptr}!operator T *@{operator T $\ast$}}
\index{operator T *@{operator T $\ast$}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}$<$ T $>$::operator T $\ast$ (void)\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_b9b94b0d8c4ee8cf78bf30c4d70d9cf8}


Retype instance to template class. 

\begin{Desc}
\item[Returns:]pointer to managed object \end{Desc}
\index{Ptr@{Ptr}!operator->@{operator-$>$}}
\index{operator->@{operator-$>$}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ const T$\ast$ {\bf Ptr}$<$ T $>$::operator $\rightarrow$  (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_95e4fca01db85723dac7104c31b60274}


Use for smart acces to methods of managed object. 

Example: 

\footnotesize\begin{verbatim} Ptr<MyClass> myClass=new MyClass();
 myClass->foo();
\end{verbatim}
\normalsize
 \begin{Desc}
\item[Returns:]pointer to managed object \end{Desc}
\index{Ptr@{Ptr}!operator->@{operator-$>$}}
\index{operator->@{operator-$>$}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ T$\ast$ {\bf Ptr}$<$ T $>$::operator $\rightarrow$  (void)\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_2ecbacd615d808c3893ef253046a7473}


Use for smart acces to methods of managed object. 

Example: 

\footnotesize\begin{verbatim} Ptr<MyClass> myClass=new MyClass();
 myClass->foo();
\end{verbatim}
\normalsize
 \begin{Desc}
\item[Returns:]pointer to managed object \end{Desc}
\index{Ptr@{Ptr}!operator<@{operator$<$}}
\index{operator<@{operator$<$}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ bool {\bf Ptr}$<$ T $>$::operator$<$ (const {\bf Ptr}$<$ T $>$ \& {\em ptr}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_7f10eeecc3a5c767fe79bbf058fecfed}


Comparator. 

For enable usage of generic Ptr classes in the STL container classes. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]reference to Ptr \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if this instance is \char`\"{}less than\char`\"{} ptr \end{Desc}
\index{Ptr@{Ptr}!operator=@{operator=}}
\index{operator=@{operator=}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}\& {\bf Ptr}$<$ T $>$::operator= ({\bf TObject} $\ast$ {\em ptr})\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_d2c95ce721510be7568c2807081169a4}


Assign operator. 

Decrease reference counter of currently managed object, set managed object to managed object referenced by ptr, and increase it's reference counter. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]reference to Ptr \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]reference to this \end{Desc}
\index{Ptr@{Ptr}!operator=@{operator=}}
\index{operator=@{operator=}!Ptr@{Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf Ptr}\& {\bf Ptr}$<$ T $>$::operator= (const {\bf Ptr}$<$ T $>$ \& {\em ptr})\hspace{0.3cm}{\tt  [inline]}}\label{class_ptr_7a952e8d9b8d400430c4dd0f2d5de674}


Assign operator. 

Decrease reference counter of currently managed object, set managed object to managed object referenced by ptr, and increase it's reference counter. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]reference to Ptr \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]reference to this \end{Desc}


The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
H:/projs/dot\-NET/eda/src/ptr.h\end{CompactItemize}
