\hypertarget{parseargs_8h}{}\doxysection{inc/parseargs.h File Reference}
\label{parseargs_8h}\index{inc/parseargs.h@{inc/parseargs.h}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
Include dependency graph for parseargs.\+h\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=324pt]{parseargs_8h__incl}
\end{center}
\end{figure}
This graph shows which files directly or indirectly include this file\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{parseargs_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{parseargs_8h_aaf2d069af6cc2b87e8475f050aa2d221}{check\+File\+Arg}} (int name, FILE $\ast$$\ast$file\+Ptr, const char $\ast$opt\+Arg, const char $\ast$mode)
\begin{DoxyCompactList}\small\item\em Parses command line arguments and fills the \mbox{\hyperlink{structCapConfig}{Cap\+Config}} struct. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{parseargs_8h_ab4f632f3c0aeabccd476e083ad2e81c9}{check\+UInt\+Arg}} (int name, unsigned int $\ast$value, const char $\ast$opt\+Arg)
\begin{DoxyCompactList}\small\item\em Checks if the provided argument is a valid integer and parses it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{parseargs_8h_affe148b16953fa74822c7b24207ca5c7}{parse\+Arguments}} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]}, \mbox{\hyperlink{structCapConfig}{Cap\+Config}} $\ast$cfg)
\begin{DoxyCompactList}\small\item\em Parses command line arguments and fills the \mbox{\hyperlink{structCapConfig}{Cap\+Config}} struct. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{parseargs_8h_a109804a71dfeacda0de64e0b8fb182e2}{get\+Int}} (char $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Parses an integer from a string. \end{DoxyCompactList}\item 
double \mbox{\hyperlink{parseargs_8h_aab971caa9b7eb0827483d98357cb1b13}{get\+Double}} (char $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Parses a double from a string. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{parseargs_8h_ade4b241bef609b19381dc4baff3c380e}{get\+Doubles\+From\+Stdin}} (size\+\_\+t max\+Count, double $\ast$arr)
\begin{DoxyCompactList}\small\item\em Reads doubles from standard input until EOF or max\+Count is reached. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{parseargs_8h_a22a89b0e4e695c3783e15f00652d5193}{get\+Ints\+From\+File}} (size\+\_\+t max\+Count, int $\ast$arr, FILE $\ast$file)
\begin{DoxyCompactList}\small\item\em Reads integers from file until EOF or max\+Count is reached. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{parseargs_8h_aaf2d069af6cc2b87e8475f050aa2d221}\label{parseargs_8h_aaf2d069af6cc2b87e8475f050aa2d221}} 
\index{parseargs.h@{parseargs.h}!checkFileArg@{checkFileArg}}
\index{checkFileArg@{checkFileArg}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{checkFileArg()}{checkFileArg()}}
{\footnotesize\ttfamily int check\+File\+Arg (\begin{DoxyParamCaption}\item[{int}]{name,  }\item[{FILE $\ast$$\ast$}]{file\+Ptr,  }\item[{const char $\ast$}]{opt\+Arg,  }\item[{const char $\ast$}]{mode }\end{DoxyParamCaption})}



Parses command line arguments and fills the \mbox{\hyperlink{structCapConfig}{Cap\+Config}} struct. 

Also provides utility functions for checking and parsing arguments.

Checks if the provided argument is a valid file and opens it.


