\hypertarget{opal__tree_8h}{\section{opal/class/opal\+\_\+tree.h File Reference}
\label{opal__tree_8h}\index{opal/class/opal\+\_\+tree.\+h@{opal/class/opal\+\_\+tree.\+h}}
}


The \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} interface is used to provide a generic tree list container for Open M\+P\+I.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdio.\+h$>$}\\*
{\ttfamily \#include $<$stdlib.\+h$>$}\\*
{\ttfamily \#include \char`\"{}opal/class/opal\+\_\+object.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/dss/dss.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t}
\item 
struct \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t}
\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal__tree_8h_ad795cf1b3a54fdce4a68f4837127d13f}{typedef struct \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} {\bfseries opal\+\_\+tree\+\_\+item\+\_\+t}}\label{opal__tree_8h_ad795cf1b3a54fdce4a68f4837127d13f}

\item 
typedef int($\ast$ \hyperlink{opal__tree_8h_af9690e7310221fe436283b39afa79aaf}{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t} )(\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item, void $\ast$key)
\begin{DoxyCompactList}\small\item\em Check to see if item's user specific data matches key. \end{DoxyCompactList}\item 
typedef int($\ast$ \hyperlink{opal__tree_8h_a0a5281df1561f32aeb94c90a67363b92}{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t} )(\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item, \hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} $\ast$buffer)
\begin{DoxyCompactList}\small\item\em The serialize function typedef. \end{DoxyCompactList}\item 
typedef int($\ast$ \hyperlink{opal__tree_8h_a91ce40668fdbdabe8053e6179de12fde}{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t} )(\hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} $\ast$buffer, \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$$\ast$item)
\begin{DoxyCompactList}\small\item\em The deserialize function typedef. \end{DoxyCompactList}\item 
\hypertarget{opal__tree_8h_a655f5221204931653647160fa3eeb600}{typedef struct \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} {\bfseries opal\+\_\+tree\+\_\+t}}\label{opal__tree_8h_a655f5221204931653647160fa3eeb600}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal__tree_8h_a5f5224ee97f084436f46e62c88bfa520}{B\+E\+G\+I\+N\+\_\+\+C\+\_\+\+D\+E\+C\+L\+S O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C {\bfseries O\+B\+J\+\_\+\+C\+L\+A\+S\+S\+\_\+\+D\+E\+C\+L\+A\+R\+A\+T\+I\+O\+N} (\hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t})}\label{opal__tree_8h_a5f5224ee97f084436f46e62c88bfa520}

\item 
\hypertarget{opal__tree_8h_aeb93370774e4dc75037cf689695cba6b}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C {\bfseries O\+B\+J\+\_\+\+C\+L\+A\+S\+S\+\_\+\+D\+E\+C\+L\+A\+R\+A\+T\+I\+O\+N} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t})}\label{opal__tree_8h_aeb93370774e4dc75037cf689695cba6b}

