\section{ost::Mem\-Pager Class Reference} \label{classost_1_1_mem_pager}\index{ost::MemPager@{ost::MemPager}} The memory pager is used to allocate cumulative memory pages for storing object specific \char`\"{}persistant\char`\"{} data that is presumed to persist during the life of a given derived object.Accumulative object memory allocator. {\tt \#include $<$misc.h$>$} Inheritance diagram for ost::Mem\-Pager::\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=2cm]{classost_1_1_mem_pager} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{CompactItemize} \item int {\bf get\-Pages} (void) \begin{CompactList}\small\item\em Return the total number of pages that have been allocated for this memory pool. \item\end{CompactList}\end{CompactItemize} \subsection*{Protected Member Functions} \begin{CompactItemize} \item virtual void $\ast$ {\bf first} (size\_\-t size) \begin{CompactList}\small\item\em Allocate first workspace from paged memory. \item\end{CompactList}\item virtual void $\ast$ {\bf alloc} (size\_\-t size) \begin{CompactList}\small\item\em Allocate memory from either the currently active page, or allocate a new page for the object. \item\end{CompactList}\item char $\ast$ {\bf first} (char $\ast$str) \begin{CompactList}\small\item\em Allocate a string from the memory pager pool and copy the string into it's new memory area. \item\end{CompactList}\item char $\ast$ {\bf alloc} (const char $\ast$str) \begin{CompactList}\small\item\em Allocate a string from the memory pager pool and copy the string inti it's new memory area. \item\end{CompactList}\item {\bf Mem\-Pager} (size\_\-t pagesize=4096) \begin{CompactList}\small\item\em Create a paged memory pool for cumulative storage. \item\end{CompactList}\item void {\bf purge} (void) \begin{CompactList}\small\item\em purge the current memory pool. \item\end{CompactList}\item virtual {\bf $\sim$Mem\-Pager} () \begin{CompactList}\small\item\em Delete the memory pool and all allocated memory. \item\end{CompactList}\end{CompactItemize} \subsection*{Friends} \begin{CompactItemize} \item class {\bf String} \item class {\bf Mem\-Pager\-Object} \end{CompactItemize} \subsection*{Classes} \begin{CompactItemize} \item struct {\bf \_\-page} \end{CompactItemize} \subsection{Detailed Description} The memory pager is used to allocate cumulative memory pages for storing object specific \char`\"{}persistant\char`\"{} data that is presumed to persist during the life of a given derived object.Accumulative object memory allocator. When the object is destroyed, all accumulated data is automatically purged. There are a number of odd and specialized utility classes found in Common C++. The most common of these is the \char`\"{}Mem\-Pager\char`\"{} class. This is basically a class to enable page-grouped \char`\"{}cumulative\char`\"{} memory allocation; all accumulated allocations are dropped during the destructor. This class has found it's way in a lot of other utility classes in Common C++. \begin{Desc} \item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc} \subsection{Constructor \& Destructor Documentation} \index{ost::MemPager@{ost::Mem\-Pager}!MemPager@{MemPager}} \index{MemPager@{MemPager}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Mem\-Pager::Mem\-Pager (size\_\-t {\em pagesize} = {\tt 4096})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_mem_pager_5dc37c26af34d6f4c26e125eded3e2be} Create a paged memory pool for cumulative storage. This pool allocates memory in fixed \char`\"{}pagesize\char`\"{} chunks. Ideal performance is achived when the pool size matches the system page size. This pool can only exist in derived objects. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em pagesize}]page size to allocate chunks. \end{description} \end{Desc} \index{ost::MemPager@{ost::Mem\-Pager}!~MemPager@{$\sim$MemPager}} \index{~MemPager@{$\sim$MemPager}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Mem\-Pager::$\sim$Mem\-Pager ()\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_mem_pager_58dcf48146eca4ae2286706968fdf9c5} Delete the memory pool and all allocated memory. \subsection{Member Function Documentation} \index{ost::MemPager@{ost::Mem\-Pager}!alloc@{alloc}} \index{alloc@{alloc}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ ost::Mem\-Pager::alloc (const char $\ast$ {\em str})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_mem_pager_245b6c4181ccccbabc52f1c3451f2fb6} Allocate a string from the memory pager pool and copy the string inti it's new memory area. This checks only the last active page for available space before allocating a new page. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em str}]string to allocate and copy into paged memory pool. \end{description} \end{Desc} \begin{Desc} \item[Returns:]copy of string from allocated memory. \end{Desc} \index{ost::MemPager@{ost::Mem\-Pager}!alloc@{alloc}} \index{alloc@{alloc}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void$\ast$ ost::Mem\-Pager::alloc (size\_\-t {\em size})\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_mem_pager_3a03cb50bd4084ddbf6314ec0339d176} Allocate memory from either the currently active page, or allocate a new page for the object. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em size}]size of memory to allocate. \end{description} \end{Desc} \begin{Desc} \item[Returns:]pointer to allocated memory. \end{Desc} Reimplemented in {\bf ost::Shared\-Mem\-Pager} {\rm (p.\,\pageref{classost_1_1_shared_mem_pager_d5c3aad294fd247a972a72983dcf831b})}.\index{ost::MemPager@{ost::Mem\-Pager}!first@{first}} \index{first@{first}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ ost::Mem\-Pager::first (char $\ast$ {\em str})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_mem_pager_7ea4e6f82bffa66c994fcd10ebdee594} Allocate a string from the memory pager pool and copy the string into it's new memory area. This method allocates memory by first searching for an available page, and then allocating a new page if no space is found. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em str}]string to allocate and copy into paged memory pool. \end{description} \end{Desc} \begin{Desc} \item[Returns:]copy of string from allocated memory. \end{Desc} \index{ost::MemPager@{ost::Mem\-Pager}!first@{first}} \index{first@{first}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void$\ast$ ost::Mem\-Pager::first (size\_\-t {\em size})\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_mem_pager_2c82ac4c97fcba81c643966973e78d84} Allocate first workspace from paged memory. This method scans all currently allocated blocks for available space before adding new pages and hence is both slower and more efficient. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em size}]size of memory to allocate. \end{description} \end{Desc} \begin{Desc} \item[Returns:]pointer to allocated memory. \end{Desc} Reimplemented in {\bf ost::Shared\-Mem\-Pager} {\rm (p.\,\pageref{classost_1_1_shared_mem_pager_644a00d48052aff83a180523b205aa6f})}.\index{ost::MemPager@{ost::Mem\-Pager}!getPages@{getPages}} \index{getPages@{getPages}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Mem\-Pager::get\-Pages (void)\hspace{0.3cm}{\tt [inline]}}\label{classost_1_1_mem_pager_320897ecfca3e92378c45ec70aee58ba} Return the total number of pages that have been allocated for this memory pool. \begin{Desc} \item[Returns:]number of pages allocated. \end{Desc} \index{ost::MemPager@{ost::Mem\-Pager}!purge@{purge}} \index{purge@{purge}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Mem\-Pager::purge (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_mem_pager_5bfdb6f2d6f569ba08c32c59efb3a012} purge the current memory pool. Reimplemented in {\bf ost::Stack\-Pager} {\rm (p.\,\pageref{classost_1_1_stack_pager_c903c181770651ee8f42717892dd9fa4})}, and {\bf ost::Shared\-Mem\-Pager} {\rm (p.\,\pageref{classost_1_1_shared_mem_pager_fafb0b8ce31a2b1fdee64a5a9cadebc6})}. \subsection{Friends And Related Function Documentation} \index{ost::MemPager@{ost::Mem\-Pager}!MemPagerObject@{MemPagerObject}} \index{MemPagerObject@{MemPagerObject}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class {\bf Mem\-Pager\-Object}\hspace{0.3cm}{\tt [friend]}}\label{classost_1_1_mem_pager_c5ec8bc6fca4e4e6a8faa45d4b0a9d58} \index{ost::MemPager@{ost::Mem\-Pager}!String@{String}} \index{String@{String}!ost::MemPager@{ost::Mem\-Pager}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class {\bf String}\hspace{0.3cm}{\tt [friend]}}\label{classost_1_1_mem_pager_7fb804f7dc96dd9f705c84095f37f1ca} The documentation for this class was generated from the following file:\begin{CompactItemize} \item {\bf misc.h}\end{CompactItemize}