# SmiScenarioTree< T > Class Template Reference

`#include <SmiScenarioTree.hpp>`

List of all members.

## Public Member Functions
Iterators
std::vector< T >::iterator | treeBegin ()
| begin
std::vector< T >::iterator | treeEnd ()
| end
std::vector< T > & | wholeTree ()
| whole tree
std::vector< T >::iterator | scenBegin (int s)
| scenario iterators TODO: native code for these iterators that does not depend on copying.
std::vector< T >::iterator | scenEnd (int s)
| begin
Query members
SmiTreeNode< T > * | getRoot ()
| Get root node.
SmiTreeNode< T > * | getLeaf (int scn)
| Get leaf node.
SmiTreeNode< T > * | find (unsigned int scenario, int stage)
| Get node identified by scenario/stage.
int | getNumScenarios ()
| get number of scenarios
SmiTreeNode< T > * | find (std::vector< int > &label)
| Get node identified by longest match to array of labels.
SmiTreeNode< T > * | find (int *label, unsigned int sz)
| Get node identified by longest match to array of labels.
std::vector< T > & | getScenario (int scenario)
| Get vector of node data for given scenario.
Tree modification members
int | addPathtoLeaf (int brscenario, int stage, std::vector< T > &pathdata, unsigned int start=0)
| Add new path from branching node to leaf.
void | setChildLabels (SmiTreeNode< T > *n, std::vector< int > labels)
| Set child labels.
int | addPathtoLeaf (std::vector< int > &labels, std::vector< T > &pathdata)
| Add new path using labels to find branching node.
SmiTreeNode< T > * | addNodesToTree (SmiTreeNode< T > *parent, int scenario, std::vector< T > &pathdata, int start)
| Add new path from branching node to leaf.
Constructors, destructors and major modifying methods
| SmiScenarioTree ()
| Default Constructor creates an empty scenario tree.
virtual | ~SmiScenarioTree ()
| Destructor.
## Private Attributes
std::vector< T > | node_data
std::vector< T > | scen_data
std::vector< SmiTreeNode< T > * > | leaf_
SmiTreeNode< T > * | root_

## Detailed Description

### template<class T>
class SmiScenarioTree< T >

Definition at line 196 of file SmiScenarioTree.hpp.

## Constructor & Destructor Documentation

template<class T>

SmiScenarioTree< T >::SmiScenarioTree | ( |  | ) | `[inline]`

Default Constructor creates an empty scenario tree.

template<class T>

virtual SmiScenarioTree< T >::~SmiScenarioTree | ( |  | ) | `[inline, virtual]`

Destructor.

## Member Function Documentation

template<class T>

std::vector<T>::iterator SmiScenarioTree< T >::treeBegin | ( |  | ) | `[inline]`

begin

Definition at line 206 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T>::iterator SmiScenarioTree< T >::treeEnd | ( |  | ) | `[inline]`

end

Definition at line 210 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T>& SmiScenarioTree< T >::wholeTree | ( |  | ) | `[inline]`

whole tree

Definition at line 214 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T>::iterator SmiScenarioTree< T >::scenBegin | ( | int | s | ) | `[inline]`

scenario iterators TODO: native code for these iterators that does not depend on copying.

Definition at line 221 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T>::iterator SmiScenarioTree< T >::scenEnd | ( | int | s | ) | `[inline]`

begin

Definition at line 226 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::getRoot | ( |  | ) | `[inline]`

Get root node.

Definition at line 236 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::getLeaf | ( | int | scn | ) | `[inline]`

Get leaf node.

Definition at line 241 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::find | ( | unsigned int | scenario,
|  | int | stage |
| ) |  |  | `[inline]`

Get node identified by scenario/stage.

Definition at line 246 of file SmiScenarioTree.hpp.

template<class T>

int SmiScenarioTree< T >::getNumScenarios | ( |  | ) | `[inline]`

get number of scenarios

Definition at line 256 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::find | ( | std::vector< int > & | label | ) | `[inline]`

Get node identified by longest match to array of labels.

Definition at line 261 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::find | ( | int * | label,
|  | unsigned int | sz |
| ) |  |  | `[inline]`

Get node identified by longest match to array of labels.

Definition at line 274 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T>& SmiScenarioTree< T >::getScenario | ( | int | scenario | ) | `[inline]`

Get vector of node data for given scenario.

Definition at line 289 of file SmiScenarioTree.hpp.

template<class T>

int SmiScenarioTree< T >::addPathtoLeaf | ( | int | brscenario,
|  | int | stage,
|  | std::vector< T > & | pathdata,
|  | unsigned int | start = `0` |
| ) |  |  | `[inline]`

Add new path from branching node to leaf.

The branching node is the one belonging to "brscenario" at depth "stage". Length of incoming "pathdata" vector is leaf->depth() - stage. Responsibility for memory management of SmiTreeNodeData elements is assigned to SmiScenarioTree. SmiTreeNodeData elements must be created with "new" operator.

Definition at line 322 of file SmiScenarioTree.hpp.

template<class T>

void SmiScenarioTree< T >::setChildLabels | ( | SmiTreeNode< T > * | n,
|  | std::vector< int > | labels |
| ) |  |  | `[inline]`

Set child labels.

Definition at line 339 of file SmiScenarioTree.hpp.

template<class T>

int SmiScenarioTree< T >::addPathtoLeaf | ( | std::vector< int > & | labels,
|  | std::vector< T > & | pathdata |
| ) |  |  | `[inline]`

Add new path using labels to find branching node.

The length of the incoming path is leaf.depth(). Responsibility for memory management of SmiTreeNodeData elements is assigned to SmiScenarioTree. SmiTreeNodeData elements must be created with "new" operator.

Definition at line 353 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::addNodesToTree | ( | SmiTreeNode< T > * | parent,
|  | int | scenario,
|  | std::vector< T > & | pathdata,
|  | int | start |
| ) |  |  | `[inline]`

Add new path from branching node to leaf.

The branching node is the one belonging to "brscenario" at depth "stage". Length of incoming "pathdata" vector is leaf->depth() - stage. Responsibility for memory management of SmiTreeNodeData elements is assigned to SmiScenarioTree. SmiTreeNodeData elements must be created with "new" operator.

Definition at line 372 of file SmiScenarioTree.hpp.

## Member Data Documentation

template<class T>

std::vector<T> SmiScenarioTree< T >::node_data`[private]`

Definition at line 404 of file SmiScenarioTree.hpp.

template<class T>

std::vector<T> SmiScenarioTree< T >::scen_data`[private]`

Definition at line 405 of file SmiScenarioTree.hpp.

template<class T>

std::vector<SmiTreeNode<T> *> SmiScenarioTree< T >::leaf_`[private]`

Definition at line 406 of file SmiScenarioTree.hpp.

template<class T>

SmiTreeNode<T>* SmiScenarioTree< T >::root_`[private]`

Definition at line 407 of file SmiScenarioTree.hpp.

The documentation for this class was generated from the following file:

- /home/coin/svn-release/Smi-0.93.1/Smi/src/SmiScenarioTree.hpp