\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_af3d1dc4117d8a588010de8bfaaeb44a4}{opal\+\_\+tree\+\_\+get\+\_\+parent} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Macros to access items in the tree. \end{DoxyCompactList}\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a016055f14d6dd7d845e9f269117dc690}{opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Get the next sibling item in the tree. \end{DoxyCompactList}\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a5105aba9d78260b943f5afb650dee666}{opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Get the previous sibling item in the tree. \end{DoxyCompactList}\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a52c5574b92111bb40cde639a8ecbe90e}{opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Get the first child item in the tree. \end{DoxyCompactList}\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a4a2d0b196c7de2cdd8f38059043e4102}{opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Get the last child item in the tree. \end{DoxyCompactList}\item 
static bool \hyperlink{opal__tree_8h_ad55cbf8f97ee40f0a9e21a5287e49f93}{opal\+\_\+tree\+\_\+is\+\_\+empty} (\hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} $\ast$tree)
\begin{DoxyCompactList}\small\item\em Check for empty tree. \end{DoxyCompactList}\item 
static \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a4a65b7c057086c6c6a5e0d267d3ba311}{opal\+\_\+tree\+\_\+get\+\_\+root} (\hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} $\ast$tree)
\begin{DoxyCompactList}\small\item\em Return the root item on the tree (does not remove it). \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C size\+\_\+t \hyperlink{opal__tree_8h_ae9f239e7884f675ad4d30e3094da8327}{opal\+\_\+tree\+\_\+get\+\_\+size} (\hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} $\ast$tree)
\begin{DoxyCompactList}\small\item\em Return the number of items in a tree. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void \hyperlink{opal__tree_8h_a8ade57d89d7d57c5224740c6c92ff063}{opal\+\_\+tree\+\_\+init} (\hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} $\ast$tree, \hyperlink{opal__tree_8h_af9690e7310221fe436283b39afa79aaf}{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t} comp, \hyperlink{opal__tree_8h_a0a5281df1561f32aeb94c90a67363b92}{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t} serialize, \hyperlink{opal__tree_8h_a91ce40668fdbdabe8053e6179de12fde}{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t} deserialize)
\begin{DoxyCompactList}\small\item\em Initialize tree container; must be called before using the tree. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void \hyperlink{opal__tree_8h_a6714748fa73069707dc2b6b9f0d46fda}{opal\+\_\+tree\+\_\+add\+\_\+child} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$parent\+\_\+item, \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$new\+\_\+item)
\begin{DoxyCompactList}\small\item\em Add new item as child to its parent item. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_a035a0e703262ae8f884d88fa6b0c3955}{opal\+\_\+tree\+\_\+remove\+\_\+subtree} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item)
\begin{DoxyCompactList}\small\item\em Remove an item and everything below from a tree. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{opal__tree_8h_a740cda0fb2a274ff2912f3e510b1e3a6}{opal\+\_\+tree\+\_\+serialize} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$start\+\_\+item, \hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} $\ast$buffer)
\begin{DoxyCompactList}\small\item\em Serialize tree data. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{opal__tree_8h_a36d7564cd596509e189ed9ebdadc7920}{opal\+\_\+tree\+\_\+deserialize} (\hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} $\ast$buffer, \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$start\+\_\+item)
\begin{DoxyCompactList}\small\item\em De-\/serialize tree data. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$ \hyperlink{opal__tree_8h_ad73158ab221d75f1eefe776259ce6bda}{opal\+\_\+tree\+\_\+find\+\_\+with} (\hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item, void $\ast$key)
\begin{DoxyCompactList}\small\item\em Return the next tree item that matches key provided. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} interface is used to provide a generic tree list container for Open M\+P\+I. 

It was inspired by the \hyperlink{structopal__list__t}{opal\+\_\+list\+\_\+t} interface but instead of organizing items in a doubly-\/linked list fashion, we order them in a finite tree structure.

The general idea is a user creates an class instance that has two components. A tree structure component as defined by \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} that links all the items together to form the tree. Then there is a user specific data component which the user defines what is stored at each item. When a user create a type to be used for a O\+B\+J\+\_\+\+C\+L\+A\+S\+S\+\_\+\+I\+N\+S\+T\+A\+N\+C\+E it will contain the \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} followed by any user specific data. Then the \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} objects can be put in an \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t}. Hence, you create a new type that derives from \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t}; this new type can then be used with \hyperlink{structopal__tree__t}{opal\+\_\+tree\+\_\+t} containers.

N\+O\+T\+E\+: \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} instances can only be on {\itshape one} tree at a time. Specifically, if you add an \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} to one tree, and then add it to another tree (without first removing it from the first tree), you will effectively be hosing the first tree. You have been warned.

If O\+P\+A\+L\+\_\+\+E\+N\+A\+B\+L\+E\+\_\+\+D\+E\+B\+U\+G is true, a bunch of checks occur, including some spot checks for a debugging reference count in an attempt to ensure that an \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} is only one {\itshape one} tree at a time. Given the highly concurrent nature of this class, these spot checks cannot guarantee that an item is only one tree at a time. Specifically, since it is a desirable attribute of this class to not use locks for normal operations, it is possible that two threads may \mbox{[}erroneously\mbox{]} modify an \hyperlink{structopal__tree__item__t}{opal\+\_\+tree\+\_\+item\+\_\+t} concurrently.

The only way to guarantee that a debugging reference count is valid for the duration of an operation is to lock the item\+\_\+t during the operation. But this fundamentally changes the desirable attribute of this class (i.\+e., no locks). So all we can do is spot-\/check the reference count in a bunch of places and check that it is still the value that we think it should be. But this doesn't mean that you can run into \char`\"{}unlucky\char`\"{} cases where two threads are concurrently modifying an item\+\_\+t, but all the spot checks still return the \char`\"{}right\char`\"{} values. All we can do is hope that we have enough spot checks to statistically drive down the possibility of the unlucky cases happening. 

