\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 $<$QSSP/QASC.h$>$}\par
{\tt \#include $<$QSSP/QASC\_\-sample.h$>$}\par
{\tt \#include $<$QASC\_\-pvtdefs.h$>$}\par
{\tt \#include $<$QSP/QFCP\_\-cache.h$>$}\par
{\tt \#include $<$QSD/QSD\_\-acdMap.h$>$}\par
{\tt \#include $<$QSD/QFC\_\-member.h$>$}\par
{\tt \#include $<$QSD/QFR\_\-file.h$>$}\par
{\tt \#include $<$EMP/ASC\_\-ascCtb.h$>$}\par
{\tt \#include $<$EMP/ASC\_\-ids.h$>$}\par
{\tt \#include $<$LSF/LSF\_\-reason.h$>$}\par
{\tt \#include $<$EFC\_\-DB/EH\_\-ids.h$>$}\par
{\tt \#include $<$ZLIB/zlib.h$>$}\par
{\tt \#include $<$PBI/Endianness.h$>$}\par
{\tt \#include $<$PBI/Check.h$>$}\par
{\tt \#include $<$PBI/Ofs.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{QASC_8c_070d2ce7b6bb7e5c05602aa8c308d0c4}{
\#define \textbf{NULL}~((void $\ast$)0)}
\label{QASC_8c_070d2ce7b6bb7e5c05602aa8c308d0c4}

\item 
\#define \hyperlink{QASC_8c_d3d66fd81edd50e3afade4ccec9a466a}{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_a5769cb617f641ec3aeafad7ba900886}{QASC\_\-STATUS} \hyperlink{QASC_8c_a4d9329b0e5d11ae7df71cbc09c584f3}{expand\_\-raw0} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sampleV0} $\ast$qasc, const ASC\_\-ascBdy\_\-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_a5769cb617f641ec3aeafad7ba900886}{QASC\_\-STATUS} \hyperlink{QASC_8c_f23f419783535db4d7301b97817dfa37}{expand\_\-gzip0} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sampleV0} $\ast$qasc, const ASC\_\-ascBdy\_\-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_0dfe4c72ddbd4bc32a49e6599d9f0b27}{do\_\-inflate} (const void $\ast$src, unsigned int srcSize, void $\ast$dst, unsigned int dstSize)
\begin{CompactList}\small\item\em Decompress the source buffer to the destination buffer. \item\end{CompactList}\item 
static void \hyperlink{QASC_8c_82f4670b1d5dc6cdc19e4881f7d1303d}{add\_\-samples} (\hyperlink{struct__QASC__sampleV0}{QASC\_\-sampleV0} $\ast$dst, const \hyperlink{struct__QASC__sampleV0}{QASC\_\-sampleV0} $\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_94dbfeb9698fca623b2c1e2c25a224dc}{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_bc1a5a34c3fc8653315c72389e2ee8cd}{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_afb25cc8b4e47266f1914efa2497c97a}{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_d30225ae7369d841c189d6c136ec71c6}{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_ea39bee07e84f327d65b18ad0080b727}{QASC\_\-ctxGet} (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_e0afab546828ae4ffafb70c91eeadcb3}{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_e6802741addd0c897edb78af763a4499}{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_7d762267a0fe85a84eb204e47f12a026}{QASC\_\-updateAtDatagram} (\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_5393c94cbbec2d5066143e279b2157ed}{QASC\_\-updateAtContribution} (\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_4e7fb1926e13fdb3bbff033f3cd9ccc7}{QASC\_\-updateAtRecord} (\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_2fba9159c1751511d6ed0287cc0d3d1a}{QASC\_\-idxGemGet} (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_a1959c0eae410d02d3885e08bc09c3fe}{QASC\_\-idxAemGet} (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_bfc2d739236cc8f3c366bc247e4ea019}{swap32bN} (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_0c7b5faa7dea1f6777d3c6dac02ce68c}{inflater} (const void $\ast$src, unsigned int srcSize, void $\ast$dst, unsigned int dstSize)
\begin{CompactList}\small\item\em Decompress the source buffer to the destination buffe. \item\end{CompactList}\item 
static \_\-\_\-inline void \hyperlink{QASC_8c_737f923a2a241807cb89912f9473fb11}{pointV0\_\-transfer} (\hyperlink{struct__QSSP__pointV0}{QSSP\_\-pointV0} $\ast$dst, const EMP\_\-hdrEvt $\ast$src)
\begin{CompactList}\small\item\em Transfer an EMP\_\-hdrEvt structure to a QSSP\_\-point structure. \item\end{CompactList}\item 
static \_\-\_\-inline void \hyperlink{QASC_8c_01fef2ccc23a30feb2727d39d5b783a1}{span\_\-transfer} (\hyperlink{struct__QSSP__spanV1}{QSSP\_\-spanV1} $\ast$dst, const EMP\_\-hdr $\ast$src)
\begin{CompactList}\small\item\em Transfers the contents of an EMP\_\-hdr structure to a QSSP\_\-spanV1 structure. \item\end{CompactList}\item 
static void \_\-\_\-inline \hyperlink{QASC_8c_a8bd4f254667a11962b0d8b939992c65}{monitor\_\-transfer} (\hyperlink{struct__QASC__monitorV0}{QASC\_\-monitorV0} $\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\_\-monitorV0 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.4 2011/03/29 00:14:57 russell Exp $
\end{verbatim}
\normalsize
 

\subsection{Define Documentation}
\hypertarget{QASC_8c_d3d66fd81edd50e3afade4ccec9a466a}{
\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_d3d66fd81edd50e3afade4ccec9a466a}


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}


Referenced by qasc\_\-file\_\-cache\_\-get(), and qstd\_\-file\_\-cache\_\-get().

\subsection{Function Documentation}
\hypertarget{QASC_8c_82f4670b1d5dc6cdc19e4881f7d1303d}{
\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 ({\bf QASC\_\-sampleV0} $\ast$ {\em dst}, \/  const {\bf QASC\_\-sampleV0} $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_82f4670b1d5dc6cdc19e4881f7d1303d}


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}


References \_\-QASC\_\-monitorV0::etotal, \_\-QASC\_\-monitorV0::frequency, \_\-QASC\_\-sampleV0::monitor, QSSP\_\-spanV1Update(), \_\-QASC\_\-sampleV0::span, and \_\-QASC\_\-sampleV0::statistics.

Referenced by QASC\_\-expand().\hypertarget{QASC_8c_0dfe4c72ddbd4bc32a49e6599d9f0b27}{
\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 srcSize}, \/  void $\ast$ {\em dst}, \/  unsigned int {\em dstSize})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_0dfe4c72ddbd4bc32a49e6599d9f0b27}


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 srcSize}]The size, in bytes, of the source buffer of compressed data \item[{\em dst}]The destination buffer for decompressed data \item[{\em dstSize}]The available space, in bytes, of the destination buffer \end{description}
\end{Desc}


Referenced by expand\_\-gzip0().\hypertarget{QASC_8c_f23f419783535db4d7301b97817dfa37}{
\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 {\bf QASC\_\-STATUS} expand\_\-gzip0 ({\bf QASC\_\-sampleV0} $\ast$ {\em qasc}, \/  const ASC\_\-ascBdy\_\-Gzip0 $\ast$ {\em asc}, \/  unsigned int {\em size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_f23f419783535db4d7301b97817dfa37}


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}


References do\_\-inflate(), \_\-QASC\_\-sampleV0::monitor, monitor\_\-transfer(), \_\-QSSP\_\-spanV1::nused, QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32, QASC\_\-STATUS\_\-CTB\_\-INFLATE\_\-FAIL, QASC\_\-STATUS\_\-SUCCESS, \_\-QASC\_\-sampleV0::span, span\_\-transfer(), and \_\-QASC\_\-sampleV0::statistics.

Referenced by QASC\_\-expand().\hypertarget{QASC_8c_a4d9329b0e5d11ae7df71cbc09c584f3}{
\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 {\bf QASC\_\-STATUS} expand\_\-raw0 ({\bf QASC\_\-sampleV0} $\ast$ {\em qasc}, \/  const ASC\_\-ascBdy\_\-Raw0 $\ast$ {\em asc}, \/  unsigned int {\em size})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a4d9329b0e5d11ae7df71cbc09c584f3}


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}


References \_\-QASC\_\-sampleV0::monitor, monitor\_\-transfer(), \_\-QASC\_\-monitorV0::nsampled, QASC\_\-STATUS\_\-CTB\_\-BAD\_\-LEN32, QASC\_\-STATUS\_\-SUCCESS, \_\-QASC\_\-sampleV0::span, span\_\-transfer(), and \_\-QASC\_\-sampleV0::statistics.

Referenced by QASC\_\-expand().\hypertarget{QASC_8c_0c7b5faa7dea1f6777d3c6dac02ce68c}{
\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 srcSize}, \/  void $\ast$ {\em dst}, \/  unsigned int {\em dstSize})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_0c7b5faa7dea1f6777d3c6dac02ce68c}


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 srcSize}]The size, in bytes, of the source buffer of compressed data \item[{\em dst}]The destination buffer for decompressed data \item[{\em dstSize}]The available space, in bytes, of the destination buffer \end{description}
\end{Desc}
\hypertarget{QASC_8c_a8bd4f254667a11962b0d8b939992c65}{
\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 ({\bf QASC\_\-monitorV0} $\ast$ {\em dst}, \/  const ASC\_\-stats $\ast$ {\em src}, \/  unsigned int {\em nsampled})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_a8bd4f254667a11962b0d8b939992c65}


Transfers the contents of an ASC\_\-stats structure plus the number of events sampled to a QASC\_\-monitorV0 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. 

References \_\-QASC\_\-monitorV0::nsampled.

Referenced by expand\_\-gzip0(), and expand\_\-raw0().\hypertarget{QASC_8c_737f923a2a241807cb89912f9473fb11}{
\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 pointV0\_\-transfer ({\bf QSSP\_\-pointV0} $\ast$ {\em dst}, \/  const EMP\_\-hdrEvt $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_737f923a2a241807cb89912f9473fb11}


Transfer an EMP\_\-hdrEvt 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\_\-hdrEvt structure \end{description}
\end{Desc}


References \_\-QSSP\_\-pointV0::gemClock, QSSP\_\-pointV0Complete(), \_\-QSSP\_\-pointV0::relative, \_\-QSSP\_\-pointV0::sequence, and \_\-QSSP\_\-pointV0::timetones.

Referenced by span\_\-transfer().\hypertarget{QASC_8c_bc1a5a34c3fc8653315c72389e2ee8cd}{
\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}{\bf QASC}$\ast$ QASC\_\-alloc (void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8c_bc1a5a34c3fc8653315c72389e2ee8cd}


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}


References QASC\_\-construct().\hypertarget{QASC_8c_afb25cc8b4e47266f1914efa2497c97a}{
\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}{\bf QASC}$\ast$ QASC\_\-construct ({\bf QASC} $\ast$ {\em qasc}, \/  void $\ast$ {\em must\_\-be\_\-null})}}
\label{QASC_8c_afb25cc8b4e47266f1914efa2497c97a}


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}


References \_\-QASC\_\-ctx::com, \_\-QASC::ctx, \_\-QASC::cumulative, \_\-QASC\_\-ctx::cumulative, \_\-QASC::free, \_\-QASC\_\-ctx::qasc, qasc\_\-file\_\-cache\_\-get(), QASC\_\-sizeof(), and QSSP\_\-ctxConstruct().

Referenced by QASC\_\-alloc().\hypertarget{QASC_8c_ea39bee07e84f327d65b18ad0080b727}{
\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 {\bf QASC\_\-ctx}$\ast$ QASC\_\-ctxGet (const {\bf QASC} $\ast$ {\em qasc})}}
\label{QASC_8c_ea39bee07e84f327d65b18ad0080b727}


Locates the statistics context (meta-data). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qasc}]The statistics context \end{description}
\end{Desc}


