\hypertarget{classSingleVarRW}{
\section{SingleVarRW Class Reference}
\label{classSingleVarRW}\index{SingleVarRW@{SingleVarRW}}
}


An interface to \hyperlink{classVarRW}{VarRW} which deals with memory management.  




{\ttfamily \#include $<$single\_\-varrw.hh$>$}

Inheritance diagram for SingleVarRW:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.077922cm]{classSingleVarRW}
\end{center}
\end{figure}
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{classSingleVarRW_1_1SingleVarRWErr}{SingleVarRWErr}
\begin{DoxyCompactList}\small\item\em Exception thrown on error, such as reading unsupported variable. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
const \hyperlink{classElement}{Element} \& \hyperlink{classSingleVarRW_a136aa72d8ec6cf164bb3ac64bf84cf6e}{read} (const Id \&id)
\begin{DoxyCompactList}\small\item\em Implementation of \hyperlink{classVarRW}{VarRW} read. \item\end{DoxyCompactList}\item 
void \hyperlink{classSingleVarRW_a6ae40fd0ed6596f9d371a950a13e974c}{write} (const Id \&id, const \hyperlink{classElement}{Element} \&e)
\begin{DoxyCompactList}\small\item\em Implementation of \hyperlink{classVarRW}{VarRW} write. \item\end{DoxyCompactList}\item 
void \hyperlink{classSingleVarRW_a4f3382c08ac73832cdd6f235b4cf3e24}{sync} ()
\begin{DoxyCompactList}\small\item\em Implementation of \hyperlink{classVarRW}{VarRW} sync. \item\end{DoxyCompactList}\item 
void \hyperlink{classSingleVarRW_a6d3bd9dfbc8a7f0149c696c585df098c}{initialize} (const Id \&id, \hyperlink{classElement}{Element} $\ast$e)
\begin{DoxyCompactList}\small\item\em Register a variable for read access with \hyperlink{classSingleVarRW}{SingleVarRW}. \item\end{DoxyCompactList}\item 
\hypertarget{classSingleVarRW_a9b6b0edbb9f0ed7257d6b217551ac1d2}{
void {\bfseries initialize} (\hyperlink{classPolicyTags}{PolicyTags} \&pt)}
\label{classSingleVarRW_a9b6b0edbb9f0ed7257d6b217551ac1d2}

\item 
\hypertarget{classSingleVarRW_a43ae0f3034a96deba787804ab3fba7e9}{
virtual void \hyperlink{classSingleVarRW_a43ae0f3034a96deba787804ab3fba7e9}{start\_\-read} ()}
\label{classSingleVarRW_a43ae0f3034a96deba787804ab3fba7e9}

\begin{DoxyCompactList}\small\item\em If any reads are performed, this is a marker which informs \hyperlink{protocolthe-p}{the} derived class that reads will now start. \item\end{DoxyCompactList}\item 
\hypertarget{classSingleVarRW_ab1b6149dddb1c4ba0adad6b80ffcddfb}{
virtual void \hyperlink{classSingleVarRW_ab1b6149dddb1c4ba0adad6b80ffcddfb}{start\_\-write} ()}
\label{classSingleVarRW_ab1b6149dddb1c4ba0adad6b80ffcddfb}

\begin{DoxyCompactList}\small\item\em If any writes were performed, this is a marker which informs \hyperlink{protocolthe-p}{the} derived class that writes will start. \item\end{DoxyCompactList}\item 
virtual void \hyperlink{classSingleVarRW_a24cde180db3bac1e4554cafa1809ba7a}{single\_\-write} (const Id \&id, const \hyperlink{classElement}{Element} \&e)=0
\begin{DoxyCompactList}\small\item\em Write of a variable. \item\end{DoxyCompactList}\item 
virtual \hyperlink{classElement}{Element} $\ast$ \hyperlink{classSingleVarRW_a54ef877baad0937b181563e8b5eef44a}{single\_\-read} (const Id \&id)=0
\begin{DoxyCompactList}\small\item\em Read of a variable. \item\end{DoxyCompactList}\item 
\hypertarget{classSingleVarRW_aaaafda3b09500e91202b2a9078039911}{
virtual void \hyperlink{classSingleVarRW_aaaafda3b09500e91202b2a9078039911}{end\_\-write} ()}
\label{classSingleVarRW_aaaafda3b09500e91202b2a9078039911}

\begin{DoxyCompactList}\small\item\em Marks \hyperlink{protocolthe-p}{the} end of writes in case there were any modified fields. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classSingleVarRW_a7562693a9179d4a3c532eb3ae6134e4e}{
\hyperlink{classElement}{Element} $\ast$ {\bfseries \_\-trash} \mbox{[}16\mbox{]}}
\label{classSingleVarRW_a7562693a9179d4a3c532eb3ae6134e4e}

\item 
\hypertarget{classSingleVarRW_a0c772f5e2e9a0bf011fce20355eafc86}{
unsigned {\bfseries \_\-trashc}}
\label{classSingleVarRW_a0c772f5e2e9a0bf011fce20355eafc86}

