\hypertarget{QASC_8h}{
\section{QASC.h File Reference}
\label{QASC_8h}\index{QASC.h@{QASC.h}}
}
Interface to the ACD Software Counters. 



This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=158pt]{QASC_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{QASC_8h_a0}{
typedef enum \hyperlink{QASC_8h_a20}{\_\-QASC\_\-STATUS} \hyperlink{QASC_8h_a0}{QASC\_\-STATUS}}
\label{QASC_8h_a0}

\begin{CompactList}\small\item\em Typedef for enum \_\-QASC\_\-STATUS. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{QASC_8h_a20}{\_\-QASC\_\-STATUS} \{ \par
\hyperlink{QASC_8h_a20a1}{QASC\_\-STATUS\_\-SUCCESS} =  0, 
\par
\hyperlink{QASC_8h_a20a2}{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-TYPEID} =  -2, 
\par
\hyperlink{QASC_8h_a20a3}{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-VER} =  -3, 
\par
\hyperlink{QASC_8h_a20a4}{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER} =  -4, 
\par
\hyperlink{QASC_8h_a20a5}{QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32} =  -5, 
\par
\hyperlink{QASC_8h_a20a6}{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-TYPEID} =  -6, 
\par
\hyperlink{QASC_8h_a20a7}{QASC\_\-STATUS\_\-CTB\_\-WRONG\_\-TYPEID} =  -7, 
\par
\hyperlink{QASC_8h_a20a8}{QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL} =  -8
 \}
\begin{CompactList}\small\item\em Enumerates the varios status codes. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__QASC}{QASC} $\ast$ \hyperlink{QASC_8h_a9}{QASC\_\-alloc} (void $\ast$must\_\-be\_\-null)
\begin{CompactList}\small\item\em Allocates and constructs a QASC handle. \item\end{CompactList}\item 
const LSF\_\-contribution $\ast$ \hyperlink{QASC_8h_a10}{QASC\_\-update\-At\-Datagram} (\hyperlink{struct__QASC}{QASC} $\ast$qstd, const LSF\_\-datagram $\ast$dgm)
\begin{CompactList}\small\item\em Updates the context at datagram time. \item\end{CompactList}\item 
int \hyperlink{QASC_8h_a11}{QASC\_\-update\-At\-Contribution} (\hyperlink{struct__QASC}{QASC} $\ast$qstd, const LSF\_\-contribution $\ast$ctb)
\begin{CompactList}\small\item\em Updates the context at datagram time. \item\end{CompactList}\item 
int \hyperlink{QASC_8h_a12}{QASC\_\-update\-At\-Record} (\hyperlink{struct__QASC}{QASC} $\ast$qstd, const LSF\_\-record $\ast$rec)
\begin{CompactList}\small\item\em Updates the context at record time. \item\end{CompactList}\item 
void \hyperlink{QASC_8h_a13}{QASC\_\-destruct} (\hyperlink{struct__QASC}{QASC} $\ast$qstd)
\begin{CompactList}\small\item\em The destructor for a QASC control structure. \item\end{CompactList}\item 
const \hyperlink{struct__QASC__ctx}{QASC\_\-ctx} $\ast$ \hyperlink{QASC_8h_a14}{QASC\_\-ctx\-Get} (const \hyperlink{struct__QASC}{QASC} $\ast$qstd)
\begin{CompactList}\small\item\em Locates the statistics context (meta-data). \item\end{CompactList}\item 
int \hyperlink{QASC_8h_a15}{QASC\_\-sizeof} (void $\ast$must\_\-be\_\-null)
\begin{CompactList}\small\item\em Return the size, in bytes, of the buffer needed to handle a QASC datagram. \item\end{CompactList}\item 
\hyperlink{struct__QASC}{QASC} $\ast$ \hyperlink{QASC_8h_a16}{QASC\_\-construct} (\hyperlink{struct__QASC}{QASC} $\ast$qstd, void $\ast$must\_\-be\_\-null)
\begin{CompactList}\small\item\em The constructor for a QASC control structure. \item\end{CompactList}\item 
QASC\_\-status \hyperlink{QASC_8h_a17}{QASC\_\-expand} (\hyperlink{struct__QASC}{QASC} $\ast$qasc, const LSF\_\-contribution $\ast$ctb)
\begin{CompactList}\small\item\em Routine to check integrity and swap/uncompress input data into a 2nd buffer. \item\end{CompactList}\item 
int \hyperlink{QASC_8h_a18}{QASC\_\-idx\-Gem\-Get} (int group, int channel)
\begin{CompactList}\small\item\em Maps an ACD GEM group and channel into a universal index. \item\end{CompactList}\item 
int \hyperlink{QASC_8h_a19}{QASC\_\-idx\-Aem\-Get} (int board, int channel)
\begin{CompactList}\small\item\em Maps an ACD AEM board number and channel into a universal index. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface to the ACD Software Counters. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}   CVS $Id: QASC.h,v 1.1 2008/06/10 22:28:38 russell Exp $
\end{verbatim}
\normalsize