\subsection{Typedef Documentation}
\hypertarget{opal__tree_8h_af9690e7310221fe436283b39afa79aaf}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t}}
\index{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t)({\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item, void $\ast$key)}}\label{opal__tree_8h_af9690e7310221fe436283b39afa79aaf}


Check to see if item's user specific data matches key. 


\begin{DoxyParams}{Parameters}
{\em item} & -\/ The item we want to check to see if it matches key \\
\hline
{\em key} & -\/ The opaque key that we want the match function to check in the item's user specific data.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 -\/ If item's user specific data matches key 

non-\/zero -\/ If item's user specific data does not match key
\end{DoxyReturn}
This function is implemented by the code that constructs the tree and initialized the pointer by the call to opal\+\_\+tree\+\_\+init. \hypertarget{opal__tree_8h_a91ce40668fdbdabe8053e6179de12fde}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t}}
\index{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t)({\bf opal\+\_\+buffer\+\_\+t} $\ast$buffer, {\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$$\ast$item)}}\label{opal__tree_8h_a91ce40668fdbdabe8053e6179de12fde}


The deserialize function typedef. 

This function is called by the opal tree deserialize code to deserialize a tree item's user specific data.

buffer -\/ the \hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} to deserialized data.  item -\/ item to store the deserialized data into the user specific data

\begin{DoxyReturn}{Returns}
O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S -\/ when successfully deserialized item 
\end{DoxyReturn}
\hypertarget{opal__tree_8h_a0a5281df1561f32aeb94c90a67363b92}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t}}
\index{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t@{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t)({\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$item, {\bf opal\+\_\+buffer\+\_\+t} $\ast$buffer)}}\label{opal__tree_8h_a0a5281df1561f32aeb94c90a67363b92}


The serialize function typedef. 

This function is called by the opal tree serialize code to serialize a tree item's user specific data of a class type.

item -\/ item to serialize the user specific data from  buffer -\/ the \hyperlink{structopal__buffer__t}{opal\+\_\+buffer\+\_\+t} to store the serialized data in.

\begin{DoxyReturn}{Returns}
O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S -\/ when successfully serialized item 
\end{DoxyReturn}


\subsection{Function Documentation}
\hypertarget{opal__tree_8h_a6714748fa73069707dc2b6b9f0d46fda}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+add\+\_\+child@{opal\+\_\+tree\+\_\+add\+\_\+child}}
\index{opal\+\_\+tree\+\_\+add\+\_\+child@{opal\+\_\+tree\+\_\+add\+\_\+child}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+add\+\_\+child}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void opal\+\_\+tree\+\_\+add\+\_\+child (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{parent\+\_\+item, }
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{new\+\_\+item}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_a6714748fa73069707dc2b6b9f0d46fda}


Add new item as child to its parent item. 


\begin{DoxyParams}{Parameters}
{\em parent\+\_\+item} & pointer to what parent the new item belongs to \\
\hline
{\em new\+\_\+item} & the item to be added as a child to parent\+\_\+item\\
\hline
\end{DoxyParams}
The new\+\_\+item is added at the end of the child list of the parent\+\_\+item. 

References O\+P\+A\+L\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+A\+D\+D32, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+container, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+first\+\_\+child, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+last\+\_\+child, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+next\+\_\+sibling, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+ancestors, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+children, opal\+\_\+tree\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+items, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+parent, and opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+prev\+\_\+sibling.

\hypertarget{opal__tree_8h_a36d7564cd596509e189ed9ebdadc7920}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+deserialize@{opal\+\_\+tree\+\_\+deserialize}}
\index{opal\+\_\+tree\+\_\+deserialize@{opal\+\_\+tree\+\_\+deserialize}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+deserialize}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tree\+\_\+deserialize (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+buffer\+\_\+t} $\ast$}]{buffer, }
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{start\+\_\+item}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_a36d7564cd596509e189ed9ebdadc7920}


De-\/serialize tree data. 