References \_\-QASC::ctx.\hypertarget{QASC_8c_d30225ae7369d841c189d6c136ec71c6}{
\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 ({\bf QASC} $\ast$ {\em qasc})}}
\label{QASC_8c_d30225ae7369d841c189d6c136ec71c6}


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}


References \_\-QASC::free.\hypertarget{QASC_8c_e6802741addd0c897edb78af763a4499}{
\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 ({\bf QASC} $\ast$ {\em qasc}, \/  const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QASC_8c_e6802741addd0c897edb78af763a4499}


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_e0afab546828ae4ffafb70c91eeadcb3}{QASC\_\-sizeof()}. The output buffer can then be used as input with the QASC\_\-xxxxLocate routines.

This routine assumes the contributor has been byte-swapped. 

References add\_\-samples(), \_\-QASC::ctx, \_\-QASC::cumulative, \_\-QASC\_\-ctx::current, expand\_\-gzip0(), expand\_\-raw0(), QASC\_\-STATUS\_\-CTB\_\-UNKNOWN\_\-VER, \_\-QASC::sample, and \_\-QASC\_\-sample::v0.

Referenced by QASC\_\-updateAtContribution().\hypertarget{QASC_8c_94dbfeb9698fca623b2c1e2c25a224dc}{
\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_94dbfeb9698fca623b2c1e2c25a224dc}


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. 

