\hypertarget{classCode}{
\section{Code Class Reference}
\label{classCode}\index{Code@{Code}}
}


This class represents \hyperlink{protocolthe-p}{the} intermediate language code.  




{\ttfamily \#include $<$code.hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{classCode_1_1Target}{Target}
\begin{DoxyCompactList}\small\item\em A target represents where \hyperlink{protocolthe-p}{the} code should be placed. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classCode_a1526b8432f34f606bcc0258f5c36e0f7}{
typedef set$<$ \hyperlink{classCode_1_1Target}{Target} $>$ {\bfseries TargetSet}}
\label{classCode_a1526b8432f34f606bcc0258f5c36e0f7}

\item 
\hypertarget{classCode_a67aeed415dd9e0aa69726f386a241c04}{
typedef set$<$ uint32\_\-t $>$ {\bfseries TagSet}}
\label{classCode_a67aeed415dd9e0aa69726f386a241c04}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
const \hyperlink{classCode_1_1Target}{Code::Target} \& \hyperlink{classCode_ab698a95be2083481fcaeff266baade65}{target} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} target. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_ae70613052d71261e92e6d9c3a68c5a85}{set\_\-target} (const \hyperlink{classCode_1_1Target}{Code::Target} target)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} target. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_ab2a934ebb3e46b5678d23092a1e068ac}{set\_\-target\_\-protocol} (const string \&protocol)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} target protocol. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a8356513601bd18b26dd550f913ca62e5}{set\_\-target\_\-filter} (const filter::Filter \&filter)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} target filter type. \item\end{DoxyCompactList}\item 
const string \& \hyperlink{classCode_ac0c87cc9617147968249709c9f1609e8}{code} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} actual code. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a254233f6e10b4bf641b652b0f333e590}{set\_\-code} (const string \&code)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} actual code. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a049f1526f1d57b2aa4e24cfb37191629}{add\_\-code} (const string \&code)
\begin{DoxyCompactList}\small\item\em Add to \hyperlink{protocolthe-p}{the} actual code. \item\end{DoxyCompactList}\item 
const set$<$ string $>$ \hyperlink{classCode_aff8dd7794a288618ef0e3a912b212555}{referenced\_\-set\_\-names} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a16deaf89025f9bf5915aed5e81f4aaad}{set\_\-referenced\_\-set\_\-names} (const set$<$ string $>$ \&set\_\-names)
\begin{DoxyCompactList}\small\item\em Set \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a3e185a6b6ed037d941bc2efa179d1810}{add\_\-referenced\_\-set\_\-name} (const string \&set\_\-name)
\begin{DoxyCompactList}\small\item\em Add \hyperlink{protocolthe-p}{the} name of a set referenced by this code. \item\end{DoxyCompactList}\item 
\hypertarget{classCode_a0823da49ea32c44489c0b7f57ed79216}{
void \hyperlink{classCode_a0823da49ea32c44489c0b7f57ed79216}{clear\_\-referenced\_\-set\_\-names} ()}
\label{classCode_a0823da49ea32c44489c0b7f57ed79216}

\begin{DoxyCompactList}\small\item\em Remove \hyperlink{protocolthe-p}{the} names of all sets referenced by this code. \item\end{DoxyCompactList}\item 
\hypertarget{classCode_a5c345f5e0d9b49e3c16ef1033d465315}{
const set$<$ string $>$ \& {\bfseries source\_\-protocols} () const }
\label{classCode_a5c345f5e0d9b49e3c16ef1033d465315}

\item 
void \hyperlink{classCode_ac99d8547c1770d25a891ad94e6b48471}{add\_\-source\_\-protocol} (const string \&protocol)
\begin{DoxyCompactList}\small\item\em Add a source protocol. \item\end{DoxyCompactList}\item 
const Code::TagSet \& \hyperlink{classCode_a38b8626f15449640245baf4bfe3e94c5}{all\_\-tags} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} set with all tags. \item\end{DoxyCompactList}\item 
const Code::TagSet \& \hyperlink{classCode_a09a3430b2059864717fde337a3b3a38a}{redist\_\-tags} () const 
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} set with \hyperlink{protocolthe-p}{the} tags used for route redistribution to other protocols. \item\end{DoxyCompactList}\item 
void \hyperlink{classCode_a1de237fb78b6502637f68e0edff1bdfe}{add\_\-tag} (uint32\_\-t tag, bool is\_\-redist\_\-tag)
\begin{DoxyCompactList}\small\item\em Add a tag. \item\end{DoxyCompactList}\item 
\hypertarget{classCode_a24cdcbcf69d56147f386d1ca0ef00322}{
void {\bfseries add\_\-subr} (const string \&policy, const string \&code)}
\label{classCode_a24cdcbcf69d56147f386d1ca0ef00322}

