\hypertarget{state_8c}{
\section{state.c File Reference}
\label{state_8c}\index{state.c@{state.c}}
}
Functions for retrieving and displaying the state information. 

{\tt \#include \char`\"{}state\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}LEM/defs.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/WCT.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$time.h$>$}\par


Include dependency graph for state.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=194pt]{state_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8c_a0}{QPIG\_\-alloc\-State} (void)
\begin{CompactList}\small\item\em Allocate memory for a QPIG\_\-state structure and construct it as such. \item\end{CompactList}\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8c_a1}{QPIG\_\-construct\-State} (void $\ast$buffer)
\begin{CompactList}\small\item\em Construct a QPIG\_\-state structure in the memory provided. \item\end{CompactList}\item 
void \hyperlink{state_8c_a2}{QPIG\_\-destruct\-State} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state)
\begin{CompactList}\small\item\em Release resources associated with the QPIG\_\-state structure. \item\end{CompactList}\item 
const unsigned int $\ast$ \hyperlink{state_8c_a3}{QPIG\_\-recover\-State} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, int version, const unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Copy the state information from the buffer. \item\end{CompactList}\item 
void \hyperlink{state_8c_a4}{QPIG\_\-report\-State} (unsigned int secs, int version, const \hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Write a formatted ASCII description of the state. \item\end{CompactList}\item 
size\_\-t \hyperlink{state_8c_a5}{QPIG\_\-sizeof\-State} (void)
\begin{CompactList}\small\item\em Return the size of the QPIG state structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Functions for retrieving and displaying the state information. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{state_8c}{state.c},v 1.2 2009/02/20 23:02:08 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{state_8c_a0}{
\index{state.c@{state.c}!QPIG_allocState@{QPIG\_\-allocState}}
\index{QPIG_allocState@{QPIG\_\-allocState}!state.c@{state.c}}
\subsubsection[QPIG\_\-allocState]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__QPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-alloc\-State (void)}}
\label{state_8c_a0}


Allocate memory for a QPIG\_\-state structure and construct it as such. 

\begin{Desc}
\item[Returns:]Allocated QPIG\_\-state structure\end{Desc}
\hypertarget{state_8c_a1}{
\index{state.c@{state.c}!QPIG_constructState@{QPIG\_\-constructState}}
\index{QPIG_constructState@{QPIG\_\-constructState}!state.c@{state.c}}
\subsubsection[QPIG\_\-constructState]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__QPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-construct\-State (void $\ast$ {\em buffer})}}
\label{state_8c_a1}


Construct a QPIG\_\-state structure in the memory provided. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]block of memory to use for the QPIG\_\-state structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an initialised QPIG\_\-state structure\end{Desc}
\hypertarget{state_8c_a2}{
\index{state.c@{state.c}!QPIG_destructState@{QPIG\_\-destructState}}
\index{QPIG_destructState@{QPIG\_\-destructState}!state.c@{state.c}}
\subsubsection[QPIG\_\-destructState]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-destruct\-State (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state})}}
\label{state_8c_a2}


Release resources associated with the QPIG\_\-state structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a QPIG\_\-state structure created using \hyperlink{state_8h_a18}{QPIG\_\-alloc\-State()}\end{description}
\end{Desc}
\hypertarget{state_8c_a3}{
\index{state.c@{state.c}!QPIG_recoverState@{QPIG\_\-recoverState}}
\index{QPIG_recoverState@{QPIG\_\-recoverState}!state.c@{state.c}}
\subsubsection[QPIG\_\-recoverState]{\setlength{\rightskip}{0pt plus 5cm}const unsigned int$\ast$ QPIG\_\-recover\-State (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state}, int {\em version}, const unsigned int $\ast$ {\em buf})}}
\label{state_8c_a3}


Copy the state information from the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a state structure\item[{\em version}]The version of the state data.\item[{\em buf}]Pointer to the context data\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next word in the buffer\end{Desc}
\hypertarget{state_8c_a4}{
\index{state.c@{state.c}!QPIG_reportState@{QPIG\_\-reportState}}
\index{QPIG_reportState@{QPIG\_\-reportState}!state.c@{state.c}}
\subsubsection[QPIG\_\-reportState]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-report\-State (unsigned int {\em secs}, int {\em version}, const \hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state}, FILE $\ast$ {\em fp})}}
\label{state_8c_a4}


Write a formatted ASCII description of the state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em secs}]The time the state was sent (spacecraft time)\item[{\em version}]The version of the state data.\item[{\em state}]Pointer to a state structure\item[{\em fp}]Pointer to the output file\end{description}
\end{Desc}
\hypertarget{state_8c_a5}{
\index{state.c@{state.c}!QPIG_sizeofState@{QPIG\_\-sizeofState}}
\index{QPIG_sizeofState@{QPIG\_\-sizeofState}!state.c@{state.c}}
\subsubsection[QPIG\_\-sizeofState]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QPIG\_\-sizeof\-State (void)}}
\label{state_8c_a5}


Return the size of the QPIG state structure. 

\begin{Desc}
\item[Returns:]Size of memory block required to hold the structure\end{Desc}
