Node< value_t > Struct Template Reference

#include <linked_impl.h>

Public Types

typedef value_t value_type
 

Public Member Functions

 Node (const value_type &value)
 
std::shared_ptr< Tree< value_t > > get_ith_subtree (int i)
 
void set_ith_subtree (std::shared_ptr< Tree< value_type >> pT, int i)
 
value_type get_val ()
 
void set_val (const value_type &value)
 
Node< value_type > & get_parent ()
 
void set_parent (std::shared_ptr< Node< value_type >> new_parent)
 

Public Attributes

std::shared_ptr< Nodeparent
 
value_type val
 
std::vector< std::shared_ptr< Tree< value_t > > > subtrees
 

Member Typedef Documentation

template<typename value_t>
typedef value_t Node< value_t >::value_type

Constructor & Destructor Documentation

template<typename value_t>
Node< value_t >::Node ( const value_type value)
inline

Construct a node, given the value associated with the node, references to its parent and subtrees

72  {
73  val = value;
74  parent = 0;
75  // Keep the subtrees list empty
76  }
value_type val
Definition: linked_impl.h:66
std::shared_ptr< Node > parent
Definition: linked_impl.h:64

Member Function Documentation

template<typename value_t>
std::shared_ptr<Tree<value_t> > Node< value_t >::get_ith_subtree ( int  i)
inline
78  {
79  if(i >= subtrees.size())
80  throw std::out_of_range("i is too big");
81  return subtrees[i];
82  }
std::vector< std::shared_ptr< Tree< value_t > > > subtrees
Definition: linked_impl.h:68
template<typename value_t>
Node<value_type>& Node< value_t >::get_parent ( )
inline
100  {
101  return parent;
102  }
std::shared_ptr< Node > parent
Definition: linked_impl.h:64
template<typename value_t>
value_type Node< value_t >::get_val ( )
inline
93  {
94  return val;
95  }
value_type val
Definition: linked_impl.h:66
template<typename value_t>
void Node< value_t >::set_ith_subtree ( std::shared_ptr< Tree< value_type >>  pT,
int  i 
)
inline
84  {
85  if(i > subtrees.size())
86  throw std::out_of_range("i is too big");
87  if(subtrees.size() == i)
88  subtrees.push_back(pT);
89  else
90  subtrees[i] = pT;
91  }
std::vector< std::shared_ptr< Tree< value_t > > > subtrees
Definition: linked_impl.h:68
template<typename value_t>
void Node< value_t >::set_parent ( std::shared_ptr< Node< value_type >>  new_parent)
inline
103  {
104  parent = new_parent;
105  }
std::shared_ptr< Node > parent
Definition: linked_impl.h:64
template<typename value_t>
void Node< value_t >::set_val ( const value_type value)
inline
96  {
97  val = value;
98  }
value_type val
Definition: linked_impl.h:66

Member Data Documentation

template<typename value_t>
std::shared_ptr<Node> Node< value_t >::parent
template<typename value_t>
std::vector<std::shared_ptr<Tree<value_t> > > Node< value_t >::subtrees
template<typename value_t>
value_type Node< value_t >::val

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