\section{S\-I\-O\-:\-:L\-C\-I\-O\-Random\-Access\-Mgr Class Reference}
\label{classSIO_1_1LCIORandomAccessMgr}\index{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr@{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr}}


Manager class for L\-C\-I\-O direct access.  




{\ttfamily \#include $<$S\-I\-O/\-L\-C\-I\-O\-Random\-Access\-Mgr.\-h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
long64 {\bf get\-Position} (const {\bf Run\-Event} \&re)
\begin{DoxyCompactList}\small\item\em Return the position of the specified Event record or Run record respectively (if Event\-Num == -\/1 ). \end{DoxyCompactList}\item 
void {\bf add} (const {\bf Run\-Event} \&re, long64 pos)\label{classSIO_1_1LCIORandomAccessMgr_aa79f2028915e7c28097ef9872b8a9d4a}

\begin{DoxyCompactList}\small\item\em Add a new entry to the event map -\/ if the \doxyref{Run\-Event}{p.}{structSIO_1_1RunEvent} already exists the new position will be stored. \end{DoxyCompactList}\item 
bool {\bf create\-Event\-Map} (S\-I\-O\-\_\-stream $\ast$s)\label{classSIO_1_1LCIORandomAccessMgr_aa22518ba18fe0c6c237e180f5569db74}

\begin{DoxyCompactList}\small\item\em Get the run and event header map from the stream -\/ either by reading the random access records or by recreating it for old files. \end{DoxyCompactList}\item 
const {\bf Run\-Event\-Map} \& {\bf get\-Event\-Map} ()\label{classSIO_1_1LCIORandomAccessMgr_a6f31a9ad803936fd0a3db69dd319f83a}

\begin{DoxyCompactList}\small\item\em Return the event map -\/ it will be empty, if not yet created. \end{DoxyCompactList}\item 
bool {\bf init\-Append} (S\-I\-O\-\_\-stream $\ast$s)\label{classSIO_1_1LCIORandomAccessMgr_a2c528efdc82345c9f382f1cb00c5d6ce}

\begin{DoxyCompactList}\small\item\em Initialize random access for append mode\-: read last \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} record if it exists -\/ recreate the \doxyref{Run\-Event}{p.}{structSIO_1_1RunEvent} map from the file if not (old files). \end{DoxyCompactList}\item 
void {\bf write\-Random\-Access\-Records} (S\-I\-O\-\_\-stream $\ast$stream)\label{classSIO_1_1LCIORandomAccessMgr_a83bd5a171be7c6a4eb731ca287b9e1b8}

\begin{DoxyCompactList}\small\item\em Write the current random access records L\-C\-I\-O\-Index and \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} to the stream. \end{DoxyCompactList}\item 
void {\bf clear} ()\label{classSIO_1_1LCIORandomAccessMgr_aec21839680a2b66bfc9a69f4b74b7c03}

\begin{DoxyCompactList}\small\item\em Clear all lists and maps before closing a file. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf L\-C\-I\-O\-Random\-Access} $\ast$ {\bf create\-From\-Event\-Map} ()
\begin{DoxyCompactList}\small\item\em Prepare an \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} object from the current contents of \doxyref{Run\-Event\-Map}{p.}{classSIO_1_1RunEventMap} (all file locations set to 0). \end{DoxyCompactList}\item 
void {\bf add\-L\-C\-I\-O\-Random\-Access} ({\bf L\-C\-I\-O\-Random\-Access} $\ast$ra)\label{classSIO_1_1LCIORandomAccessMgr_a6438067ac6b06f423d0637e4c9678cad}

\begin{DoxyCompactList}\small\item\em Add a new \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} object to the list. \end{DoxyCompactList}\item 
bool {\bf read\-L\-C\-I\-O\-Random\-Access\-At} (S\-I\-O\-\_\-stream $\ast$stream, long64 pos)\label{classSIO_1_1LCIORandomAccessMgr_af5838c09e3cbf2152381ced0e1888e42}