\begin{DoxyParams}{Parameters}
{\em buffer} & The opal buffer that is to be deserialized \\
\hline
{\em start\+\_\+item} & The item in the tree the data should be deserialized into\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{classStatus}{Status} of call O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S if everything worked
\end{DoxyReturn}
This routine takes a bytestream that was created by the \hyperlink{opal__tree_8h_a740cda0fb2a274ff2912f3e510b1e3a6}{opal\+\_\+tree\+\_\+serialize()} function and deserializes it into the tree given. If the tree already has data in it, this routine will start adding the new data as a new child of the root item. This routine calls the tree's de-\/serialization method to deserialize the user specific data for each item. 

References opal\+\_\+tree\+\_\+t\+::deserialize, and opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+container.

\hypertarget{opal__tree_8h_ad73158ab221d75f1eefe776259ce6bda}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+find\+\_\+with@{opal\+\_\+tree\+\_\+find\+\_\+with}}
\index{opal\+\_\+tree\+\_\+find\+\_\+with@{opal\+\_\+tree\+\_\+find\+\_\+with}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+find\+\_\+with}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+find\+\_\+with (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item, }
\item[{void $\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_ad73158ab221d75f1eefe776259ce6bda}


Return the next tree item that matches key provided. 


\begin{DoxyParams}{Parameters}
{\em item} & The item to start the find from \\
\hline
{\em key} & the key we are wanting to match with\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the next item that in the tree (starting from item) that matches the key based on a depth first search of the tree. A null pointer is returned if we've reached the end of the tree and have not matched the key.
\end{DoxyReturn}
This routine uses the tree container's comp function to determine the whether there is a match between the key and each item we search in the tree. This means the actual tree type constructed determines how the compare is done with the key. In the case no compare routine is given and N\+U\+L\+L pointer is always returned for this function. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+container, opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child(), opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling(), opal\+\_\+tree\+\_\+get\+\_\+root(), opal\+\_\+tree\+\_\+is\+\_\+empty(), opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+ancestors, and opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+parent.

\hypertarget{opal__tree_8h_a52c5574b92111bb40cde639a8ecbe90e}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child@{opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child}}
\index{opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child@{opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+first\+\_\+child (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_a52c5574b92111bb40cde639a8ecbe90e}


Get the first child item in the tree. 


\begin{DoxyParams}{Parameters}
{\em item} & A tree item.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The first child item in the tree
\end{DoxyReturn}
This function is safe to be called with a null item pointer. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+first\+\_\+child.



Referenced by opal\+\_\+tree\+\_\+find\+\_\+with().

\hypertarget{opal__tree_8h_a4a2d0b196c7de2cdd8f38059043e4102}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child@{opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child}}
\index{opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child@{opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+last\+\_\+child (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_a4a2d0b196c7de2cdd8f38059043e4102}


Get the last child item in the tree. 


\begin{DoxyParams}{Parameters}
{\em item} & A tree item.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The last child item in the tree
\end{DoxyReturn}
This function is safe to be called with a null item pointer. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+last\+\_\+child.

\hypertarget{opal__tree_8h_a016055f14d6dd7d845e9f269117dc690}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling@{opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling}}
\index{opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling@{opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+next\+\_\+sibling (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_a016055f14d6dd7d845e9f269117dc690}


Get the next sibling item in the tree. 


\begin{DoxyParams}{Parameters}
{\em item} & A tree item.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The next sibling item in the tree
\end{DoxyReturn}
This function is safe to be called with a null item pointer. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+next\+\_\+sibling.



Referenced by opal\+\_\+tree\+\_\+find\+\_\+with().

\hypertarget{opal__tree_8h_af3d1dc4117d8a588010de8bfaaeb44a4}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+parent@{opal\+\_\+tree\+\_\+get\+\_\+parent}}
\index{opal\+\_\+tree\+\_\+get\+\_\+parent@{opal\+\_\+tree\+\_\+get\+\_\+parent}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+parent}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+parent (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_af3d1dc4117d8a588010de8bfaaeb44a4}


Macros to access items in the tree. 

Get the parent of item in the tree.


\begin{DoxyParams}{Parameters}
{\em item} & A tree item.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The parent item in the tree
\end{DoxyReturn}
This function is safe to be called with a null item pointer. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+parent.

\hypertarget{opal__tree_8h_a5105aba9d78260b943f5afb650dee666}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling@{opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling}}
\index{opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling@{opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+prev\+\_\+sibling (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_a5105aba9d78260b943f5afb650dee666}


Get the previous sibling item in the tree. 


\begin{DoxyParams}{Parameters}
{\em item} & A tree item.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The previous sibling item in the tree
\end{DoxyReturn}
This function is safe to be called with a null item pointer. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+prev\+\_\+sibling.

\hypertarget{opal__tree_8h_a4a65b7c057086c6c6a5e0d267d3ba311}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+root@{opal\+\_\+tree\+\_\+get\+\_\+root}}
\index{opal\+\_\+tree\+\_\+get\+\_\+root@{opal\+\_\+tree\+\_\+get\+\_\+root}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+root}]{\setlength{\rightskip}{0pt plus 5cm}static {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+get\+\_\+root (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+t} $\ast$}]{tree}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_a4a65b7c057086c6c6a5e0d267d3ba311}


Return the root item on the tree (does not remove it). 


\begin{DoxyParams}{Parameters}
{\em tree} & The tree container\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the first item in the tree
\end{DoxyReturn}
This is an O(1) operation to return the first item in the tree.

This is an inlined function in compilers that support inlining, so it's usually a cheap operation. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+first\+\_\+child, and opal\+\_\+tree\+\_\+t\+::opal\+\_\+tree\+\_\+sentinel.



Referenced by opal\+\_\+tree\+\_\+find\+\_\+with(), opal\+\_\+tree\+\_\+get\+\_\+size(), and opal\+\_\+tree\+\_\+remove\+\_\+subtree().

\hypertarget{opal__tree_8h_ae9f239e7884f675ad4d30e3094da8327}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+get\+\_\+size@{opal\+\_\+tree\+\_\+get\+\_\+size}}
\index{opal\+\_\+tree\+\_\+get\+\_\+size@{opal\+\_\+tree\+\_\+get\+\_\+size}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+get\+\_\+size}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C size\+\_\+t opal\+\_\+tree\+\_\+get\+\_\+size (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+t} $\ast$}]{tree}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_ae9f239e7884f675ad4d30e3094da8327}