\item 
\hypertarget{classCode_ad0bb64e3f8de6957450b8099c35974eb}{
const SUBR \& {\bfseries subr} () const }
\label{classCode_ad0bb64e3f8de6957450b8099c35974eb}

\item 
string \hyperlink{classCode_a791cf2187f66025c2c7ab98814b0d1b0}{str} ()
\item 
\hyperlink{classCode}{Code} \& \hyperlink{classCode_a06757dfec73dc18edbdc486364f3d790}{operator+=} (const \hyperlink{classCode}{Code} \&rhs)
\begin{DoxyCompactList}\small\item\em Appends code to current code. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classCode_acb325587bd21e761962fb03a79dd27f0}{
\hyperlink{classCode_1_1Target}{Target} {\bfseries \_\-target}}
\label{classCode_acb325587bd21e761962fb03a79dd27f0}

\item 
\hypertarget{classCode_aee0bb14768fece5db24ba5cd82d3c93f}{
string {\bfseries \_\-code}}
\label{classCode_aee0bb14768fece5db24ba5cd82d3c93f}

\item 
\hypertarget{classCode_a25c330ccd002bb7f1d7f7dc5f534b184}{
set$<$ string $>$ {\bfseries \_\-referenced\_\-set\_\-names}}
\label{classCode_a25c330ccd002bb7f1d7f7dc5f534b184}

\item 
\hypertarget{classCode_a60e2cb527a55278af24d6c3e31949f82}{
set$<$ string $>$ {\bfseries \_\-source\_\-protocols}}
\label{classCode_a60e2cb527a55278af24d6c3e31949f82}

\item 
\hypertarget{classCode_a6288b7c456ee40f35b02401b47cf8b2a}{
TagSet {\bfseries \_\-all\_\-tags}}
\label{classCode_a6288b7c456ee40f35b02401b47cf8b2a}

\item 
\hypertarget{classCode_af3ab41398f13eeec8059cb6ea01aada4}{
TagSet {\bfseries \_\-redist\_\-tags}}
\label{classCode_af3ab41398f13eeec8059cb6ea01aada4}

\item 
\hypertarget{classCode_a98299afc9bc6bf8842c22f58b2aef778}{
SUBR {\bfseries \_\-subr}}
\label{classCode_a98299afc9bc6bf8842c22f58b2aef778}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class represents \hyperlink{protocolthe-p}{the} intermediate language code. It contains \hyperlink{protocolthe-p}{the} actual code for \hyperlink{protocolthe-p}{the} policy, its target, and names of \hyperlink{protocolthe-p}{the} sets referenced. It also contains \hyperlink{protocolthe-p}{the} policytags referenced. 