\item 
\hypertarget{classSingleVarRW_a6c94c6d875f1c0cc8518c92c03b1bf6c}{
const \hyperlink{classElement}{Element} $\ast$ {\bfseries \_\-elems} \mbox{[}VAR\_\-MAX\mbox{]}}
\label{classSingleVarRW_a6c94c6d875f1c0cc8518c92c03b1bf6c}

\item 
\hypertarget{classSingleVarRW_a019caeee67eefea46bc3ae07f0514164}{
bool {\bfseries \_\-modified} \mbox{[}VAR\_\-MAX\mbox{]}}
\label{classSingleVarRW_a019caeee67eefea46bc3ae07f0514164}

\item 
\hypertarget{classSingleVarRW_adda970e4cfe61e88e026fb917a506561}{
bool {\bfseries \_\-did\_\-first\_\-read}}
\label{classSingleVarRW_adda970e4cfe61e88e026fb917a506561}

\item 
\hypertarget{classSingleVarRW_a976e16d181667ee4950995495db7cb6a}{
\hyperlink{classPolicyTags}{PolicyTags} $\ast$ {\bfseries \_\-pt}}
\label{classSingleVarRW_a976e16d181667ee4950995495db7cb6a}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
An interface to \hyperlink{classVarRW}{VarRW} which deals with memory management. Read and writes are cached, so they are done only once on \hyperlink{protocolthe-p}{the} route, not matter how many time \hyperlink{protocolthe-p}{the} filter requests or writes \hyperlink{protocolthe-p}{the} variable.

Because of this caching, \hyperlink{protocolthe-p}{the} \hyperlink{classSingleVarRW}{SingleVarRW} is usuable only once. After it has done its work once, it has to be re-\/created. 

\subsection{Member Function Documentation}
\hypertarget{classSingleVarRW_a6d3bd9dfbc8a7f0149c696c585df098c}{
\index{SingleVarRW@{SingleVarRW}!initialize@{initialize}}
\index{initialize@{initialize}!SingleVarRW@{SingleVarRW}}
\subsubsection[{initialize}]{\setlength{\rightskip}{0pt plus 5cm}void SingleVarRW::initialize (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id, }
\item[{{\bf Element} $\ast$}]{e}
\end{DoxyParamCaption}
)}}
\label{classSingleVarRW_a6d3bd9dfbc8a7f0149c696c585df098c}


Register a variable for read access with \hyperlink{classSingleVarRW}{SingleVarRW}. 

\hyperlink{classSingleVarRW}{SingleVarRW} owns \hyperlink{protocolthe-p}{the} element, so derived classes do not need to worry about deleting objects.

All supported variables must be registered, even \hyperlink{protocolthe-p}{the} ones not present in \hyperlink{protocolthe-p}{the} current route. For example v6 nexthops must be set to \hyperlink{classElemNull}{ElemNull} on v4 routes. \mbox{[}assuming \hyperlink{protocolthe-p}{the} protocol itself supports v6\mbox{]}.


\begin{DoxyParams}{Parameters}
{\em id} & identifier of variable that may be read. \\
\hline
{\em e} & value of variable. \\
\hline
\end{DoxyParams}
\hypertarget{classSingleVarRW_a136aa72d8ec6cf164bb3ac64bf84cf6e}{
\index{SingleVarRW@{SingleVarRW}!read@{read}}
\index{read@{read}!SingleVarRW@{SingleVarRW}}
\subsubsection[{read}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Element} \& SingleVarRW::read (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classSingleVarRW_a136aa72d8ec6cf164bb3ac64bf84cf6e}


Implementation of \hyperlink{classVarRW}{VarRW} read. 

\begin{DoxyReturn}{Returns}
variable requested. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em id} & identifier of variable to be read. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classVarRW_acb944450b84b487faeb1cbde243f76f4}{VarRW}.

\hypertarget{classSingleVarRW_a54ef877baad0937b181563e8b5eef44a}{
\index{SingleVarRW@{SingleVarRW}!single\_\-read@{single\_\-read}}
\index{single\_\-read@{single\_\-read}!SingleVarRW@{SingleVarRW}}
\subsubsection[{single\_\-read}]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf Element}$\ast$ SingleVarRW::single\_\-read (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classSingleVarRW_a54ef877baad0937b181563e8b5eef44a}


Read of a variable. 

The \hyperlink{classVarRW}{VarRW} needs to read a particular element. This may return NULL indicating ElemNull-\/-\/-\/i.e. variable not present in THIS route.