\begin{DoxyCompactList}\small\item\em Read the \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} record at the specified position. \end{DoxyCompactList}\item 
bool {\bf read\-L\-C\-I\-O\-Index\-At} (S\-I\-O\-\_\-stream $\ast$stream, long64 pos)\label{classSIO_1_1LCIORandomAccessMgr_a6ffb74d4d7df5357f2ae57e917d516dd}

\begin{DoxyCompactList}\small\item\em Read the L\-C\-I\-O\-Index record at the specified position. \end{DoxyCompactList}\item 
bool {\bf recreate\-Event\-Map} (S\-I\-O\-\_\-stream $\ast$)\label{classSIO_1_1LCIORandomAccessMgr_a8c544219dd33c996fa5e82ae2fbe3ff2}

\begin{DoxyCompactList}\small\item\em Fill the \doxyref{Run\-Event\-Map}{p.}{classSIO_1_1RunEventMap} from the event and run header records in the file. \end{DoxyCompactList}\item 
bool {\bf read\-L\-C\-I\-O\-Random\-Access} (S\-I\-O\-\_\-stream $\ast$stream)\label{classSIO_1_1LCIORandomAccessMgr_a5676cfddd58d7aa586b124b8312d80fa}

\begin{DoxyCompactList}\small\item\em Helper for reading the next \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} record (need preceeding call to L\-C\-S\-I\-O\-::seek() ) \end{DoxyCompactList}\item 
bool {\bf read\-L\-C\-I\-O\-Index} (S\-I\-O\-\_\-stream $\ast$stream)\label{classSIO_1_1LCIORandomAccessMgr_afabc708223ef94dc5012d434bec670dd}

\begin{DoxyCompactList}\small\item\em Helper for reading the next L\-C\-I\-O\-Index record (need preceeding call to L\-C\-S\-I\-O\-::seek() ) \end{DoxyCompactList}\item 
void {\bf create\-File\-Record} ()\label{classSIO_1_1LCIORandomAccessMgr_a591a4a63690ddb089efd1b4fd950e25f}

\begin{DoxyCompactList}\small\item\em Create file record from all \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} records. \end{DoxyCompactList}\item 
const {\bf L\-C\-I\-O\-Random\-Access} $\ast$ {\bf last\-L\-C\-I\-O\-Random\-Access} ()\label{classSIO_1_1LCIORandomAccessMgr_af2e9eb82d9df658b8d9d2065bb599f36}

\begin{DoxyCompactList}\small\item\em Pointer to the last \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} in the list. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
{\bf Run\-Event\-Map} {\bfseries \-\_\-run\-Evt\-Map}\label{classSIO_1_1LCIORandomAccessMgr_a7f3b72a124954493f48379f56f41c6ad}

\item 
std\-::list$<$ {\bf L\-C\-I\-O\-Random\-Access} $\ast$ $>$ {\bfseries \-\_\-list}\label{classSIO_1_1LCIORandomAccessMgr_ae44b7984196877a3f3bf96df8d420377}

\item 
{\bf L\-C\-I\-O\-Random\-Access} $\ast$ {\bfseries \-\_\-file\-Record}\label{classSIO_1_1LCIORandomAccessMgr_afca6c52ec8d9fc51aa38e91bc4004ad9}

\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
class {\bfseries S\-I\-O\-Index\-Handler}\label{classSIO_1_1LCIORandomAccessMgr_aa42e173c31d69c19d4d5878e980b0fbf}

\item 
class {\bfseries S\-I\-O\-Random\-Access\-Handler}\label{classSIO_1_1LCIORandomAccessMgr_a4e0ba2ab2cd2a1229619865ae1a1556e}

\item 
std\-::ostream \& {\bfseries operator$<$$<$} (std\-::ostream \&os, const {\bf L\-C\-I\-O\-Random\-Access\-Mgr} \&ra)\label{classSIO_1_1LCIORandomAccessMgr_a78c9cdda75803fc52756aa8314e33609}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Manager class for L\-C\-I\-O direct access. 

