\hypertarget{QPIG_8c}{
\section{QPIG.c File Reference}
\label{QPIG_8c}\index{QPIG.c@{QPIG.c}}
}
Manages the handling of power register state datagrams. 

{\tt \#include \char`\"{}QPIG\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}QPIG/QPIG.h\char`\"{}}\par
{\tt \#include \char`\"{}QPIG/state.h\char`\"{}}\par
{\tt \#include \char`\"{}LSE/LSE\_\-std\-Ctb.h\char`\"{}}\par
{\tt \#include \char`\"{}LSF/LSF.h\char`\"{}}\par
{\tt \#include \char`\"{}LSF/LSF\_\-ids.h\char`\"{}}\par
{\tt \#include \char`\"{}LSF/LSF\_\-scan.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par


Include dependency graph for QPIG.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=270pt]{QPIG_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static LSF\_\-scan\-Record\-Handler \hyperlink{QPIG_8c_a0}{root\_\-update} (QPIG $\ast$qpig, const LSF\_\-contribution $\ast$ctb)
\begin{CompactList}\small\item\em Call back routine for each contribution in the root. \item\end{CompactList}\item 
QPIG $\ast$ \hyperlink{QPIG_8c_a1}{QPIG\_\-alloc} (void)
\begin{CompactList}\small\item\em Allocates and constructs the QPIG handle. \item\end{CompactList}\item 
size\_\-t \hyperlink{QPIG_8c_a2}{QPIG\_\-sizeof} (void $\ast$prm)
\begin{CompactList}\small\item\em Returns the size, in bytes, of the handle for updating the standard event meta-information. \item\end{CompactList}\item 
QPIG $\ast$ \hyperlink{QPIG_8c_a3}{QPIG\_\-construct} (QPIG $\ast$qpig, void $\ast$prm)
\begin{CompactList}\small\item\em Construct (initializes) the handle for updating the standard event meta-information. \item\end{CompactList}\item 
void \hyperlink{QPIG_8c_a4}{QPIG\_\-destruct} (QPIG $\ast$qpig)
\begin{CompactList}\small\item\em Destroy the QPIG handle. \item\end{CompactList}\item 
void \hyperlink{QPIG_8c_a5}{QPIG\_\-update\-At\-Datagram} (QPIG $\ast$qpig, const LSF\_\-datagram $\ast$dgm)
\begin{CompactList}\small\item\em Updates the run oriented information in the event context using the information from the event datagram. \item\end{CompactList}\item 
void \hyperlink{QPIG_8c_a6}{QPIG\_\-update\-At\-Contribution} (QPIG $\ast$qpig, const LSF\_\-contribution $\ast$ctb)
\begin{CompactList}\small\item\em Updates the context based on the contribution. \item\end{CompactList}\item 
const \hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{QPIG_8c_a7}{QPIG\_\-app\-State\-Get} (const QPIG $\ast$qpig)
\begin{CompactList}\small\item\em Return a pointer to the public QPIG application specific context block. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Manages the handling of power register state datagrams. 

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


\subsection{Function Documentation}
\hypertarget{QPIG_8c_a1}{
\index{QPIG.c@{QPIG.c}!QPIG_alloc@{QPIG\_\-alloc}}
\index{QPIG_alloc@{QPIG\_\-alloc}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-alloc]{\setlength{\rightskip}{0pt plus 5cm}QPIG$\ast$ QPIG\_\-alloc (void)}}
\label{QPIG_8c_a1}


Allocates and constructs the QPIG handle. 

\begin{Desc}
\item[Returns:]A pointer to the allocated and constructed QPIG handle\end{Desc}
\hypertarget{QPIG_8c_a7}{
\index{QPIG.c@{QPIG.c}!QPIG_appStateGet@{QPIG\_\-appStateGet}}
\index{QPIG_appStateGet@{QPIG\_\-appStateGet}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-appStateGet]{\setlength{\rightskip}{0pt plus 5cm}const \hyperlink{structQPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-app\-State\-Get (const QPIG $\ast$ {\em qpig})}}
\label{QPIG_8c_a7}


Return a pointer to the public QPIG application specific context block. 

\begin{Desc}
\item[Returns:]A pointer to the QPIG application specific context block\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]The calibration event handle\end{description}
\end{Desc}
\begin{Desc}
\item[]This routine is just an accessor to keep the structure of QPIG private.\end{Desc}
\hypertarget{QPIG_8c_a3}{
\index{QPIG.c@{QPIG.c}!QPIG_construct@{QPIG\_\-construct}}
\index{QPIG_construct@{QPIG\_\-construct}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-construct]{\setlength{\rightskip}{0pt plus 5cm}QPIG$\ast$ QPIG\_\-construct (QPIG $\ast$ {\em qpig}, void $\ast$ {\em prm})}}
\label{QPIG_8c_a3}


Construct (initializes) the handle for updating the standard event meta-information. 

\begin{Desc}
\item[Returns:]The QSEP context structure\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]The handle to initialize, if specified as NULL, one will be allocated \item[{\em prm}]A run-time set parameter used to stylize the configuration\end{description}
\end{Desc}
\hypertarget{QPIG_8c_a4}{
\index{QPIG.c@{QPIG.c}!QPIG_destruct@{QPIG\_\-destruct}}
\index{QPIG_destruct@{QPIG\_\-destruct}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-destruct]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-destruct (QPIG $\ast$ {\em qpig})}}
\label{QPIG_8c_a4}


Destroy the QPIG handle. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]Pointer to the QPIG handle to delete.\end{description}
\end{Desc}
\hypertarget{QPIG_8c_a2}{
\index{QPIG.c@{QPIG.c}!QPIG_sizeof@{QPIG\_\-sizeof}}
\index{QPIG_sizeof@{QPIG\_\-sizeof}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-sizeof]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QPIG\_\-sizeof (void $\ast$ {\em prm})}}
\label{QPIG_8c_a2}


Returns the size, in bytes, of the handle for updating the standard event meta-information. 

\begin{Desc}
\item[Returns:]The size, in bytes, of the handle for updating the standard event meta-information\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]A run-time set parameter used to stylize the configuration\end{description}
\end{Desc}
\hypertarget{QPIG_8c_a6}{
\index{QPIG.c@{QPIG.c}!QPIG_updateAtContribution@{QPIG\_\-updateAtContribution}}
\index{QPIG_updateAtContribution@{QPIG\_\-updateAtContribution}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-updateAtContribution]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-update\-At\-Contribution (QPIG $\ast$ {\em qpig}, const LSF\_\-contribution $\ast$ {\em ctb})}}
\label{QPIG_8c_a6}