\begin{DoxyReturn}{Returns}
variable requested. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em id} & \hyperlink{protocolthe-p}{the} id of \hyperlink{protocolthe-p}{the} variable. \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classBGPVarRW_aa64291a056e691381e7a9ff35c804a08}{BGPVarRW$<$ A $>$}, \hyperlink{classOlsrVarRW_a0ef1c04cd16c9316df1317b7f07acb4b}{OlsrVarRW}, \hyperlink{classFib2mribVarRW_aa1c27c192d32df130c8cf66cb1438624}{Fib2mribVarRW}, \hyperlink{classOspfVarRW_abb7e7d7066d822731044cec3e9dd0481}{OspfVarRW$<$ A $>$}, \hyperlink{classRIBVarRW_ae87edea94ef2fa71ce9df60d45def4c1}{RIBVarRW$<$ A $>$}, \hyperlink{classRIPVarRW_a9bddce5cdf356328d9f53baa3d036651}{RIPVarRW$<$ A $>$}, \hyperlink{classStaticRoutesVarRW_ab5bb52b36ee7c1b92800fc0ca09dc346}{StaticRoutesVarRW}, and \hyperlink{classBGPVarRW_aa64291a056e691381e7a9ff35c804a08}{BGPVarRW$<$ IPv4 $>$}.

\hypertarget{classSingleVarRW_a24cde180db3bac1e4554cafa1809ba7a}{
\index{SingleVarRW@{SingleVarRW}!single\_\-write@{single\_\-write}}
\index{single\_\-write@{single\_\-write}!SingleVarRW@{SingleVarRW}}
\subsubsection[{single\_\-write}]{\setlength{\rightskip}{0pt plus 5cm}virtual void SingleVarRW::single\_\-write (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id, }
\item[{const {\bf Element} \&}]{e}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{classSingleVarRW_a24cde180db3bac1e4554cafa1809ba7a}


Write of a variable. 

The write MUST be performed now, as \hyperlink{protocolthe-p}{the} element pointer may become invalid after this call. Also, a single write will be called for each modified element.


\begin{DoxyParams}{Parameters}
{\em id} & identifier of variable to be written to. \\
\hline
{\em e} & value of variable. \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classBGPVarRW_a9214997e92d06673c63b1a1f13908859}{BGPVarRW$<$ A $>$}, \hyperlink{classOlsrVarRW_ac6c43e9dda86033ea5de55ba53765cd5}{OlsrVarRW}, \hyperlink{classFib2mribVarRW_a4c10224a00a93289dc583af9fb2c4840}{Fib2mribVarRW}, \hyperlink{classOspfVarRW_a26be3d06181650ebdf5038045ec09b5e}{OspfVarRW$<$ A $>$}, \hyperlink{classRIBVarRW_a39e2908c71f3cdd79d28ee8dfc090745}{RIBVarRW$<$ A $>$}, \hyperlink{classRIPVarRW_a335c57299517205e95ee20a4fb674afb}{RIPVarRW$<$ A $>$}, \hyperlink{classStaticRoutesVarRW_a5c45eaec072f095a4aaa3cde40f8fe17}{StaticRoutesVarRW}, \hyperlink{classBGPVarRW_a9214997e92d06673c63b1a1f13908859}{BGPVarRW$<$ IPv4 $>$}, \hyperlink{classOspfVarRW_ac87984a9a725a415d57147b09f8b3cdf}{OspfVarRW$<$ A $>$}, and \hyperlink{classOspfVarRW_ae91814c818ef6db0e5489566751526fa}{OspfVarRW$<$ A $>$}.

\hypertarget{classSingleVarRW_a4f3382c08ac73832cdd6f235b4cf3e24}{
\index{SingleVarRW@{SingleVarRW}!sync@{sync}}
\index{sync@{sync}!SingleVarRW@{SingleVarRW}}
\subsubsection[{sync}]{\setlength{\rightskip}{0pt plus 5cm}void SingleVarRW::sync (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classSingleVarRW_a4f3382c08ac73832cdd6f235b4cf3e24}


Implementation of \hyperlink{classVarRW}{VarRW} sync. 

Writes are performed now, as cached Element$\ast$ pointers may become invalid afterwards.a

trash is also emptied upon completion. 

Reimplemented from \hyperlink{classVarRW_a6ae2005b7cb7ca447185c36329bb2a14}{VarRW}.

\hypertarget{classSingleVarRW_a6ae40fd0ed6596f9d371a950a13e974c}{
\index{SingleVarRW@{SingleVarRW}!write@{write}}
\index{write@{write}!SingleVarRW@{SingleVarRW}}
\subsubsection[{write}]{\setlength{\rightskip}{0pt plus 5cm}void SingleVarRW::write (
\begin{DoxyParamCaption}
\item[{const Id \&}]{id, }
\item[{const {\bf Element} \&}]{e}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classSingleVarRW_a6ae40fd0ed6596f9d371a950a13e974c}


Implementation of \hyperlink{classVarRW}{VarRW} write. 


\begin{DoxyParams}{Parameters}
{\em id} & identifier of variable to be written to. \\
\hline
{\em e} & value of variable to be written to. \\
\hline
\end{DoxyParams}


Implements \hyperlink{classVarRW_ad7447615a7d30de4c5ad847d1f885f25}{VarRW}.



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