\subsection{Enumeration Type Documentation}
\hypertarget{QASC_8h_a20}{
\index{QASC.h@{QASC.h}!_QASC_STATUS@{\_\-QASC\_\-STATUS}}
\index{_QASC_STATUS@{\_\-QASC\_\-STATUS}!QASC.h@{QASC.h}}
\subsubsection[\_\-QASC\_\-STATUS]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{QASC_8h_a20}{\_\-QASC\_\-STATUS}}}
\label{QASC_8h_a20}


Enumerates the varios status codes. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{QASC_STATUS_SUCCESS@{QASC\_\-STATUS\_\-SUCCESS}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_SUCCESS@{QASC\_\-STATUS\_\-SUCCESS}}\item[{\em 
\hypertarget{QASC_8h_a20a1}{
QASC\_\-STATUS\_\-SUCCESS}
\label{QASC_8h_a20a1}
}]All is well \index{QASC_STATUS_DGM_UNKNOWN_TYPEID@{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-TYPEID}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_DGM_UNKNOWN_TYPEID@{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-TYPEID}}\item[{\em 
\hypertarget{QASC_8h_a20a2}{
QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-TYPEID}
\label{QASC_8h_a20a2}
}]LSF datagram header has typeid which is not in LSF/LSF\_\-ids.h \index{QASC_STATUS_DGM_UNKNOWN_VER@{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-VER}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_DGM_UNKNOWN_VER@{QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-VER}}\item[{\em 
\hypertarget{QASC_8h_a20a3}{
QASC\_\-STATUS\_\-DGM\_\-UNKNOWN\_\-VER}
\label{QASC_8h_a20a3}
}]LSF datagram header has an unknown version number \index{QASC_STATUS_CTB_UNKNOWN_VER@{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_CTB_UNKNOWN_VER@{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER}}\item[{\em 
\hypertarget{QASC_8h_a20a4}{
QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER}
\label{QASC_8h_a20a4}
}]LSF contributor header has unknown version number \index{QASC_STATUS_CTB_BAD_LEN32@{QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_CTB_BAD_LEN32@{QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32}}\item[{\em 
\hypertarget{QASC_8h_a20a5}{
QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32}
\label{QASC_8h_a20a5}
}]LSF contributor has an incorrect length for the packet \index{QASC_STATUS_CTB_UNKNOWN_TYPEID@{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-TYPEID}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_CTB_UNKNOWN_TYPEID@{QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-TYPEID}}\item[{\em 
\hypertarget{QASC_8h_a20a6}{
QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-TYPEID}
\label{QASC_8h_a20a6}
}]LSF contributor header has typeid which is not in QASC\_\-TYPEID \index{QASC_STATUS_CTB_WRONG_TYPEID@{QASC\_\-STATUS\_\-CTB\_\-WRONG\_\-TYPEID}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_CTB_WRONG_TYPEID@{QASC\_\-STATUS\_\-CTB\_\-WRONG\_\-TYPEID}}\item[{\em 
\hypertarget{QASC_8h_a20a7}{
QASC\_\-STATUS\_\-CTB\_\-WRONG\_\-TYPEID}
\label{QASC_8h_a20a7}
}]typeid of data does not match the QASC\_\-xxx\-Get\-Xxxx \index{QASC_STATUS_CTB_INFLATE_FAIL@{QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL}!QASC.h@{QASC.h}}\index{QASC.h@{QASC.h}!QASC_STATUS_CTB_INFLATE_FAIL@{QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL}}\item[{\em 
\hypertarget{QASC_8h_a20a8}{
QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL}
\label{QASC_8h_a20a8}
}]Decompression step failed \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{QASC_8h_a9}{
\index{QASC.h@{QASC.h}!QASC_alloc@{QASC\_\-alloc}}
\index{QASC_alloc@{QASC\_\-alloc}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-alloc]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__QASC}{QASC} $\ast$ QASC\_\-alloc (void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8h_a9}


Allocates and constructs a QASC handle. 

\begin{Desc}
\item[Returns:]Pointer to the allocated handle\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em must\_\-be\_\-null}]Reserved for future use.\end{description}
\end{Desc}
\hypertarget{QASC_8h_a16}{
\index{QASC.h@{QASC.h}!QASC_construct@{QASC\_\-construct}}
\index{QASC_construct@{QASC\_\-construct}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-construct]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__QASC}{QASC} $\ast$ QASC\_\-construct (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8h_a16}