\subsection{Member Function Documentation}
\hypertarget{classCode_a049f1526f1d57b2aa4e24cfb37191629}{
\index{Code@{Code}!add\_\-code@{add\_\-code}}
\index{add\_\-code@{add\_\-code}!Code@{Code}}
\subsubsection[{add\_\-code}]{\setlength{\rightskip}{0pt plus 5cm}void Code::add\_\-code (
\begin{DoxyParamCaption}
\item[{const string \&}]{code}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a049f1526f1d57b2aa4e24cfb37191629}


Add to \hyperlink{protocolthe-p}{the} actual code. 


\begin{DoxyParams}{Parameters}
{\em code} & \hyperlink{protocolthe-p}{the} code to add. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a3e185a6b6ed037d941bc2efa179d1810}{
\index{Code@{Code}!add\_\-referenced\_\-set\_\-name@{add\_\-referenced\_\-set\_\-name}}
\index{add\_\-referenced\_\-set\_\-name@{add\_\-referenced\_\-set\_\-name}!Code@{Code}}
\subsubsection[{add\_\-referenced\_\-set\_\-name}]{\setlength{\rightskip}{0pt plus 5cm}void Code::add\_\-referenced\_\-set\_\-name (
\begin{DoxyParamCaption}
\item[{const string \&}]{set\_\-name}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a3e185a6b6ed037d941bc2efa179d1810}


Add \hyperlink{protocolthe-p}{the} name of a set referenced by this code. 


\begin{DoxyParams}{Parameters}
{\em set\_\-name} & \hyperlink{protocolthe-p}{the} name of \hyperlink{protocolthe-p}{the} set referenced by this code. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_ac99d8547c1770d25a891ad94e6b48471}{
\index{Code@{Code}!add\_\-source\_\-protocol@{add\_\-source\_\-protocol}}
\index{add\_\-source\_\-protocol@{add\_\-source\_\-protocol}!Code@{Code}}
\subsubsection[{add\_\-source\_\-protocol}]{\setlength{\rightskip}{0pt plus 5cm}void Code::add\_\-source\_\-protocol (
\begin{DoxyParamCaption}
\item[{const string \&}]{protocol}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_ac99d8547c1770d25a891ad94e6b48471}


Add a source protocol. 


\begin{DoxyParams}{Parameters}
{\em protocol} & \hyperlink{protocolthe-p}{the} protocol to add. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a1de237fb78b6502637f68e0edff1bdfe}{
\index{Code@{Code}!add\_\-tag@{add\_\-tag}}
\index{add\_\-tag@{add\_\-tag}!Code@{Code}}
\subsubsection[{add\_\-tag}]{\setlength{\rightskip}{0pt plus 5cm}void Code::add\_\-tag (
\begin{DoxyParamCaption}
\item[{uint32\_\-t}]{tag, }
\item[{bool}]{is\_\-redist\_\-tag}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a1de237fb78b6502637f68e0edff1bdfe}


Add a tag. 


\begin{DoxyParams}{Parameters}
{\em tag} & \hyperlink{protocolthe-p}{the} tag to add. \\
\hline
{\em is\_\-redist\_\-tag} & if true, \hyperlink{protocolthe-p}{the} tag is used for route redistribution to other protocols. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a38b8626f15449640245baf4bfe3e94c5}{
\index{Code@{Code}!all\_\-tags@{all\_\-tags}}
\index{all\_\-tags@{all\_\-tags}!Code@{Code}}
\subsubsection[{all\_\-tags}]{\setlength{\rightskip}{0pt plus 5cm}const Code::TagSet\& Code::all\_\-tags (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a38b8626f15449640245baf4bfe3e94c5}


Get \hyperlink{protocolthe-p}{the} set with all tags. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} set with all tags. 
\end{DoxyReturn}
\hypertarget{classCode_ac0c87cc9617147968249709c9f1609e8}{
\index{Code@{Code}!code@{code}}
\index{code@{code}!Code@{Code}}
\subsubsection[{code}]{\setlength{\rightskip}{0pt plus 5cm}const string\& Code::code (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_ac0c87cc9617147968249709c9f1609e8}


Get \hyperlink{protocolthe-p}{the} actual code. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} actual code. 
\end{DoxyReturn}
\hypertarget{classCode_a06757dfec73dc18edbdc486364f3d790}{
\index{Code@{Code}!operator+=@{operator+=}}
\index{operator+=@{operator+=}!Code@{Code}}
\subsubsection[{operator+=}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Code} \& Code::operator+= (
\begin{DoxyParamCaption}
\item[{const {\bf Code} \&}]{rhs}
\end{DoxyParamCaption}
)}}
\label{classCode_a06757dfec73dc18edbdc486364f3d790}


Appends code to current code. 

It enables for chunks of code to be linked.

\begin{DoxyReturn}{Returns}
reference to \hyperlink{protocolthe-p}{the} updated code. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em rhs} & code to link. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a09a3430b2059864717fde337a3b3a38a}{
\index{Code@{Code}!redist\_\-tags@{redist\_\-tags}}
\index{redist\_\-tags@{redist\_\-tags}!Code@{Code}}
\subsubsection[{redist\_\-tags}]{\setlength{\rightskip}{0pt plus 5cm}const Code::TagSet\& Code::redist\_\-tags (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a09a3430b2059864717fde337a3b3a38a}


Get \hyperlink{protocolthe-p}{the} set with \hyperlink{protocolthe-p}{the} tags used for route redistribution to other protocols. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} set with tags used for route redistribution. 
\end{DoxyReturn}
\hypertarget{classCode_aff8dd7794a288618ef0e3a912b212555}{
\index{Code@{Code}!referenced\_\-set\_\-names@{referenced\_\-set\_\-names}}
\index{referenced\_\-set\_\-names@{referenced\_\-set\_\-names}!Code@{Code}}
\subsubsection[{referenced\_\-set\_\-names}]{\setlength{\rightskip}{0pt plus 5cm}const set$<$string$>$ Code::referenced\_\-set\_\-names (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_aff8dd7794a288618ef0e3a912b212555}


Get \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. 
\end{DoxyReturn}
\hypertarget{classCode_a254233f6e10b4bf641b652b0f333e590}{
\index{Code@{Code}!set\_\-code@{set\_\-code}}
\index{set\_\-code@{set\_\-code}!Code@{Code}}
\subsubsection[{set\_\-code}]{\setlength{\rightskip}{0pt plus 5cm}void Code::set\_\-code (
\begin{DoxyParamCaption}
\item[{const string \&}]{code}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a254233f6e10b4bf641b652b0f333e590}


Set \hyperlink{protocolthe-p}{the} actual code. 


\begin{DoxyParams}{Parameters}
{\em code} & \hyperlink{protocolthe-p}{the} actual code. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a16deaf89025f9bf5915aed5e81f4aaad}{
\index{Code@{Code}!set\_\-referenced\_\-set\_\-names@{set\_\-referenced\_\-set\_\-names}}
\index{set\_\-referenced\_\-set\_\-names@{set\_\-referenced\_\-set\_\-names}!Code@{Code}}
\subsubsection[{set\_\-referenced\_\-set\_\-names}]{\setlength{\rightskip}{0pt plus 5cm}void Code::set\_\-referenced\_\-set\_\-names (
\begin{DoxyParamCaption}
\item[{const set$<$ string $>$ \&}]{set\_\-names}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_a16deaf89025f9bf5915aed5e81f4aaad}


Set \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. 


\begin{DoxyParams}{Parameters}
{\em set\_\-names} & \hyperlink{protocolthe-p}{the} names of \hyperlink{protocolthe-p}{the} sets referenced by this code. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_ae70613052d71261e92e6d9c3a68c5a85}{
\index{Code@{Code}!set\_\-target@{set\_\-target}}
\index{set\_\-target@{set\_\-target}!Code@{Code}}
\subsubsection[{set\_\-target}]{\setlength{\rightskip}{0pt plus 5cm}void Code::set\_\-target (
\begin{DoxyParamCaption}
\item[{const {\bf Code::Target}}]{target}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_ae70613052d71261e92e6d9c3a68c5a85}


Set \hyperlink{protocolthe-p}{the} target. 


\begin{DoxyParams}{Parameters}
{\em target} & \hyperlink{protocolthe-p}{the} target. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a8356513601bd18b26dd550f913ca62e5}{
\index{Code@{Code}!set\_\-target\_\-filter@{set\_\-target\_\-filter}}
\index{set\_\-target\_\-filter@{set\_\-target\_\-filter}!Code@{Code}}
\subsubsection[{set\_\-target\_\-filter}]{\setlength{\rightskip}{0pt plus 5cm}void Code::set\_\-target\_\-filter (
\begin{DoxyParamCaption}
\item[{const filter::Filter \&}]{filter}
\end{DoxyParamCaption}
)}}
\label{classCode_a8356513601bd18b26dd550f913ca62e5}


Set \hyperlink{protocolthe-p}{the} target filter type. 


\begin{DoxyParams}{Parameters}
{\em filter} & \hyperlink{protocolthe-p}{the} target filter type. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_ab2a934ebb3e46b5678d23092a1e068ac}{
\index{Code@{Code}!set\_\-target\_\-protocol@{set\_\-target\_\-protocol}}
\index{set\_\-target\_\-protocol@{set\_\-target\_\-protocol}!Code@{Code}}
\subsubsection[{set\_\-target\_\-protocol}]{\setlength{\rightskip}{0pt plus 5cm}void Code::set\_\-target\_\-protocol (
\begin{DoxyParamCaption}
\item[{const string \&}]{protocol}
\end{DoxyParamCaption}
)}}
\label{classCode_ab2a934ebb3e46b5678d23092a1e068ac}


Set \hyperlink{protocolthe-p}{the} target protocol. 


\begin{DoxyParams}{Parameters}
{\em protocol} & \hyperlink{protocolthe-p}{the} target protocol name. \\
\hline
\end{DoxyParams}
\hypertarget{classCode_a791cf2187f66025c2c7ab98814b0d1b0}{
\index{Code@{Code}!str@{str}}
\index{str@{str}!Code@{Code}}
\subsubsection[{str}]{\setlength{\rightskip}{0pt plus 5cm}string Code::str (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classCode_a791cf2187f66025c2c7ab98814b0d1b0}
\begin{DoxyReturn}{Returns}
string representation of code. 
\end{DoxyReturn}
\hypertarget{classCode_ab698a95be2083481fcaeff266baade65}{
\index{Code@{Code}!target@{target}}
\index{target@{target}!Code@{Code}}
\subsubsection[{target}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Code::Target}\& Code::target (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classCode_ab698a95be2083481fcaeff266baade65}


Get \hyperlink{protocolthe-p}{the} target. 

\begin{DoxyReturn}{Returns}
a reference to \hyperlink{protocolthe-p}{the} target. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/policy/code.hh\item 
/home/greearb/git/xorp.ct.github/xorp/policy/code.cc\end{DoxyCompactItemize}
