shape_doc 0.1
node< _Object, _CELL > Class Template Reference

#include <node.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Member Functions


Detailed Description

template<class _Object, class _CELL>
class mmx::shape::node< _Object, _CELL >

Definition at line 22 of file node.hpp.


Member Typedef Documentation

typedef _CELL CELL

Definition at line 27 of file node.hpp.

typedef _CELL Cell

Definition at line 28 of file node.hpp.

typedef _Object Object

Definition at line 26 of file node.hpp.


Member Enumeration Documentation

enum NODE_TYPE
Enumerator:
LEFT 
RIGHT 

Definition at line 25 of file node.hpp.

{ LEFT, RIGHT } ;

Constructor & Destructor Documentation

node ( void  )

Definition at line 81 of file node.hpp.

{ 
    m_type   = LEFT ;
    m_var    = 0 ;

    m_parent = NULL ;
    m_left   = NULL;
    m_right  = NULL;

    m_cell   = NULL ;


    depth = 0;
    index = 0;
} 
node ( Object  object,
CELL  cl 
)

Definition at line 97 of file node.hpp.

{ 
    this->m_type   = LEFT ;
    this->m_var    = 0 ;

    this->m_parent = NULL ;
    this->m_left   = NULL;
    this->m_right  = NULL;

    this->m_cell   = cl ;
    m_objects.push_back(object) ;

    depth = 0;
    index = 0;
} 
node ( node< Object, CELL > *  parent,
CELL cl,
NODE_TYPE  nodeType,
int  v = 0 
)

Definition at line 125 of file node.hpp.

References node< _Object, _CELL >::depth, node< _Object, _CELL >::set_leftchild(), and node< _Object, _CELL >::set_rightchild().

{  
    this->m_cell   = cl ;
    this->m_type   = type ; 
    this->m_var    = v ;
    this->m_parent = parent ;

    this->m_left   = NULL;
    this->m_right  = NULL;

    depth = parent->depth+1 ;

    switch(type) { 
    case LEFT : parent->set_leftchild(this) ; break ; 
    case RIGHT: parent->set_rightchild(this) ; break ;  
    default: std::cerr << "Error : the node's type isn't appropriate \n" ; break ;
    }
}
node ( node< Object, CELL > *  left,
node< Object, CELL > *  right,
CELL  cl,
int  v = 0 
)

Definition at line 113 of file node.hpp.

References node< _Object, _CELL >::depth, mmx::shape_ssi::left(), node< _Object, _CELL >::parent(), mmx::shape_ssi::right(), and node< _Object, _CELL >::type().

                                                                                                                                  {

    this->m_parent = NULL ;
    this->m_cell   = cl ;
    this->m_var    = v ;

    left->type  = LEFT ;  left->parent = this ; m_left = left; 
    right->type = RIGHT; right->parent = this ; m_right= right;

    depth = left->depth-1 ;
}
node ( node< Object, CELL > &  node) [protected]

Member Function Documentation

CELL& get_cell ( void  ) [inline]

Definition at line 47 of file node.hpp.

{ return m_cell ; }
bool is_leaf ( void  ) const

Definition at line 144 of file node.hpp.

Referenced by dualize< C, V, Shape, Cell >::get_dual_edge(), dualize< C, V, Shape, Cell >::get_dual_face(), and dualize< C, V, Shape, Cell >::get_dual_vertex().

{
    if((m_left == NULL) && (m_right == NULL) )
        return true; 
    return false; 
} 
size_t leaf_distance ( void  ) const

Definition at line 151 of file node.hpp.

References mmx::min(), and Node.

{
        if ( this->is_leaf() )
                return 0;

        struct inner {
                size_t operator()( const Node* node ) {
                        if ( node == 0 )
                                return 0;
                        else
                                return node->leaf_distance();
                }
        } I;

        size_t d = 0;
        d = std::min( d, I(m_left)  );
        d = std::min( d, I(m_right) );

        return d+1;
}
const node<Object, CELL>* left ( void  ) const [inline]

Definition at line 58 of file node.hpp.

{ return m_left ; }
Object object ( void  ) [inline]

Definition at line 49 of file node.hpp.

{ return m_objects.front() ; }
const node<Object, CELL>* parent ( void  ) const [inline]

Definition at line 60 of file node.hpp.

{ return m_parent ; }
node<Object, CELL>* parent ( void  ) [inline]

Definition at line 56 of file node.hpp.

Referenced by node< _Object, _CELL >::node().

{ return m_parent ; }
const node<Object, CELL>* right ( void  ) const [inline]

Definition at line 59 of file node.hpp.

{ return m_right ; }
void set_cell ( const CELL c) [inline]
void set_leftchild ( node< Object, CELL > *  n) [inline]

Definition at line 43 of file node.hpp.

Referenced by node< _Object, _CELL >::node().

{ m_left = n ; }
void set_parent ( node< Object, CELL > *  n) [inline]

Definition at line 41 of file node.hpp.

Referenced by kdtree< Object *, CELL * >::kdtree().

{ m_parent = n ; }
void set_rightchild ( node< Object, CELL > *  n) [inline]

Definition at line 44 of file node.hpp.

Referenced by node< _Object, _CELL >::node().

{ m_right = n ; }
int split_dir ( void  ) const [inline]

Definition at line 52 of file node.hpp.

{ return m_var; }
NODE_TYPE type ( void  ) const [inline]

Definition at line 51 of file node.hpp.

Referenced by node< _Object, _CELL >::node().

{ return m_type ; }
int var ( void  ) const [inline]

Definition at line 62 of file node.hpp.

{return this->m_var;}

Member Data Documentation

int depth

Definition at line 76 of file node.hpp.

Referenced by node< _Object, _CELL >::node().

int index

Definition at line 77 of file node.hpp.

std::vector<Object> m_objects

Definition at line 68 of file node.hpp.

Referenced by node< OBJECT, CELL >::object().

Definition at line 69 of file node.hpp.

Referenced by node< OBJECT, CELL >::type().

int m_var

Definition at line 70 of file node.hpp.

Referenced by node< OBJECT, CELL >::split_dir(), and node< OBJECT, CELL >::var().


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