The constructor for a QASC control structure. 

\begin{Desc}
\item[Returns:]Pointer to the QASC control structure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The control structure to be constructed. If NULL, a control structure will be allocated \item[{\em must\_\-be\_\-null}]Reserved for future use.\end{description}
\end{Desc}
\hypertarget{QASC_8h_a14}{
\index{QASC.h@{QASC.h}!QASC_ctxGet@{QASC\_\-ctxGet}}
\index{QASC_ctxGet@{QASC\_\-ctxGet}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-ctxGet]{\setlength{\rightskip}{0pt plus 5cm}const \hyperlink{struct__QASC__ctx}{QASC\_\-ctx} $\ast$ QASC\_\-ctx\-Get (const \hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc})}}
\label{QASC_8h_a14}


Locates the statistics context (meta-data). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The statistics context\end{description}
\end{Desc}
\hypertarget{QASC_8h_a13}{
\index{QASC.h@{QASC.h}!QASC_destruct@{QASC\_\-destruct}}
\index{QASC_destruct@{QASC\_\-destruct}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-destruct]{\setlength{\rightskip}{0pt plus 5cm}void QASC\_\-destruct (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc})}}
\label{QASC_8h_a13}


The destructor for a QASC control structure. 

\begin{Desc}
\item[Returns:]Pointer to the QSS control structure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The control structure to be destructed.\end{description}
\end{Desc}
\hypertarget{QASC_8h_a17}{
\index{QASC.h@{QASC.h}!QASC_expand@{QASC\_\-expand}}
\index{QASC_expand@{QASC\_\-expand}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-expand]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{QASC_8h_a0}{QASC\_\-STATUS} QASC\_\-expand (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QASC_8h_a17}


Routine to check integrity and swap/uncompress input data into a 2nd buffer. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em QASC\_\-STATUS\_\-SUCCESS,if}]successful (0) \item[{\em QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32,if}]the contributor length is inconsistent with the data. \item[{\em QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER,if}]the encoding/data format version is unknown.\item[{\em QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL,for}]compressed formats, indicates the failure to inflate the data\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The data access handle to be filled \item[{\em ctb}]Input buffer\end{description}
\end{Desc}
The check routine does integrity checks on the given LSF contributor packet and then decompress/swaps data into the output buffer. THe size of the output buffer is determined by \hyperlink{QASC_8h_a15}{QASC\_\-sizeof()}. The output buffer can then be used as input with the QASC\_\-xxxx\-Locate routines.

This routine assumes the contributor has been byte-swapped.\hypertarget{QASC_8h_a19}{
\index{QASC.h@{QASC.h}!QASC_idxAemGet@{QASC\_\-idxAemGet}}
\index{QASC_idxAemGet@{QASC\_\-idxAemGet}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-idxAemGet]{\setlength{\rightskip}{0pt plus 5cm}QASC\_\-idx\-Aem\-Get (int {\em board}, int {\em channel})}}
\label{QASC_8h_a19}


