\section{Basic\-Dynamic\-Class\-Factory Class Reference}
\label{class_basic_dynamic_class_factory}\index{BasicDynamicClassFactory@{BasicDynamicClassFactory}}
Manages dynamic class aggregation.  


{\tt \#include $<$Basic\-Dynamic\-Class\-Factory.h$>$}

Collaboration diagram for Basic\-Dynamic\-Class\-Factory:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=153pt]{class_basic_dynamic_class_factory__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Basic\-Dynamic\-Class\-Factory} ()
\item 
void $\ast$ {\bf create} ()
\begin{CompactList}\small\item\em This function will allocate one contiguous block of memory the size of the sum of the sizes of the registered class nodes. \item\end{CompactList}\item 
void {\bf destroy} (void $\ast$x)
\begin{CompactList}\small\item\em Deallocate a dynamic class. \item\end{CompactList}\item 
unsigned int {\bf get\-Class\-Size} ()
\begin{CompactList}\small\item\em The current total size of the dynamic class. \item\end{CompactList}\item 
unsigned int {\bf get\-Num\-Nodes} ()
\begin{CompactList}\small\item\em The current number of nodes in this dynamic class factory. \item\end{CompactList}\item 
unsigned int {\bf get\-Num\-Classes} ()
\begin{CompactList}\small\item\em The current number of existing instances of the dynamic class. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf register\-Node} ({\bf Basic\-Dynamic\-Class\-Node\-Base} $\ast$node)
\begin{CompactList}\small\item\em This function is only callable by {\bf Basic\-Dynamic\-Class\-Node\-Base}{\rm (p.\,\pageref{class_basic_dynamic_class_node_base})}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Private Attributes}
\begin{CompactItemize}
\item 
unsigned int {\bf class\-Size}
\item 
unsigned int {\bf num\-Classes}
\item 
{\bf Basic\-Array}$<$ {\bf Basic\-Dynamic\-Class\-Node\-Base} $\ast$ $>$ {\bf nodes}
\end{CompactItemize}


\subsection{Detailed Description}
Manages dynamic class aggregation. 

Basic\-Dynamic\-Class\-Node(s) can be be registered with an instance of a Basic\-Dynamic\-Class\-Factory to create type safe dynamically aggregated classes.

Pros: \begin{itemize}
\item Less memory usage, because the classes are all allocated as one block of memory. \item Data and functionality can be added on the fly allowing pluggins to augment classes after compile time. \end{itemize}


Cons: \begin{itemize}
\item Constructors and destructors are never called. This means classes like std::string can not be used as class nodes. Classes can be initialized by overriding {\bf Basic\-Dynamic\-Class\-Node::init()}{\rm (p.\,\pageref{class_basic_dynamic_class_node_a3})}. \item Classes with virtual members cannot be reliably used as class nodes. Virtual classes have an internal pointer to their class virtual table. Unless you can copy this internal pointer virtual classes with not work and may yield unexpected behavior. Assure that there are no virtual functions anywhere in the inheritance tree before registering a class as a dynamic class node. \end{itemize}


Don't use this class unless you know why and how to use it.

See also this similar class {\bf Basic\-Class\-Group\-Factory}{\rm (p.\,\pageref{class_basic_class_group_factory})}. 



\subsection{Constructor \& Destructor Documentation}
\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!BasicDynamicClassFactory@{BasicDynamicClassFactory}}
\index{BasicDynamicClassFactory@{BasicDynamicClassFactory}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Basic\-Dynamic\-Class\-Factory::Basic\-Dynamic\-Class\-Factory ()}\label{class_basic_dynamic_class_factory_a0}




\subsection{Member Function Documentation}
\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!create@{create}}
\index{create@{create}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void $\ast$ Basic\-Dynamic\-Class\-Factory::create ()}\label{class_basic_dynamic_class_factory_a1}


This function will allocate one contiguous block of memory the size of the sum of the sizes of the registered class nodes. 

If the registered class nodes have overridden the {\bf Basic\-Dynamic\-Class\-Node::init()}{\rm (p.\,\pageref{class_basic_dynamic_class_node_a3})} function it will be called first. WARNING the constructors of the dynamic class nodes are NOT called.

\begin{Desc}
\item[Returns:]A new instance of the dynamic class. \end{Desc}
\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!destroy@{destroy}}
\index{destroy@{destroy}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Basic\-Dynamic\-Class\-Factory::destroy (void $\ast$ {\em x})}\label{class_basic_dynamic_class_factory_a2}


Deallocate a dynamic class. 

WARNING the destructors are NOT called.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em x}]A pointer the the dynamic class do be destroyed. \end{description}
\end{Desc}
\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!getClassSize@{getClassSize}}
\index{getClassSize@{getClassSize}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int Basic\-Dynamic\-Class\-Factory::get\-Class\-Size ()\hspace{0.3cm}{\tt  [inline]}}\label{class_basic_dynamic_class_factory_a3}


The current total size of the dynamic class. 

\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!getNumClasses@{getNumClasses}}
\index{getNumClasses@{getNumClasses}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int Basic\-Dynamic\-Class\-Factory::get\-Num\-Classes ()\hspace{0.3cm}{\tt  [inline]}}\label{class_basic_dynamic_class_factory_a5}


The current number of existing instances of the dynamic class. 

\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!getNumNodes@{getNumNodes}}
\index{getNumNodes@{getNumNodes}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int Basic\-Dynamic\-Class\-Factory::get\-Num\-Nodes ()\hspace{0.3cm}{\tt  [inline]}}\label{class_basic_dynamic_class_factory_a4}


The current number of nodes in this dynamic class factory. 

\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!registerNode@{registerNode}}
\index{registerNode@{registerNode}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Basic\-Dynamic\-Class\-Factory::register\-Node ({\bf Basic\-Dynamic\-Class\-Node\-Base} $\ast$ {\em node})\hspace{0.3cm}{\tt  [protected]}}\label{class_basic_dynamic_class_factory_b0}


This function is only callable by {\bf Basic\-Dynamic\-Class\-Node\-Base}{\rm (p.\,\pageref{class_basic_dynamic_class_node_base})}. 

See {\bf Basic\-Dynamic\-Class\-Node\-Base::register\-Node()}{\rm (p.\,\pageref{class_basic_dynamic_class_node_base_a4})}. 

\subsection{Member Data Documentation}
\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!classSize@{classSize}}
\index{classSize@{classSize}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int {\bf Basic\-Dynamic\-Class\-Factory::class\-Size}\hspace{0.3cm}{\tt  [private]}}\label{class_basic_dynamic_class_factory_r0}


\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!nodes@{nodes}}
\index{nodes@{nodes}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Basic\-Array}$<${\bf Basic\-Dynamic\-Class\-Node\-Base} $\ast$$>$ {\bf Basic\-Dynamic\-Class\-Factory::nodes}\hspace{0.3cm}{\tt  [private]}}\label{class_basic_dynamic_class_factory_r2}


\index{BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}!numClasses@{numClasses}}
\index{numClasses@{numClasses}!BasicDynamicClassFactory@{Basic\-Dynamic\-Class\-Factory}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int {\bf Basic\-Dynamic\-Class\-Factory::num\-Classes}\hspace{0.3cm}{\tt  [private]}}\label{class_basic_dynamic_class_factory_r1}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf Basic\-Dynamic\-Class\-Factory.h}\item 
{\bf Basic\-Dynamic\-Class\-Factory.cpp}\end{CompactItemize}
