\hypertarget{QASC_8c}{
\section{QASC.c File Reference}
\label{QASC_8c}\index{QASC.c@{QASC.c}}
}
Expand and access routines to the ACD Software Counters. 

{\tt \#include \char`\"{}QSSP/QASC.h\char`\"{}}\par
{\tt \#include \char`\"{}QSSP/QASC\_\-sample.h\char`\"{}}\par
{\tt \#include \char`\"{}QASC\_\-pvtdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}QSP/QFCP\_\-cache.h\char`\"{}}\par
{\tt \#include \char`\"{}QSD/QSD\_\-acd\-Map.h\char`\"{}}\par
{\tt \#include \char`\"{}QSD/QFC\_\-member.h\char`\"{}}\par
{\tt \#include \char`\"{}QSD/QFR\_\-file.h\char`\"{}}\par
{\tt \#include \char`\"{}EMP/ASC\_\-asc\-Ctb.h\char`\"{}}\par
{\tt \#include \char`\"{}EMP/ASC\_\-ids.h\char`\"{}}\par
{\tt \#include \char`\"{}LSF/LSF\_\-reason.h\char`\"{}}\par
{\tt \#include \char`\"{}EFC\_\-DB/EH\_\-ids.h\char`\"{}}\par
{\tt \#include \char`\"{}ZLIB/zlib.h\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Endianness.h\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Check.h\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Ofs.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par


Include dependency graph for QASC.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=349pt]{QASC_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{QASC_8c_a0}{
\#define {\bf NULL}~((void $\ast$)0)}
\label{QASC_8c_a0}

\item 
\#define \hyperlink{QASC_8c_a1}{RND\_\-8}(\_\-v)~((\_\-v + 7) \& $\sim$0x7)
\begin{CompactList}\small\item\em Rounds-up an integer to the nearest multiply of 8. This is used to set allocations to quadwords. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static \hyperlink{QASC_8h_a0}{QASC\_\-STATUS} \hyperlink{QASC_8c_a2}{expand\_\-raw0} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$qasc, const ASC\_\-asc\-Bdy\_\-Raw0 $\ast$asc, unsigned int size)
\begin{CompactList}\small\item\em Expand the ASC data in the raw format to QASC format. \item\end{CompactList}\item 
static \hyperlink{QASC_8h_a0}{QASC\_\-STATUS} \hyperlink{QASC_8c_a3}{expand\_\-gzip0} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$qasc, const ASC\_\-asc\-Bdy\_\-Gzip0 $\ast$asc, unsigned int size)
\begin{CompactList}\small\item\em Expand the ASC data in the raw format to QASC format. \item\end{CompactList}\item 
static int \hyperlink{QASC_8c_a4}{do\_\-inflate} (const void $\ast$src, unsigned int src\-Size, void $\ast$dst, unsigned int dst\-Size)
\begin{CompactList}\small\item\em Decompress the source buffer to the destination buffer. \item\end{CompactList}\item 
static void \hyperlink{QASC_8c_a5}{add\_\-samples} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$dst, const \hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$src)
\begin{CompactList}\small\item\em Adds the source sample, {\em src\/}, to the destination sample, {\em dst\/}. \item\end{CompactList}\item 
static \_\-\_\-inline QFCP\_\-cache $\ast$ \hyperlink{QASC_8c_a6}{qasc\_\-file\_\-cache\_\-get} (void)
\begin{CompactList}\small\item\em Returns a pointer to the file cache. \item\end{CompactList}\item 
\hyperlink{struct__QASC}{QASC} $\ast$ \hyperlink{QASC_8c_a7}{QASC\_\-alloc} (void $\ast$must\_\-be\_\-null)
\begin{CompactList}\small\item\em Allocates and constructs a QASC handle. \item\end{CompactList}\item 
\hyperlink{struct__QASC}{QASC} $\ast$ \hyperlink{QASC_8c_a8}{QASC\_\-construct} (\hyperlink{struct__QASC}{QASC} $\ast$qasc, void $\ast$must\_\-be\_\-null)
\begin{CompactList}\small\item\em The constructor for a QASC control structure. \item\end{CompactList}\item 
void \hyperlink{QASC_8c_a9}{QASC\_\-destruct} (\hyperlink{struct__QASC}{QASC} $\ast$qasc)
\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_8c_a10}{QASC\_\-ctx\-Get} (const \hyperlink{struct__QASC}{QASC} $\ast$qasc)
\begin{CompactList}\small\item\em Locates the statistics context (meta-data). \item\end{CompactList}\item 
int \hyperlink{QASC_8c_a11}{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 
QASC\_\-status \hyperlink{QASC_8c_a12}{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 
const LSF\_\-contribution $\ast$ \hyperlink{QASC_8c_a13}{QASC\_\-update\-At\-Datagram} (\hyperlink{struct__QASC}{QASC} $\ast$qasc, const LSF\_\-datagram $\ast$dgm)
\begin{CompactList}\small\item\em Updates the context at datagram time. \item\end{CompactList}\item 
int \hyperlink{QASC_8c_a14}{QASC\_\-update\-At\-Contribution} (\hyperlink{struct__QASC}{QASC} $\ast$qasc, const LSF\_\-contribution $\ast$ctb)
\begin{CompactList}\small\item\em Updates the context at datagram time. \item\end{CompactList}\item 
int \hyperlink{QASC_8c_a15}{QASC\_\-update\-At\-Record} (\hyperlink{struct__QASC}{QASC} $\ast$qasc, const LSF\_\-record $\ast$rec)
\begin{CompactList}\small\item\em Updates the context at record time. \item\end{CompactList}\item 
int \hyperlink{QASC_8c_a16}{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_8c_a17}{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}\item 
static \_\-\_\-inline void \hyperlink{QASC_8c_a18}{swap32b\-N} (unsigned int $\ast$d32, const unsigned int $\ast$s32, int n32)
\begin{CompactList}\small\item\em Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines. \item\end{CompactList}\item 
static \_\-\_\-inline int \hyperlink{QASC_8c_a19}{inflater} (const void $\ast$src, unsigned int src\-Size, void $\ast$dst, unsigned int dst\-Size)
\begin{CompactList}\small\item\em Decompress the source buffer to the destination buffe. \item\end{CompactList}\item 
static \_\-\_\-inline void \hyperlink{QASC_8c_a20}{point\-V0\_\-transfer} (\hyperlink{struct__QSSP__pointV0}{QSSP\_\-point\-V0} $\ast$dst, const EMP\_\-hdr\-Evt $\ast$src)
\begin{CompactList}\small\item\em Transfer an EMP\_\-hdr\-Evt structure to a QSSP\_\-point structure. \item\end{CompactList}\item 
static \_\-\_\-inline void \hyperlink{QASC_8c_a21}{span\_\-transfer} (\hyperlink{struct__QSSP__spanV1}{QSSP\_\-span\-V1} $\ast$dst, const EMP\_\-hdr $\ast$src)
\begin{CompactList}\small\item\em Transfers the contents of an EMP\_\-hdr structure to a QSSP\_\-span\-V1 structure. \item\end{CompactList}\item 
static void \_\-\_\-inline \hyperlink{QASC_8c_a22}{monitor\_\-transfer} (\hyperlink{struct__QASC__monitorV0}{QASC\_\-monitor\-V0} $\ast$dst, const ASC\_\-stats $\ast$src, unsigned int nsampled)
\begin{CompactList}\small\item\em Transfers the contents of an ASC\_\-stats structure plus the number of events sampled to a QASC\_\-monitor\-V0 structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Expand and access routines 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.c,v 1.2 2008/06/10 22:43:51 russell Exp $
\end{verbatim}
\normalsize


\subsection{Define Documentation}
\hypertarget{QASC_8c_a1}{
\index{QASC.c@{QASC.c}!RND_8@{RND\_\-8}}
\index{RND_8@{RND\_\-8}!QASC.c@{QASC.c}}
\subsubsection[RND\_\-8]{\setlength{\rightskip}{0pt plus 5cm}\#define RND\_\-8(\_\-v)~((\_\-v + 7) \& $\sim$0x7)}}
\label{QASC_8c_a1}


Rounds-up an integer to the nearest multiply of 8. This is used to set allocations to quadwords. 

\begin{Desc}
\item[Returns:]The rounded integer\end{Desc}


\subsection{Function Documentation}
\hypertarget{QASC_8c_a5}{
\index{QASC.c@{QASC.c}!add_samples@{add\_\-samples}}
\index{add_samples@{add\_\-samples}!QASC.c@{QASC.c}}
\subsubsection[add\_\-samples]{\setlength{\rightskip}{0pt plus 5cm}static void add\_\-samples (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$ {\em dst}, const \hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a5}


Adds the source sample, {\em src\/}, to the destination sample, {\em dst\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination sample \item[{\em src}]The source sample\end{description}
\end{Desc}
\hypertarget{QASC_8c_a4}{
\index{QASC.c@{QASC.c}!do_inflate@{do\_\-inflate}}
\index{do_inflate@{do\_\-inflate}!QASC.c@{QASC.c}}
\subsubsection[do\_\-inflate]{\setlength{\rightskip}{0pt plus 5cm}static int do\_\-inflate (const void $\ast$ {\em src}, unsigned int {\em src\-Size}, void $\ast$ {\em dst}, unsigned int {\em dst\-Size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a4}


Decompress the source buffer to the destination buffer. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success \item[{\em -1}]Failure\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source buffer of compressed data \item[{\em src\-Size}]The size, in bytes, of the source buffer of compressed data \item[{\em dst}]The destination buffer for decompressed data \item[{\em dst\-Size}]The available space, in bytes, of the destination buffer\end{description}
\end{Desc}
\hypertarget{QASC_8c_a3}{
\index{QASC.c@{QASC.c}!expand_gzip0@{expand\_\-gzip0}}
\index{expand_gzip0@{expand\_\-gzip0}!QASC.c@{QASC.c}}
\subsubsection[expand\_\-gzip0]{\setlength{\rightskip}{0pt plus 5cm}static \hyperlink{QASC_8h_a0}{QASC\_\-STATUS} expand\_\-gzip0 (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$ {\em qasc}, const ASC\_\-asc\-Bdy\_\-Gzip0 $\ast$ {\em asc}, unsigned int {\em size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a3}


Expand the ASC data in the raw format to QASC format. 

\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\_\-INFLATE\_\-FAIL,indicates}]inflate failed\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The data access handle to be filled \item[{\em asc}]The source data \item[{\em size}]The size, in bytes, of the source data.\end{description}
\end{Desc}
\hypertarget{QASC_8c_a2}{
\index{QASC.c@{QASC.c}!expand_raw0@{expand\_\-raw0}}
\index{expand_raw0@{expand\_\-raw0}!QASC.c@{QASC.c}}
\subsubsection[expand\_\-raw0]{\setlength{\rightskip}{0pt plus 5cm}static \hyperlink{QASC_8h_a0}{QASC\_\-STATUS} expand\_\-raw0 (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sample\-V0} $\ast$ {\em qasc}, const ASC\_\-asc\-Bdy\_\-Raw0 $\ast$ {\em asc}, unsigned int {\em size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a2}


Expand the ASC data in the raw format to QASC format. 

\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.\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The data access handle to be filled \item[{\em asc}]The source data \item[{\em size}]The size, in bytes, of the source data.\end{description}
\end{Desc}
\hypertarget{QASC_8c_a19}{
\index{QASC.c@{QASC.c}!inflater@{inflater}}
\index{inflater@{inflater}!QASC.c@{QASC.c}}
\subsubsection[inflater]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline int inflater (const void $\ast$ {\em src}, unsigned int {\em src\-Size}, void $\ast$ {\em dst}, unsigned int {\em dst\-Size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a19}


Decompress the source buffer to the destination buffe. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success \item[{\em -1}]Failure\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source buffer of compressed data \item[{\em src\-Size}]The size, in bytes, of the source buffer of compressed data \item[{\em dst}]The destination buffer for decompressed data \item[{\em dst\-Size}]The available space, in bytes, of the destination buffer\end{description}
\end{Desc}
\hypertarget{QASC_8c_a22}{
\index{QASC.c@{QASC.c}!monitor_transfer@{monitor\_\-transfer}}
\index{monitor_transfer@{monitor\_\-transfer}!QASC.c@{QASC.c}}
\subsubsection[monitor\_\-transfer]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline void monitor\_\-transfer (\hyperlink{struct__QASC__monitorV0}{QASC\_\-monitor\-V0} $\ast$ {\em dst}, const ASC\_\-stats $\ast$ {\em src}, unsigned int {\em nsampled})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a22}


Transfers the contents of an ASC\_\-stats structure plus the number of events sampled to a QASC\_\-monitor\-V0 structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination QASC\_\-monitor structure \item[{\em src}]The source ASC\_\-stats structure \item[{\em nsampled}]The number of events sampled\end{description}
\end{Desc}
The QASC\_\-monitor structure is not a mirror of an ASC\_\-stats, having the number of events sampled as an additional member. Because of this a formalized transfer method is needed.\hypertarget{QASC_8c_a20}{
\index{QASC.c@{QASC.c}!pointV0_transfer@{pointV0\_\-transfer}}
\index{pointV0_transfer@{pointV0\_\-transfer}!QASC.c@{QASC.c}}
\subsubsection[pointV0\_\-transfer]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline void point\-V0\_\-transfer (\hyperlink{struct__QSSP__pointV0}{QSSP\_\-point\-V0} $\ast$ {\em dst}, const EMP\_\-hdr\-Evt $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a20}


Transfer an EMP\_\-hdr\-Evt structure to a QSSP\_\-point structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination QSSP\_\-point structure \item[{\em src}]The source EMP\_\-hdr\-Evt structure\end{description}
\end{Desc}
\hypertarget{QASC_8c_a7}{
\index{QASC.c@{QASC.c}!QASC_alloc@{QASC\_\-alloc}}
\index{QASC_alloc@{QASC\_\-alloc}!QASC.c@{QASC.c}}
\subsubsection[QASC\_\-alloc]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__QASC}{QASC}$\ast$ QASC\_\-alloc (void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8c_a7}


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_8c_a8}{
\index{QASC.c@{QASC.c}!QASC_construct@{QASC\_\-construct}}
\index{QASC_construct@{QASC\_\-construct}!QASC.c@{QASC.c}}
\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_8c_a8}


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_8c_a10}{
\index{QASC.c@{QASC.c}!QASC_ctxGet@{QASC\_\-ctxGet}}
\index{QASC_ctxGet@{QASC\_\-ctxGet}!QASC.c@{QASC.c}}
\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_8c_a10}


Locates the statistics context (meta-data). 

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


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_8c_a12}{
\index{QASC.c@{QASC.c}!QASC_expand@{QASC\_\-expand}}
\index{QASC_expand@{QASC\_\-expand}!QASC.c@{QASC.c}}
\subsubsection[QASC\_\-expand]{\setlength{\rightskip}{0pt plus 5cm}QASC\_\-status QASC\_\-expand (\hyperlink{struct__QASC}{QASC} $\ast$ {\em qasc}, const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QASC_8c_a12}


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_8c_a6}{
\index{QASC.c@{QASC.c}!qasc_file_cache_get@{qasc\_\-file\_\-cache\_\-get}}
\index{qasc_file_cache_get@{qasc\_\-file\_\-cache\_\-get}!QASC.c@{QASC.c}}
\subsubsection[qasc\_\-file\_\-cache\_\-get]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline QFCP\_\-cache $\ast$ qasc\_\-file\_\-cache\_\-get (void)\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a6}


Returns a pointer to the file cache. 

\begin{Desc}
\item[Returns:]The file cache\end{Desc}
This routine return the handle, creating it if necessary. This not really the right architecture. This needs to be part of a QSS global environment. This can't be accomplished at this time because it would require a backwardly incompatiable change to QSSP\_\-construct.\hypertarget{QASC_8c_a17}{
\index{QASC.c@{QASC.c}!QASC_idxAemGet@{QASC\_\-idxAemGet}}
\index{QASC_idxAemGet@{QASC\_\-idxAemGet}!QASC.c@{QASC.c}}
\subsubsection[QASC\_\-idxAemGet]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-idx\-Aem\-Get (int {\em board}, int {\em channel})}}
\label{QASC_8c_a17}


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_8c_a16}{
\index{QASC.c@{QASC.c}!QASC_idxGemGet@{QASC\_\-idxGemGet}}
\index{QASC_idxGemGet@{QASC\_\-idxGemGet}!QASC.c@{QASC.c}}
\subsubsection[QASC\_\-idxGemGet]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-idx\-Gem\-Get (int {\em group}, int {\em channel})}}
\label{QASC_8c_a16}


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_8c_a11}{
\index{QASC.c@{QASC.c}!QASC_sizeof@{QASC\_\-sizeof}}
\index{QASC_sizeof@{QASC\_\-sizeof}!QASC.c@{QASC.c}}
\subsubsection[QASC\_\-sizeof]{\setlength{\rightskip}{0pt plus 5cm}int QASC\_\-sizeof (void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8c_a11}


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_8c_a14}{
\index{QASC.c@{QASC.c}!QASC_updateAtContribution@{QASC\_\-updateAtContribution}}
\index{QASC_updateAtContribution@{QASC\_\-updateAtContribution}!QASC.c@{QASC.c}}
\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_8c_a14}


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_8c_a13}{
\index{QASC.c@{QASC.c}!QASC_updateAtDatagram@{QASC\_\-updateAtDatagram}}
\index{QASC_updateAtDatagram@{QASC\_\-updateAtDatagram}!QASC.c@{QASC.c}}
\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_8c_a13}


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_8c_a15}{
\index{QASC.c@{QASC.c}!QASC_updateAtRecord@{QASC\_\-updateAtRecord}}
\index{QASC_updateAtRecord@{QASC\_\-updateAtRecord}!QASC.c@{QASC.c}}
\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_8c_a15}


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}
\hypertarget{QASC_8c_a21}{
\index{QASC.c@{QASC.c}!span_transfer@{span\_\-transfer}}
\index{span_transfer@{span\_\-transfer}!QASC.c@{QASC.c}}
\subsubsection[span\_\-transfer]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline void span\_\-transfer (\hyperlink{struct__QSSP__spanV1}{QSSP\_\-span\-V1} $\ast$ {\em dst}, const EMP\_\-hdr $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a21}


Transfers the contents of an EMP\_\-hdr structure to a QSSP\_\-span\-V1 structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination QSSP\_\-span\-V1 structure \item[{\em src}]The source EMP\_\-hdr structure\end{description}
\end{Desc}
Because the EMP structure contains 64-bit long long, and because the alignment of these is compiler dependent, they cannot be simply copied to one another. Hence the need for a formalized transfer routine.

\begin{Desc}
\item[Note:]This is not part of the public interface.\end{Desc}
\hypertarget{QASC_8c_a18}{
\index{QASC.c@{QASC.c}!swap32bN@{swap32bN}}
\index{swap32bN@{swap32bN}!QASC.c@{QASC.c}}
\subsubsection[swap32bN]{\setlength{\rightskip}{0pt plus 5cm}void swap32b\-N (unsigned int $\ast$ {\em d32}, const unsigned int $\ast$ {\em s32}, int {\em n32})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a18}


Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em d32}]The destinatin array of 32-bit swapped words \item[{\em s32}]The source array of 32-bit words to swap \item[{\em n32}]The number of words to word swap\end{description}
\end{Desc}