References RND\_\-8.

Referenced by QASC\_\-construct().\hypertarget{QASC_8c_a1959c0eae410d02d3885e08bc09c3fe}{
\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\_\-idxAemGet (int {\em board}, \/  int {\em channel})}}
\label{QASC_8c_a1959c0eae410d02d3885e08bc09c3fe}


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_2fba9159c1751511d6ed0287cc0d3d1a}{
\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\_\-idxGemGet (int {\em group}, \/  int {\em channel})}}
\label{QASC_8c_2fba9159c1751511d6ed0287cc0d3d1a}


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_e0afab546828ae4ffafb70c91eeadcb3}{
\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_e0afab546828ae4ffafb70c91eeadcb3}


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}


Referenced by QASC\_\-construct().\hypertarget{QASC_8c_5393c94cbbec2d5066143e279b2157ed}{
\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\_\-updateAtContribution ({\bf QASC} $\ast$ {\em qasc}, \/  const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QASC_8c_5393c94cbbec2d5066143e279b2157ed}


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}


References \_\-QSSP\_\-ctxKeys::cfg, \_\-QSSP\_\-ctxIds::cfg, \_\-QASC\_\-ctx::com, \_\-QASC::ctx, \_\-QSSP\_\-ctx::dgm, \_\-QASC::dgm\_\-version, \_\-QSSP\_\-ctxIds::handler, \_\-QSSP\_\-ctx::id, \_\-QSSP\_\-ctx::key, \_\-QSSP\_\-ctxKeys::master, QASC\_\-expand(), and \_\-QSSP\_\-ctxKeys::sbs.\hypertarget{QASC_8c_7d762267a0fe85a84eb204e47f12a026}{
\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\_\-updateAtDatagram ({\bf QASC} $\ast$ {\em qasc}, \/  const LSF\_\-datagram $\ast$ {\em dgm})}}
\label{QASC_8c_7d762267a0fe85a84eb204e47f12a026}


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}


