\section{ost::Shared\-File Class Reference} \label{classost_1_1_shared_file}\index{ost::SharedFile@{ost::SharedFile}} This class defines a database I/O file service that can be shared by multiple processes.This class defines a database I/O file service that can be shared by multiple processes. {\tt \#include $<$file.h$>$} Inheritance diagram for ost::Shared\-File::\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=3cm]{classost_1_1_shared_file} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{CompactItemize} \item {\bf Shared\-File} (const char $\ast$path) \begin{CompactList}\small\item\em Open or create a new database file. \item\end{CompactList}\item {\bf Shared\-File} (const {\bf Shared\-File} \&file) \begin{CompactList}\small\item\em Create a shared file as a duplicate of an existing shared file. \item\end{CompactList}\item virtual {\bf $\sim$Shared\-File} () \begin{CompactList}\small\item\em Close and finish a database file. \item\end{CompactList}\item {\bf Error} {\bf restart} (void) \begin{CompactList}\small\item\em Restart an existing database; close and re-open. \item\end{CompactList}\item {\bf Error} {\bf fetch} (char $\ast$address=NULL, {\bf ccxx\_\-size\_\-t} length=0, off\_\-t position=-1) \begin{CompactList}\small\item\em Lock and Fetch a portion of the file into physical memory. \item\end{CompactList}\item {\bf Error} {\bf update} (char $\ast$address=NULL, {\bf ccxx\_\-size\_\-t} length=0, off\_\-t position=-1) \begin{CompactList}\small\item\em Update a portion of a file from physical memory. \item\end{CompactList}\item {\bf Error} {\bf clear} ({\bf ccxx\_\-size\_\-t} length=0, off\_\-t pos=-1) \begin{CompactList}\small\item\em Clear a lock held from a previous fetch operation without updating. \item\end{CompactList}\item {\bf Error} {\bf append} (char $\ast$address=NULL, {\bf ccxx\_\-size\_\-t} length=0) \begin{CompactList}\small\item\em Add new data to the end of the file. \item\end{CompactList}\item off\_\-t {\bf get\-Position} (void) \begin{CompactList}\small\item\em Fetch the current file position marker for this thread. \item\end{CompactList}\item bool {\bf operator++} (void) \item bool {\bf operator--} (void) \end{CompactItemize} \subsection{Detailed Description} This class defines a database I/O file service that can be shared by multiple processes.This class defines a database I/O file service that can be shared by multiple processes. Each thread should access a dup of the database object, and mutex locks can be used to preserve transaction integrety if multiple threads are used. {\bf Shared\-File}{\rm (p.\,\pageref{classost_1_1_shared_file})} is used when a database may be shared between multiple processes. {\bf Shared\-File}{\rm (p.\,\pageref{classost_1_1_shared_file})} automatically applies low level byte-range \char`\"{}file locks\char`\"{}, and provides an interface to fetch and release byte-range locked portions of a file. \begin{Desc} \item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc} \subsection{Constructor \& Destructor Documentation} \index{ost::SharedFile@{ost::Shared\-File}!SharedFile@{SharedFile}} \index{SharedFile@{SharedFile}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Shared\-File::Shared\-File (const char $\ast$ {\em path})}\label{classost_1_1_shared_file_c5b43aef08de67e5f8fd88bf7e5f6a80} Open or create a new database file. You should also use Initial. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em path}]pathname of database to open. \end{description} \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!SharedFile@{SharedFile}} \index{SharedFile@{SharedFile}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Shared\-File::Shared\-File (const {\bf Shared\-File} \& {\em file})}\label{classost_1_1_shared_file_c13ee6d8e5fb10dcf5ce6e9e12f54ae9} Create a shared file as a duplicate of an existing shared file. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em file}]original file. \end{description} \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!~SharedFile@{$\sim$SharedFile}} \index{~SharedFile@{$\sim$SharedFile}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Shared\-File::$\sim$Shared\-File ()\hspace{0.3cm}{\tt [virtual]}}\label{classost_1_1_shared_file_4001a868611c75292113daded7c0a585} Close and finish a database file. \subsection{Member Function Documentation} \index{ost::SharedFile@{ost::Shared\-File}!append@{append}} \index{append@{append}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Shared\-File::append (char $\ast$ {\em address} = {\tt NULL}, {\bf ccxx\_\-size\_\-t} {\em length} = {\tt 0})}\label{classost_1_1_shared_file_7169520f6cabe7de4626ab2b0c1d138f} Add new data to the end of the file. Locks file during append. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em address}]address to use, or NULL if same as last I/O. \item[{\em length}]length to use, or 0 if same as last I/O. \end{description} \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!clear@{clear}} \index{clear@{clear}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Shared\-File::clear ({\bf ccxx\_\-size\_\-t} {\em length} = {\tt 0}, off\_\-t {\em pos} = {\tt -1})}\label{classost_1_1_shared_file_c36a90105fb7435b498dcd72fa2473dd} Clear a lock held from a previous fetch operation without updating. \begin{Desc} \item[Returns:]err\-Success on success. \end{Desc} \begin{Desc} \item[Parameters:] \begin{description} \item[{\em length}]length to use, or 0 if same as last I/O. \item[{\em pos}]file position to use or -1 if same as last I/O. \end{description} \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!fetch@{fetch}} \index{fetch@{fetch}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Shared\-File::fetch (char $\ast$ {\em address} = {\tt NULL}, {\bf ccxx\_\-size\_\-t} {\em length} = {\tt 0}, off\_\-t {\em position} = {\tt -1})}\label{classost_1_1_shared_file_a4f875ec058a85297a62e30af397d014} Lock and Fetch a portion of the file into physical memory. This can use state information to fetch the current record multiple times. \begin{Desc} \item[Returns:]err\-Success on success. \end{Desc} \begin{Desc} \item[Parameters:] \begin{description} \item[{\em address}]address to use, or NULL if same as last I/O. \item[{\em length}]length to use, or 0 if same as last I/O. \item[{\em position}]file position to use -1 if same as last I/O. \end{description} \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!getPosition@{getPosition}} \index{getPosition@{getPosition}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}off\_\-t ost::Shared\-File::get\-Position (void)}\label{classost_1_1_shared_file_b7ac91d6a8ded5c7236297784353a300} Fetch the current file position marker for this thread. \begin{Desc} \item[Returns:]file position offset. \end{Desc} \index{ost::SharedFile@{ost::Shared\-File}!operator++@{operator++}} \index{operator++@{operator++}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Shared\-File::operator++ (void)}\label{classost_1_1_shared_file_a7a0de19328f2d2c2ed8d06f7e5fa884} \index{ost::SharedFile@{ost::Shared\-File}!operator--@{operator--}} \index{operator--@{operator--}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Shared\-File::operator-- (void)}\label{classost_1_1_shared_file_9bab1e7719f2f608d719e99125bdc8e8} \index{ost::SharedFile@{ost::Shared\-File}!restart@{restart}} \index{restart@{restart}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Shared\-File::restart (void)\hspace{0.3cm}{\tt [inline, virtual]}}\label{classost_1_1_shared_file_254c43de705b9ad9f5d24536b6cff1e0} Restart an existing database; close and re-open. \begin{Desc} \item[Returns:]err\-Success if successful. \end{Desc} Reimplemented from {\bf ost::Random\-File} {\rm (p.\,\pageref{classost_1_1_random_file_e78c71b1e3fab5861bc9fdae595829a7})}.\index{ost::SharedFile@{ost::Shared\-File}!update@{update}} \index{update@{update}!ost::SharedFile@{ost::Shared\-File}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Shared\-File::update (char $\ast$ {\em address} = {\tt NULL}, {\bf ccxx\_\-size\_\-t} {\em length} = {\tt 0}, off\_\-t {\em position} = {\tt -1})}\label{classost_1_1_shared_file_5ace5a51d0da7c56a252e3f26efeff67} Update a portion of a file from physical memory. This can use state information to commit the last read record. The current lock is also cleared. \begin{Desc} \item[Returns:]err\-Success on success. \end{Desc} \begin{Desc} \item[Parameters:] \begin{description} \item[{\em address}]address to use, or NULL if same as last I/O. \item[{\em length}]length to use, or 0 if same as last I/O. \item[{\em position}]file position to use or -1 if same as last I/O. \end{description} \end{Desc} The documentation for this class was generated from the following file:\begin{CompactItemize} \item {\bf file.h}\end{CompactItemize}