Return the number of items in a tree. 


\begin{DoxyParams}{Parameters}
{\em tree} & The tree container\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The size of the tree (size\+\_\+t)
\end{DoxyReturn}
This is an O(1) (in non-\/debug mode) lookup to return the size of the list. 

References opal\+\_\+tree\+\_\+get\+\_\+root(), opal\+\_\+tree\+\_\+is\+\_\+empty(), and opal\+\_\+tree\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+items.

\hypertarget{opal__tree_8h_a8ade57d89d7d57c5224740c6c92ff063}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+init@{opal\+\_\+tree\+\_\+init}}
\index{opal\+\_\+tree\+\_\+init@{opal\+\_\+tree\+\_\+init}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void opal\+\_\+tree\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+t} $\ast$}]{tree, }
\item[{{\bf opal\+\_\+tree\+\_\+comp\+\_\+fn\+\_\+t}}]{comp, }
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+serialize\+\_\+fn\+\_\+t}}]{serialize, }
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+deserialize\+\_\+fn\+\_\+t}}]{deserialize}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_a8ade57d89d7d57c5224740c6c92ff063}


Initialize tree container; must be called before using the tree. 


\begin{DoxyParams}{Parameters}
{\em tree} & The tree to initialize \\
\hline
{\em comp} & Comparison function to attach to tree. \\
\hline
{\em serialize} & Serialization function to attach to tree. \\
\hline
{\em deserialize} & De-\/serialization function to attach to tree. \\
\hline
\end{DoxyParams}


References opal\+\_\+tree\+\_\+t\+::comp, opal\+\_\+tree\+\_\+t\+::deserialize, and opal\+\_\+tree\+\_\+t\+::serialize.

\hypertarget{opal__tree_8h_ad55cbf8f97ee40f0a9e21a5287e49f93}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+is\+\_\+empty@{opal\+\_\+tree\+\_\+is\+\_\+empty}}
\index{opal\+\_\+tree\+\_\+is\+\_\+empty@{opal\+\_\+tree\+\_\+is\+\_\+empty}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+is\+\_\+empty}]{\setlength{\rightskip}{0pt plus 5cm}static bool opal\+\_\+tree\+\_\+is\+\_\+empty (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+t} $\ast$}]{tree}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}}\label{opal__tree_8h_ad55cbf8f97ee40f0a9e21a5287e49f93}