Maps an ACD AEM board number and channel into a universal index. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em $>$=0,The}]universal index for the specifed ACD AEM board and channel \item[{\em $<$}]0, Invalid board or channel number\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em board}]This is a value between 0 and 11 corresponding to the the 12 AEM FREE board/cable numbers\begin{itemize}
\item 0 1LA, 1 1RB\item 2 2LA, 3 2LB\item 4 2RA, 5 2RB\item 6 3LA, 7 3RB\item 8 4LA, 9 4LB\item 9 4RA, 10 4RB\end{itemize}
\item[{\em channel}]The channel, 0-18, within each FREE board/cable.\end{description}
\end{Desc}
\hypertarget{QASC_8h_a18}{
\index{QASC.h@{QASC.h}!QASC_idxGemGet@{QASC\_\-idxGemGet}}
\index{QASC_idxGemGet@{QASC\_\-idxGemGet}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-idxGemGet]{\setlength{\rightskip}{0pt plus 5cm}QASC\_\-idx\-Gem\-Get (int {\em group}, int {\em channel})}}
\label{QASC_8h_a18}


Maps an ACD GEM group and channel into a universal index. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em $>$=0,The}]universal index for the specifed ACD group and channel \item[{\em $<$}]0, Invalid list or channel number\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em group}]This is a value between 0 and 3 corresponding to the 4 words in the GEM record -0 XZ plane -1 YZ plane -2 XY plane -3 RU plane \item[{\em channel}]The channel, 0-31, within each list. The bits are numbered from least significant bit to most significant bit\end{description}
\end{Desc}
\hypertarget{QASC_8h_a15}{
\index{QASC.h@{QASC.h}!QASC_sizeof@{QASC\_\-sizeof}}
\index{QASC_sizeof@{QASC\_\-sizeof}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-sizeof]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-sizeof (void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8h_a15}


Return the size, in bytes, of the buffer needed to handle a QASC datagram. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em The}]size, in bytes, of the buffer needed to handle a QASC datagram\end{description}
\end{Desc}
\hypertarget{QASC_8h_a11}{
\index{QASC.h@{QASC.h}!QASC_updateAtContribution@{QASC\_\-updateAtContribution}}
\index{QASC_updateAtContribution@{QASC\_\-updateAtContribution}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-updateAtContribution]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-update\-At\-Contribution (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QASC_8h_a11}


Updates the context at datagram time. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em If}]have a statistics sample contribution, the number of records in the contribution. \item[{\em $>$0,if}]have a record contributor \item[{\em =0,if}]have the contribution context \item[{\em -1,if}]unrecognized\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The statistics context to update. \item[{\em ctb}]The statistics contribution\end{description}
\end{Desc}
\hypertarget{QASC_8h_a10}{
\index{QASC.h@{QASC.h}!QASC_updateAtDatagram@{QASC\_\-updateAtDatagram}}
\index{QASC_updateAtDatagram@{QASC\_\-updateAtDatagram}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-updateAtDatagram]{\setlength{\rightskip}{0pt plus 5cm}const LSF\_\-contribution $\ast$ QASC\_\-update\-At\-Datagram (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, const LSF\_\-datagram $\ast$ {\em dgm})}}
\label{QASC_8h_a10}


Updates the context at datagram time. 

\begin{Desc}
\item[Returns:]The contribution to resume processsing at\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The statistics context to update. \item[{\em dgm}]The statistics datagram\end{description}
\end{Desc}
\hypertarget{QASC_8h_a12}{
\index{QASC.h@{QASC.h}!QASC_updateAtRecord@{QASC\_\-updateAtRecord}}
\index{QASC_updateAtRecord@{QASC\_\-updateAtRecord}!QASC.h@{QASC.h}}
\subsubsection[QASC\_\-updateAtRecord]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-update\-At\-Record (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, const LSF\_\-record $\ast$ {\em rec})}}
\label{QASC_8h_a12}


Updates the context at record time. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em Non-negative}]values indicate are one of the QASC\_\-type's \item[{\em Negative}]values indicate an unsuccessful update\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The statistics context to update. \item[{\em rec}]The statistics record\end{description}
\end{Desc}