Provides the functionality for reading and writing the \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} and L\-C\-I\-O\-Index records as needed by \doxyref{S\-I\-O\-Reader}{p.}{classSIO_1_1SIOReader} and \doxyref{S\-I\-O\-Writer}{p.}{classSIO_1_1SIOWriter}. Direct Access is implemented through appending L\-C\-I\-O\-Index and \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} and records to the end of the L\-C\-I\-O file. The L\-C\-I\-O\-Index records hold the locations of the Run\-Header and Event\-Header in the file and are referenced by corresponding \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} records. The last record in the file will always be an \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} record -\/ and previous records can be found through pointers to the previous record (simply linked list). \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} are always stored uncompressed. When reading a file with direct access mode a \doxyref{Run\-Event}{p.}{structSIO_1_1RunEvent} map is created by reading all \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} and L\-C\-I\-O\-Index records or -\/ for old files -\/ is recreated from all Run\-Header and Event\-Header records in the file. If an old file is opened in A\-P\-P\-E\-N\-D mode the corresponding records are created and written at the end on close() \begin{DoxySeeAlso}{See Also}
\doxyref{write\-Random\-Access\-Records()}{p.}{classSIO_1_1LCIORandomAccessMgr_a83bd5a171be7c6a4eb731ca287b9e1b8}. \-: currently the last \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} record is found by seeking a fixed size from the end -\/ need to store the actual length as last word in the file for future changes of the records length
\end{DoxySeeAlso}
\begin{DoxyAuthor}{Author}
gaede 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}

\end{DoxyVersion}
\begin{DoxyParagraph}{Id\-:}
\doxyref{L\-C\-I\-O\-Random\-Access\-Mgr.\-h}{p.}{LCIORandomAccessMgr_8h_source},v 1.\-3 2011-\/03-\/03 16\-:00\-:12 gaede Exp 
\end{DoxyParagraph}


\subsection{Member Function Documentation}
\index{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr@{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr}!create\-From\-Event\-Map@{create\-From\-Event\-Map}}
\index{create\-From\-Event\-Map@{create\-From\-Event\-Map}!SIO::LCIORandomAccessMgr@{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr}}
\subsubsection[{create\-From\-Event\-Map}]{\setlength{\rightskip}{0pt plus 5cm}{\bf L\-C\-I\-O\-Random\-Access} $\ast$ S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr\-::create\-From\-Event\-Map (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classSIO_1_1LCIORandomAccessMgr_ad43a3f95df18b730ff05e345ea236529}


Prepare an \doxyref{L\-C\-I\-O\-Random\-Access}{p.}{classSIO_1_1LCIORandomAccess} object from the current contents of \doxyref{Run\-Event\-Map}{p.}{classSIO_1_1RunEventMap} (all file locations set to 0). 



Referenced by write\-Random\-Access\-Records().

\index{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr@{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr}!get\-Position@{get\-Position}}
\index{get\-Position@{get\-Position}!SIO::LCIORandomAccessMgr@{S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr}}
\subsubsection[{get\-Position}]{\setlength{\rightskip}{0pt plus 5cm}long64 S\-I\-O\-::\-L\-C\-I\-O\-Random\-Access\-Mgr\-::get\-Position (
\begin{DoxyParamCaption}
\item[{const {\bf Run\-Event} \&}]{re}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classSIO_1_1LCIORandomAccessMgr_a8b46f9e53a2deda315e27d66bc11ac44}


Return the position of the specified Event record or Run record respectively (if Event\-Num == -\/1 ). 

Returns Run\-Event\-Map\-::\-N\-Pos if no record found. 

References S\-I\-O\-::\-Run\-Event\-Map\-::get\-Position().



The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
L\-C\-I\-O\-Random\-Access\-Mgr.\-h\item 
L\-C\-I\-O\-Random\-Access\-Mgr.\-cc\end{DoxyCompactItemize}