Updates the context based on the contribution. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]The calibration event handle to update \item[{\em ctb}]The contribution\end{description}
\end{Desc}
\hypertarget{QPIG_8c_a5}{
\index{QPIG.c@{QPIG.c}!QPIG_updateAtDatagram@{QPIG\_\-updateAtDatagram}}
\index{QPIG_updateAtDatagram@{QPIG\_\-updateAtDatagram}!QPIG.c@{QPIG.c}}
\subsubsection[QPIG\_\-updateAtDatagram]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-update\-At\-Datagram (QPIG $\ast$ {\em qpig}, const LSF\_\-datagram $\ast$ {\em dgm})}}
\label{QPIG_8c_a5}


Updates the run oriented information in the event context using the information from the event datagram. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]The calibration event handle \item[{\em dgm}]The event datagram\end{description}
\end{Desc}
\begin{Desc}
\item[Note:]The root contribution is opaque to the caller, so QPIG must handle the contributions within the root. There are two strategies one could use\begin{enumerate}
\item Call LSF\_\-scan\-Contribtions and let it parse through them and invoke a user call back routine\item Do the scan by hand.\end{enumerate}
\end{Desc}
Initially I have opted for strategy \#1, but the second strategy makes detailed error checking easier. For example, if the sequence of the contributions is fixed, it is likely easier to do this when doing the scan by hand.\hypertarget{QPIG_8c_a0}{
\index{QPIG.c@{QPIG.c}!root_update@{root\_\-update}}
\index{root_update@{root\_\-update}!QPIG.c@{QPIG.c}}
\subsubsection[root\_\-update]{\setlength{\rightskip}{0pt plus 5cm}LSF\_\-scan\-Record\-Handler root\_\-update (QPIG $\ast$ {\em qpig}, const LSF\_\-contribution $\ast$ {\em ctb})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{QPIG_8c_a0}


Call back routine for each contribution in the root. 

\begin{Desc}
\item[Returns:]A possible record handler for this contribution\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qpig}]The calibration event handler \item[{\em ctb}]The contribution\end{description}
\end{Desc}
