\section{KShared Class Reference}
\label{classKShared}\index{KShared@{KShared}}
Reference counting for shared objects.  


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

Inheritance diagram for KShared:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=312pt]{classKShared__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KShared} ()
\item 
{\bf KShared} (const {\bf KShared} \&)
\item 
{\bf KShared} \& {\bf operator=} (const {\bf KShared} \&)
\item 
void {\bf \_\-KShared\_\-ref} () const 
\item 
void {\bf \_\-KShared\_\-unref} () const 
\item 
int {\bf \_\-KShared\_\-count} () const 
\end{CompactItemize}


\subsection{Detailed Description}
Reference counting for shared objects. 

If you derive your object from this class, then you may use it in conjunction with {\bf KShared\-Ptr}{\rm (p.\,\pageref{classKSharedPtr})} to control the lifetime of your object.

Specifically, all classes that derive from KShared have an internal counter keeping track of how many other objects have a reference to their object. If used with {\bf KShared\-Ptr}{\rm (p.\,\pageref{classKSharedPtr})}, then your object will not be deleted until all references to the object have been released.

You should probably not ever use any of the methods in this class directly -- let the {\bf KShared\-Ptr}{\rm (p.\,\pageref{classKSharedPtr})} take care of that. Just derive your class from KShared and forget about it.

\begin{Desc}
\item[Author:]Waldo Bastian $<${\tt bastian@kde.org}$>$ \end{Desc}




Definition at line 40 of file ksharedptr.h.

\subsection{Constructor \& Destructor Documentation}
\index{KShared@{KShared}!KShared@{KShared}}
\index{KShared@{KShared}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KShared::KShared ()\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a0}


Standard constructor. 

This will initialize the reference count on this object to 0. 

Definition at line 46 of file ksharedptr.h.\index{KShared@{KShared}!KShared@{KShared}}
\index{KShared@{KShared}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KShared::KShared (const {\bf KShared} \&)\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a1}


Copy constructor. 

This will {\em not\/} actually copy the objects but it will initialize the reference count on this object to 0. 

Definition at line 52 of file ksharedptr.h.

\subsection{Member Function Documentation}
\index{KShared@{KShared}!operator=@{operator=}}
\index{operator=@{operator=}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KShared}\& KShared::operator= (const {\bf KShared} \&)\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a2}


Overloaded assignment operator. 



Definition at line 57 of file ksharedptr.h.\index{KShared@{KShared}!_KShared_ref@{\_\-KShared\_\-ref}}
\index{_KShared_ref@{\_\-KShared\_\-ref}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KShared::\_\-KShared\_\-ref () const\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a3}


Increases the reference count by one. 



Definition at line 62 of file ksharedptr.h.\index{KShared@{KShared}!_KShared_unref@{\_\-KShared\_\-unref}}
\index{_KShared_unref@{\_\-KShared\_\-unref}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KShared::\_\-KShared\_\-unref () const\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a4}


Releases a reference (decreases the reference count by one). 

If the count goes to 0, this object will delete itself. 

Definition at line 68 of file ksharedptr.h.\index{KShared@{KShared}!_KShared_count@{\_\-KShared\_\-count}}
\index{_KShared_count@{\_\-KShared\_\-count}!KShared@{KShared}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KShared::\_\-KShared\_\-count () const\hspace{0.3cm}{\tt  [inline]}}\label{classKShared_a5}


Return the current number of references held. 

\begin{Desc}
\item[Returns:]Number of references \end{Desc}


Definition at line 75 of file ksharedptr.h.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
ksharedptr.h\end{CompactItemize}
