\hypertarget{namespacepolicy__utils}{
\section{policy\_\-utils Namespace Reference}
\label{namespacepolicy__utils}\index{policy\_\-utils@{policy\_\-utils}}
}


Some generic utility functions used by different policy components.  


\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{classpolicy__utils_1_1PolicyUtilsErr}{PolicyUtilsErr}
\begin{DoxyCompactList}\small\item\em Generic exception for errors. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{namespacepolicy__utils_aa4fab58545d09e8ff2bc34b9cb5eb78b}{str\_\-to\_\-list} (const string \&in, list$<$ string $>$ \&out)
\begin{DoxyCompactList}\small\item\em Converts a string in \hyperlink{protocolthe-p}{the} form \char`\"{}1,2,...,n\char`\"{} to a list of strings. \item\end{DoxyCompactList}\item 
void \hyperlink{namespacepolicy__utils_aa679175ad3070b9ea2a2defed00e7321}{str\_\-to\_\-set} (const string \&in, set$<$ string $>$ \&out)
\begin{DoxyCompactList}\small\item\em Converts a string in \hyperlink{protocolthe-p}{the} form \char`\"{}1,2,...,n\char`\"{} to a set of strings. \item\end{DoxyCompactList}\item 
void \hyperlink{namespacepolicy__utils_a0d6ee550e66d6135a7ea5244ceda5ac7}{read\_\-file} (const string \&fname, string \&out)
\begin{DoxyCompactList}\small\item\em Reads a file into a string. \item\end{DoxyCompactList}\item 
unsigned \hyperlink{namespacepolicy__utils_a32f39c336cbf076060cba8e541e963cc}{count\_\-nl} (const char $\ast$x)
\begin{DoxyCompactList}\small\item\em Count \hyperlink{protocolthe-p}{the} occurences of newlines in \hyperlink{protocolthe-p}{the} c-\/style string. \item\end{DoxyCompactList}\item 
bool \hyperlink{namespacepolicy__utils_a04b2cc2cd94823efc4e08e5058038d10}{regex} (const string \&str, const string \&reg)
\begin{DoxyCompactList}\small\item\em Match a regex. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespacepolicy__utils_a09d55ac54842dc32cccb0e8fb47f6bda}{delete\_\-vector} (vector$<$ T $\ast$ $>$ $\ast$v)
\begin{DoxyCompactList}\small\item\em Deletes a vector by deleting objects and deleting \hyperlink{protocolthe-p}{the} vector itself. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespacepolicy__utils_aa8f65080cb0f9073e99bd01f41efcb43}{clear\_\-container} (T \&l)
\begin{DoxyCompactList}\small\item\em Deletes objects in container. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$class A , class T $>$ }\\void \hyperlink{namespacepolicy__utils_ae006f81686fd8e9b01e0791a1374a2ea}{clear\_\-map} (map$<$ A, T $\ast$ $>$ \&m)
\begin{DoxyCompactList}\small\item\em Delets objects of a map and clears \hyperlink{protocolthe-p}{the} map at \hyperlink{protocolthe-p}{the} end. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespacepolicy__utils_ac10ea409a4fc94fb9e1f0f4f2ef987ad}{clear\_\-map\_\-container} (T \&m)
\begin{DoxyCompactList}\small\item\em Delets objects of a map-\/like container and clears \hyperlink{protocolthe-p}{the} map at \hyperlink{protocolthe-p}{the} end. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\string \hyperlink{namespacepolicy__utils_a7dad173522c8c197f2a62a9dcbadcbb2}{to\_\-str} (T x)
\begin{DoxyCompactList}\small\item\em Converts an object to a string via an ostringstream. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Some generic utility functions used by different policy components. 