References \_\-QASC\_\-ctx::com, \_\-QASC::ctx, \_\-QASC::cumulative, \_\-QSSP\_\-ctx::dgm, \_\-QASC::dgm\_\-version, \_\-QSSP\_\-ctx::files, QSSP\_\-ctxUpdateAtDatagram(), and \_\-QASC\_\-ctx::version.\hypertarget{QASC_8c_4e7fb1926e13fdb3bbff033f3cd9ccc7}{
\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\_\-updateAtRecord ({\bf QASC} $\ast$ {\em qasc}, \/  const LSF\_\-record $\ast$ {\em rec})}}
\label{QASC_8c_4e7fb1926e13fdb3bbff033f3cd9ccc7}


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}


References \_\-QASC::ctx, \_\-QASC\_\-ctx::current, \_\-QASC\_\-sampleV0::type, and \_\-QASC\_\-sample::v0.\hypertarget{QASC_8c_01fef2ccc23a30feb2727d39d5b783a1}{
\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 ({\bf QSSP\_\-spanV1} $\ast$ {\em dst}, \/  const EMP\_\-hdr $\ast$ {\em src})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_01fef2ccc23a30feb2727d39d5b783a1}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination QSSP\_\-spanV1 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}


References \_\-QSSP\_\-spanV1::nused, \_\-QSSP\_\-spanV1::points, pointV0\_\-transfer(), and QSSP\_\-spanV1Complete().

Referenced by expand\_\-gzip0(), and expand\_\-raw0().\hypertarget{QASC_8c_bfc2d739236cc8f3c366bc247e4ea019}{
\index{QASC.c@{QASC.c}!swap32bN@{swap32bN}}
\index{swap32bN@{swap32bN}!QASC.c@{QASC.c}}
\subsubsection[{swap32bN}]{\setlength{\rightskip}{0pt plus 5cm}void swap32bN (unsigned int $\ast$ {\em d32}, \/  const unsigned int $\ast$ {\em s32}, \/  int {\em n32})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QASC_8c_bfc2d739236cc8f3c366bc247e4ea019}


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}