Check for empty tree. 


\begin{DoxyParams}{Parameters}
{\em tree} & The tree container\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if tree's size is 0, false otherwise
\end{DoxyReturn}
This is an O(1) operation.

This is an inlined function in compilers that support inlining, so it's usually a cheap operation. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+first\+\_\+child, and opal\+\_\+tree\+\_\+t\+::opal\+\_\+tree\+\_\+sentinel.



Referenced by opal\+\_\+tree\+\_\+find\+\_\+with(), and opal\+\_\+tree\+\_\+get\+\_\+size().

\hypertarget{opal__tree_8h_a035a0e703262ae8f884d88fa6b0c3955}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+remove\+\_\+subtree@{opal\+\_\+tree\+\_\+remove\+\_\+subtree}}
\index{opal\+\_\+tree\+\_\+remove\+\_\+subtree@{opal\+\_\+tree\+\_\+remove\+\_\+subtree}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+remove\+\_\+subtree}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C {\bf opal\+\_\+tree\+\_\+item\+\_\+t}$\ast$ opal\+\_\+tree\+\_\+remove\+\_\+subtree (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{item}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_a035a0e703262ae8f884d88fa6b0c3955}


Remove an item and everything below from a tree. 


\begin{DoxyParams}{Parameters}
{\em item} & The item at the top of subtree to remove\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the item on the list previous to the one that was removed.
\end{DoxyReturn}
This is an O(1) operation to remove an item from the tree. The item and all children below it will be removed from the tree. This means the item's siblings pointers and potentially the parents first and last pointers will be updated to skip over the item. The tree container will also have its num\+\_\+items adjusted to reflect the number of items that were removed. The tree item (and all children below it) that is returned is now \char`\"{}owned\char`\"{} by the caller -- they are responsible for \hyperlink{opal__object_8h_abc1e3a4a6f319e31f74659a2f073891a}{O\+B\+J\+\_\+\+R\+E\+L\+E\+A\+S\+E()}'ing it.

With E\+N\+A\+B\+L\+E\+\_\+\+D\+E\+B\+U\+G on this routine will validate whether the item is actually in the tree before doing pointer manipulation. 

References opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+container, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+first\+\_\+child, opal\+\_\+tree\+\_\+get\+\_\+root(), opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+last\+\_\+child, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+next\+\_\+sibling, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+children, opal\+\_\+tree\+\_\+t\+::opal\+\_\+tree\+\_\+num\+\_\+items, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+parent, and opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+prev\+\_\+sibling.

\hypertarget{opal__tree_8h_a740cda0fb2a274ff2912f3e510b1e3a6}{\index{opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}!opal\+\_\+tree\+\_\+serialize@{opal\+\_\+tree\+\_\+serialize}}
\index{opal\+\_\+tree\+\_\+serialize@{opal\+\_\+tree\+\_\+serialize}!opal\+\_\+tree.\+h@{opal\+\_\+tree.\+h}}
\subsubsection[{opal\+\_\+tree\+\_\+serialize}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+tree\+\_\+serialize (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+tree\+\_\+item\+\_\+t} $\ast$}]{start\+\_\+item, }
\item[{{\bf opal\+\_\+buffer\+\_\+t} $\ast$}]{buffer}
\end{DoxyParamCaption}
)}}\label{opal__tree_8h_a740cda0fb2a274ff2912f3e510b1e3a6}


Serialize tree data. 


\begin{DoxyParams}{Parameters}
{\em start\+\_\+item} & The item of a tree to start serializing data \\
\hline
{\em buffer} & The opal buffer that contains the serialized data stream of the tree\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S if data has been successfully converted.
\end{DoxyReturn}
This routine walks the tree starting at start\+\_\+item until it has serialized all children items of start\+\_\+item and creates a bytestream of data, using the opal\+\_\+dss.\+pack routine, that can be sent over a network. The format of the bytestream represents the tree parent/child relationship of each item in the tree plus the data inside the tree. This routine calls the tree's serialization method to serialize the user specific data for each item. 

References O\+P\+A\+L\+\_\+\+S\+T\+R\+I\+N\+G, opal\+\_\+tree\+\_\+item\+\_\+t\+::opal\+\_\+tree\+\_\+container, and opal\+\_\+tree\+\_\+t\+::serialize.