\subsection{Function Documentation}
\hypertarget{namespacepolicy__utils_aa8f65080cb0f9073e99bd01f41efcb43}{
\index{policy\_\-utils@{policy\_\-utils}!clear\_\-container@{clear\_\-container}}
\index{clear\_\-container@{clear\_\-container}!policy_utils@{policy\_\-utils}}
\subsubsection[{clear\_\-container}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void policy\_\-utils::clear\_\-container (
\begin{DoxyParamCaption}
\item[{T \&}]{l}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_aa8f65080cb0f9073e99bd01f41efcb43}


Deletes objects in container. 

Checks if objects are null and skips them if so.

The container is cleared at \hyperlink{protocolthe-p}{the} end.


\begin{DoxyParams}{Parameters}
{\em l} & container to be deleted and cleared. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_ae006f81686fd8e9b01e0791a1374a2ea}{
\index{policy\_\-utils@{policy\_\-utils}!clear\_\-map@{clear\_\-map}}
\index{clear\_\-map@{clear\_\-map}!policy_utils@{policy\_\-utils}}
\subsubsection[{clear\_\-map}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class A , class T $>$ void policy\_\-utils::clear\_\-map (
\begin{DoxyParamCaption}
\item[{map$<$ A, T $\ast$ $>$ \&}]{m}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_ae006f81686fd8e9b01e0791a1374a2ea}


Delets objects of a map and clears \hyperlink{protocolthe-p}{the} map at \hyperlink{protocolthe-p}{the} end. 

Checks for null objects.


\begin{DoxyParams}{Parameters}
{\em m} & map to be deleted and cleared. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_ac10ea409a4fc94fb9e1f0f4f2ef987ad}{
\index{policy\_\-utils@{policy\_\-utils}!clear\_\-map\_\-container@{clear\_\-map\_\-container}}
\index{clear\_\-map\_\-container@{clear\_\-map\_\-container}!policy_utils@{policy\_\-utils}}
\subsubsection[{clear\_\-map\_\-container}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void policy\_\-utils::clear\_\-map\_\-container (
\begin{DoxyParamCaption}
\item[{T \&}]{m}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_ac10ea409a4fc94fb9e1f0f4f2ef987ad}


Delets objects of a map-\/like container and clears \hyperlink{protocolthe-p}{the} map at \hyperlink{protocolthe-p}{the} end. 

Checks for null objects.


\begin{DoxyParams}{Parameters}
{\em m} & map-\/like container to be deleted and cleared. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_a32f39c336cbf076060cba8e541e963cc}{
\index{policy\_\-utils@{policy\_\-utils}!count\_\-nl@{count\_\-nl}}
\index{count\_\-nl@{count\_\-nl}!policy_utils@{policy\_\-utils}}
\subsubsection[{count\_\-nl}]{\setlength{\rightskip}{0pt plus 5cm}unsigned policy\_\-utils::count\_\-nl (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{x}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_a32f39c336cbf076060cba8e541e963cc}


Count \hyperlink{protocolthe-p}{the} occurences of newlines in \hyperlink{protocolthe-p}{the} c-\/style string. 

\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} number of new lines in \hyperlink{protocolthe-p}{the} string. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em x} & \hyperlink{protocolthe-p}{the} 0 terminated c-\/style string to count new lines in. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_a09d55ac54842dc32cccb0e8fb47f6bda}{
\index{policy\_\-utils@{policy\_\-utils}!delete\_\-vector@{delete\_\-vector}}
\index{delete\_\-vector@{delete\_\-vector}!policy_utils@{policy\_\-utils}}
\subsubsection[{delete\_\-vector}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void policy\_\-utils::delete\_\-vector (
\begin{DoxyParamCaption}
\item[{vector$<$ T $\ast$ $>$ $\ast$}]{v}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_a09d55ac54842dc32cccb0e8fb47f6bda}


Deletes a vector by deleting objects and deleting \hyperlink{protocolthe-p}{the} vector itself. 

It checks if objects are null and skips them if so. Also checks if vector itself is null.


\begin{DoxyParams}{Parameters}
{\em v} & vector to delete \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_a0d6ee550e66d6135a7ea5244ceda5ac7}{
\index{policy\_\-utils@{policy\_\-utils}!read\_\-file@{read\_\-file}}
\index{read\_\-file@{read\_\-file}!policy_utils@{policy\_\-utils}}
\subsubsection[{read\_\-file}]{\setlength{\rightskip}{0pt plus 5cm}void policy\_\-utils::read\_\-file (
\begin{DoxyParamCaption}
\item[{const string \&}]{fname, }
\item[{string \&}]{out}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_a0d6ee550e66d6135a7ea5244ceda5ac7}


Reads a file into a string. 

An exception is thrown on error.


\begin{DoxyParams}{Parameters}
{\em fname} & filename to read. \\
\hline
{\em out} & output string which will be filled with file content. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_a04b2cc2cd94823efc4e08e5058038d10}{
\index{policy\_\-utils@{policy\_\-utils}!regex@{regex}}
\index{regex@{regex}!policy_utils@{policy\_\-utils}}
\subsubsection[{regex}]{\setlength{\rightskip}{0pt plus 5cm}bool policy\_\-utils::regex (
\begin{DoxyParamCaption}
\item[{const string \&}]{str, }
\item[{const string \&}]{reg}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_a04b2cc2cd94823efc4e08e5058038d10}


Match a regex. 


\begin{DoxyParams}{Parameters}
{\em str} & input string to check. \\
\hline
{\em reg} & regular expression used for matching. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if string matches regular expression 
\end{DoxyReturn}
\hypertarget{namespacepolicy__utils_aa4fab58545d09e8ff2bc34b9cb5eb78b}{
\index{policy\_\-utils@{policy\_\-utils}!str\_\-to\_\-list@{str\_\-to\_\-list}}
\index{str\_\-to\_\-list@{str\_\-to\_\-list}!policy_utils@{policy\_\-utils}}
\subsubsection[{str\_\-to\_\-list}]{\setlength{\rightskip}{0pt plus 5cm}void policy\_\-utils::str\_\-to\_\-list (
\begin{DoxyParamCaption}
\item[{const string \&}]{in, }
\item[{list$<$ string $>$ \&}]{out}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_aa4fab58545d09e8ff2bc34b9cb5eb78b}


Converts a string in \hyperlink{protocolthe-p}{the} form \char`\"{}1,2,...,n\char`\"{} to a list of strings. 


\begin{DoxyParams}{Parameters}
{\em in} & input string. \\
\hline
{\em out} & output list. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_aa679175ad3070b9ea2a2defed00e7321}{
\index{policy\_\-utils@{policy\_\-utils}!str\_\-to\_\-set@{str\_\-to\_\-set}}
\index{str\_\-to\_\-set@{str\_\-to\_\-set}!policy_utils@{policy\_\-utils}}
\subsubsection[{str\_\-to\_\-set}]{\setlength{\rightskip}{0pt plus 5cm}void policy\_\-utils::str\_\-to\_\-set (
\begin{DoxyParamCaption}
\item[{const string \&}]{in, }
\item[{set$<$ string $>$ \&}]{out}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_aa679175ad3070b9ea2a2defed00e7321}


Converts a string in \hyperlink{protocolthe-p}{the} form \char`\"{}1,2,...,n\char`\"{} to a set of strings. 


\begin{DoxyParams}{Parameters}
{\em in} & input string. \\
\hline
{\em out} & output set. \\
\hline
\end{DoxyParams}
\hypertarget{namespacepolicy__utils_a7dad173522c8c197f2a62a9dcbadcbb2}{
\index{policy\_\-utils@{policy\_\-utils}!to\_\-str@{to\_\-str}}
\index{to\_\-str@{to\_\-str}!policy_utils@{policy\_\-utils}}
\subsubsection[{to\_\-str}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ string policy\_\-utils::to\_\-str (
\begin{DoxyParamCaption}
\item[{T}]{x}
\end{DoxyParamCaption}
)}}
\label{namespacepolicy__utils_a7dad173522c8c197f2a62a9dcbadcbb2}


Converts an object to a string via an ostringstream. 

\begin{DoxyReturn}{Returns}
string representation of object. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em x} & object to convert to string. \\
\hline
\end{DoxyParams}