\begin{DoxyParams}{Parameters}
{\em name} & The name of the argument (for error messages). \\
\hline
{\em file\+Ptr} & Pointer to a FILE$\ast$ that will be set to the opened file. \\
\hline
{\em opt\+Arg} & The argument string to check (should be a filename). \\
\hline
{\em mode} & The mode to open the file (e.\+g., \char`\"{}r\char`\"{} for read, \char`\"{}w\char`\"{} for write). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, non-\/zero on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{parseargs_8h_ab4f632f3c0aeabccd476e083ad2e81c9}\label{parseargs_8h_ab4f632f3c0aeabccd476e083ad2e81c9}} 
\index{parseargs.h@{parseargs.h}!checkUIntArg@{checkUIntArg}}
\index{checkUIntArg@{checkUIntArg}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{checkUIntArg()}{checkUIntArg()}}
{\footnotesize\ttfamily int check\+UInt\+Arg (\begin{DoxyParamCaption}\item[{int}]{name,  }\item[{unsigned int $\ast$}]{value,  }\item[{const char $\ast$}]{opt\+Arg }\end{DoxyParamCaption})}



Checks if the provided argument is a valid integer and parses it. 


\begin{DoxyParams}{Parameters}
{\em name} & The name of the argument (for error messages). \\
\hline
{\em value} & Pointer to an int that will be set to the parsed value. \\
\hline
{\em opt\+Arg} & The argument string to check (should be an integer). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, non-\/zero on failure. 
\end{DoxyReturn}
\mbox{\Hypertarget{parseargs_8h_aab971caa9b7eb0827483d98357cb1b13}\label{parseargs_8h_aab971caa9b7eb0827483d98357cb1b13}} 
\index{parseargs.h@{parseargs.h}!getDouble@{getDouble}}
\index{getDouble@{getDouble}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{getDouble()}{getDouble()}}
{\footnotesize\ttfamily double get\+Double (\begin{DoxyParamCaption}\item[{char $\ast$}]{ptr }\end{DoxyParamCaption})}



Parses a double from a string. 


\begin{DoxyParams}{Parameters}
{\em ptr} & The string to parse. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The parsed double value. 
\end{DoxyReturn}
\mbox{\Hypertarget{parseargs_8h_ade4b241bef609b19381dc4baff3c380e}\label{parseargs_8h_ade4b241bef609b19381dc4baff3c380e}} 
\index{parseargs.h@{parseargs.h}!getDoublesFromStdin@{getDoublesFromStdin}}
\index{getDoublesFromStdin@{getDoublesFromStdin}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{getDoublesFromStdin()}{getDoublesFromStdin()}}
{\footnotesize\ttfamily int get\+Doubles\+From\+Stdin (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{max\+Count,  }\item[{double $\ast$}]{arr }\end{DoxyParamCaption})}



Reads doubles from standard input until EOF or max\+Count is reached. 


\begin{DoxyParams}{Parameters}
{\em max\+Count} & The maximum number of doubles to read. \\
\hline
{\em arr} & Pointer to an array where the read doubles will be stored. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The number of doubles successfully read.
\end{DoxyReturn}
Reads doubles from standard input until EOF or max\+Count is reached.

Returns the number of doubles stored (\texorpdfstring{$>$}{>}=0), or -\/1 on I/\+O/memory error. \mbox{\Hypertarget{parseargs_8h_a109804a71dfeacda0de64e0b8fb182e2}\label{parseargs_8h_a109804a71dfeacda0de64e0b8fb182e2}} 
\index{parseargs.h@{parseargs.h}!getInt@{getInt}}
\index{getInt@{getInt}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{getInt()}{getInt()}}
{\footnotesize\ttfamily int get\+Int (\begin{DoxyParamCaption}\item[{char $\ast$}]{ptr }\end{DoxyParamCaption})}



Parses an integer from a string. 


\begin{DoxyParams}{Parameters}
{\em ptr} & The string to parse. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The parsed integer value. 
\end{DoxyReturn}
\mbox{\Hypertarget{parseargs_8h_a22a89b0e4e695c3783e15f00652d5193}\label{parseargs_8h_a22a89b0e4e695c3783e15f00652d5193}} 
\index{parseargs.h@{parseargs.h}!getIntsFromFile@{getIntsFromFile}}
\index{getIntsFromFile@{getIntsFromFile}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{getIntsFromFile()}{getIntsFromFile()}}
{\footnotesize\ttfamily int get\+Ints\+From\+File (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{max\+Count,  }\item[{int $\ast$}]{arr,  }\item[{FILE $\ast$}]{file }\end{DoxyParamCaption})}



Reads integers from file until EOF or max\+Count is reached. 


\begin{DoxyParams}{Parameters}
{\em max\+Count} & The maximum number of integers to read. \\
\hline
{\em arr} & Pointer to an array where the read integers will be stored. \\
\hline
{\em file} & Pointer to read integers from \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The number of integers successfully read. 
\end{DoxyReturn}
\mbox{\Hypertarget{parseargs_8h_affe148b16953fa74822c7b24207ca5c7}\label{parseargs_8h_affe148b16953fa74822c7b24207ca5c7}} 
\index{parseargs.h@{parseargs.h}!parseArguments@{parseArguments}}
\index{parseArguments@{parseArguments}!parseargs.h@{parseargs.h}}
\doxysubsubsection{\texorpdfstring{parseArguments()}{parseArguments()}}
{\footnotesize\ttfamily void parse\+Arguments (\begin{DoxyParamCaption}\item[{int}]{argc,  }\item[{char $\ast$}]{argv\mbox{[}$\,$\mbox{]},  }\item[{\mbox{\hyperlink{structCapConfig}{Cap\+Config}} $\ast$}]{cfg }\end{DoxyParamCaption})}



Parses command line arguments and fills the \mbox{\hyperlink{structCapConfig}{Cap\+Config}} struct. 


\begin{DoxyParams}{Parameters}
{\em argc} & The number of command line arguments. \\
\hline
{\em argv} & The array of command line argument strings. \\
\hline
{\em cfg} & Pointer to a \mbox{\hyperlink{structCapConfig}{Cap\+Config}} struct that will be filled with the parsed configuration. \\
\hline
\end{DoxyParams}
